1- use getopts;
2- use crate :: lint ;
3- use crate :: middle :: cstore ;
4- use crate :: session :: config :: {
5- build_configuration ,
6- build_session_options ,
7- to_crate_config,
8- parse_cfgspecs ,
9- } ;
10- use crate :: session:: config:: { LtoCli , LinkerPluginLto , SwitchWithOptPath , ExternEntry } ;
11- use crate :: session:: build_session;
12- use crate :: session:: search_paths:: SearchPath ;
1+ extern crate getopts;
2+
3+ use crate :: interface :: parse_cfgspecs ;
4+
5+ use rustc :: lint ;
6+ use rustc :: middle :: cstore ;
7+ use rustc :: session :: config :: { build_configuration , build_session_options , to_crate_config} ;
8+ use rustc :: session :: config :: { LtoCli , LinkerPluginLto , SwitchWithOptPath , ExternEntry } ;
9+ use rustc :: session :: config :: { Externs , OutputType , OutputTypes , SymbolManglingVersion } ;
10+ use rustc :: session:: config:: { rustc_optgroups , Options , ErrorOutputType , Passes } ;
11+ use rustc :: session:: build_session;
12+ use rustc :: session:: search_paths:: SearchPath ;
1313use std:: collections:: { BTreeMap , BTreeSet } ;
1414use std:: iter:: FromIterator ;
1515use std:: path:: PathBuf ;
16- use super :: { Externs , OutputType , OutputTypes , SymbolManglingVersion } ;
1716use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel } ;
1817use syntax:: symbol:: sym;
1918use syntax:: edition:: { Edition , DEFAULT_EDITION } ;
2019use syntax;
21- use super :: Options ;
2220use rustc_data_structures:: fx:: FxHashSet ;
21+ use rustc_errors:: { ColorConfig , emitter:: HumanReadableErrorType , registry} ;
2322
2423pub fn build_session_options_and_crate_config (
2524 matches : & getopts:: Matches ,
@@ -30,22 +29,23 @@ pub fn build_session_options_and_crate_config(
3029 )
3130}
3231
33- impl ExternEntry {
34- fn new_public < S : Into < String > ,
35- I : IntoIterator < Item = Option < S > > > ( locations : I ) -> ExternEntry {
36- let locations: BTreeSet < _ > = locations. into_iter ( ) . map ( |o| o. map ( |s| s. into ( ) ) )
37- . collect ( ) ;
38-
39- ExternEntry {
40- locations,
41- is_private_dep : false
42- }
32+ fn new_public_extern_entry < S , I > ( locations : I ) -> ExternEntry
33+ where
34+ S : Into < String > ,
35+ I : IntoIterator < Item = Option < S > > ,
36+ {
37+ let locations: BTreeSet < _ > = locations. into_iter ( ) . map ( |o| o. map ( |s| s. into ( ) ) )
38+ . collect ( ) ;
39+
40+ ExternEntry {
41+ locations,
42+ is_private_dep : false
4343 }
4444}
4545
4646fn optgroups ( ) -> getopts:: Options {
4747 let mut opts = getopts:: Options :: new ( ) ;
48- for group in super :: rustc_optgroups ( ) {
48+ for group in rustc_optgroups ( ) {
4949 ( group. apply ) ( & mut opts) ;
5050 }
5151 return opts;
@@ -63,7 +63,7 @@ fn test_switch_implies_cfg_test() {
6363 Ok ( m) => m,
6464 Err ( f) => panic ! ( "test_switch_implies_cfg_test: {}" , f) ,
6565 } ;
66- let registry = errors :: registry:: Registry :: new ( & [ ] ) ;
66+ let registry = registry:: Registry :: new ( & [ ] ) ;
6767 let ( sessopts, cfg) = build_session_options_and_crate_config ( matches) ;
6868 let sess = build_session ( sessopts, None , registry) ;
6969 let cfg = build_configuration ( & sess, to_crate_config ( cfg) ) ;
@@ -81,7 +81,7 @@ fn test_switch_implies_cfg_test_unless_cfg_test() {
8181 Ok ( m) => m,
8282 Err ( f) => panic ! ( "test_switch_implies_cfg_test_unless_cfg_test: {}" , f) ,
8383 } ;
84- let registry = errors :: registry:: Registry :: new ( & [ ] ) ;
84+ let registry = registry:: Registry :: new ( & [ ] ) ;
8585 let ( sessopts, cfg) = build_session_options_and_crate_config ( matches) ;
8686 let sess = build_session ( sessopts, None , registry) ;
8787 let cfg = build_configuration ( & sess, to_crate_config ( cfg) ) ;
@@ -95,7 +95,7 @@ fn test_switch_implies_cfg_test_unless_cfg_test() {
9595fn test_can_print_warnings ( ) {
9696 syntax:: with_default_globals ( || {
9797 let matches = optgroups ( ) . parse ( & [ "-Awarnings" . to_string ( ) ] ) . unwrap ( ) ;
98- let registry = errors :: registry:: Registry :: new ( & [ ] ) ;
98+ let registry = registry:: Registry :: new ( & [ ] ) ;
9999 let ( sessopts, _) = build_session_options_and_crate_config ( & matches) ;
100100 let sess = build_session ( sessopts, None , registry) ;
101101 assert ! ( !sess. diagnostic( ) . can_emit_warnings( ) ) ;
@@ -105,15 +105,15 @@ fn test_can_print_warnings() {
105105 let matches = optgroups ( )
106106 . parse ( & [ "-Awarnings" . to_string ( ) , "-Dwarnings" . to_string ( ) ] )
107107 . unwrap ( ) ;
108- let registry = errors :: registry:: Registry :: new ( & [ ] ) ;
108+ let registry = registry:: Registry :: new ( & [ ] ) ;
109109 let ( sessopts, _) = build_session_options_and_crate_config ( & matches) ;
110110 let sess = build_session ( sessopts, None , registry) ;
111111 assert ! ( sess. diagnostic( ) . can_emit_warnings( ) ) ;
112112 } ) ;
113113
114114 syntax:: with_default_globals ( || {
115115 let matches = optgroups ( ) . parse ( & [ "-Adead_code" . to_string ( ) ] ) . unwrap ( ) ;
116- let registry = errors :: registry:: Registry :: new ( & [ ] ) ;
116+ let registry = registry:: Registry :: new ( & [ ] ) ;
117117 let ( sessopts, _) = build_session_options_and_crate_config ( & matches) ;
118118 let sess = build_session ( sessopts, None , registry) ;
119119 assert ! ( sess. diagnostic( ) . can_emit_warnings( ) ) ;
@@ -172,33 +172,33 @@ fn test_externs_tracking_hash_different_construction_order() {
172172 v1. externs = Externs :: new ( mk_map ( vec ! [
173173 (
174174 String :: from( "a" ) ,
175- ExternEntry :: new_public ( vec![ Some ( "b" ) , Some ( "c" ) ] )
175+ new_public_extern_entry ( vec![ Some ( "b" ) , Some ( "c" ) ] )
176176 ) ,
177177 (
178178 String :: from( "d" ) ,
179- ExternEntry :: new_public ( vec![ Some ( "e" ) , Some ( "f" ) ] )
179+ new_public_extern_entry ( vec![ Some ( "e" ) , Some ( "f" ) ] )
180180 ) ,
181181 ] ) ) ;
182182
183183 v2. externs = Externs :: new ( mk_map ( vec ! [
184184 (
185185 String :: from( "d" ) ,
186- ExternEntry :: new_public ( vec![ Some ( "e" ) , Some ( "f" ) ] )
186+ new_public_extern_entry ( vec![ Some ( "e" ) , Some ( "f" ) ] )
187187 ) ,
188188 (
189189 String :: from( "a" ) ,
190- ExternEntry :: new_public ( vec![ Some ( "b" ) , Some ( "c" ) ] )
190+ new_public_extern_entry ( vec![ Some ( "b" ) , Some ( "c" ) ] )
191191 ) ,
192192 ] ) ) ;
193193
194194 v3. externs = Externs :: new ( mk_map ( vec ! [
195195 (
196196 String :: from( "a" ) ,
197- ExternEntry :: new_public ( vec![ Some ( "b" ) , Some ( "c" ) ] )
197+ new_public_extern_entry ( vec![ Some ( "b" ) , Some ( "c" ) ] )
198198 ) ,
199199 (
200200 String :: from( "d" ) ,
201- ExternEntry :: new_public ( vec![ Some ( "f" ) , Some ( "e" ) ] )
201+ new_public_extern_entry ( vec![ Some ( "f" ) , Some ( "e" ) ] )
202202 ) ,
203203 ] ) ) ;
204204
@@ -282,9 +282,9 @@ fn test_search_paths_tracking_hash_different_order() {
282282 let mut v3 = Options :: default ( ) ;
283283 let mut v4 = Options :: default ( ) ;
284284
285- const JSON : super :: ErrorOutputType = super :: ErrorOutputType :: Json {
285+ const JSON : ErrorOutputType = ErrorOutputType :: Json {
286286 pretty : false ,
287- json_rendered : super :: HumanReadableErrorType :: Default ( super :: ColorConfig :: Never ) ,
287+ json_rendered : HumanReadableErrorType :: Default ( ColorConfig :: Never ) ,
288288 } ;
289289
290290 // Reference
@@ -455,7 +455,7 @@ fn test_codegen_options_tracking_hash() {
455455 opts. cg . codegen_units = Some ( 42 ) ;
456456 assert_eq ! ( reference. dep_tracking_hash( ) , opts. dep_tracking_hash( ) ) ;
457457
458- opts. cg . remark = super :: Passes :: Some ( vec ! [ String :: from( "pass1" ) , String :: from( "pass2" ) ] ) ;
458+ opts. cg . remark = Passes :: Some ( vec ! [ String :: from( "pass1" ) , String :: from( "pass2" ) ] ) ;
459459 assert_eq ! ( reference. dep_tracking_hash( ) , opts. dep_tracking_hash( ) ) ;
460460
461461 opts. cg . save_temps = true ;
0 commit comments