@@ -3,9 +3,8 @@ use rustc_fs_util::fix_windows_verbatim_for_gcc;
33use  rustc_hir:: def_id:: CrateNum ; 
44use  rustc_middle:: middle:: cstore:: { EncodedMetadata ,  LibSource ,  NativeLibrary ,  NativeLibraryKind } ; 
55use  rustc_middle:: middle:: dependency_format:: Linkage ; 
6- use  rustc_session:: config:: { 
7-     self ,  CFGuard ,  DebugInfo ,  OutputFilenames ,  OutputType ,  PrintRequest ,  Sanitizer , 
8- } ; 
6+ use  rustc_session:: config:: { self ,  CFGuard ,  CrateType ,  DebugInfo } ; 
7+ use  rustc_session:: config:: { OutputFilenames ,  OutputType ,  PrintRequest ,  Sanitizer } ; 
98use  rustc_session:: output:: { check_file_is_writeable,  invalid_output_for_target,  out_filename} ; 
109use  rustc_session:: search_paths:: PathKind ; 
1110/// For all the linkers we support, and information they might 
@@ -55,7 +54,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
5554        // Ignore executable crates if we have -Z no-codegen, as they will error. 
5655        if  ( sess. opts . debugging_opts . no_codegen  || !sess. opts . output_types . should_codegen ( ) ) 
5756            && !output_metadata
58-             && crate_type == config :: CrateType :: Executable 
57+             && crate_type == CrateType :: Executable 
5958        { 
6059            continue ; 
6160        } 
@@ -82,7 +81,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
8281        if  outputs. outputs . should_codegen ( )  { 
8382            let  out_filename = out_filename ( sess,  crate_type,  outputs,  crate_name) ; 
8483            match  crate_type { 
85-                 config :: CrateType :: Rlib  => { 
84+                 CrateType :: Rlib  => { 
8685                    let  _timer = sess. timer ( "link_rlib" ) ; 
8786                    link_rlib :: < B > ( 
8887                        sess, 
@@ -93,7 +92,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
9392                    ) 
9493                    . build ( ) ; 
9594                } 
96-                 config :: CrateType :: Staticlib  => { 
95+                 CrateType :: Staticlib  => { 
9796                    link_staticlib :: < B > ( sess,  codegen_results,  & out_filename,  & tmpdir) ; 
9897                } 
9998                _ => { 
@@ -236,10 +235,10 @@ pub fn each_linked_rlib(
236235    let  mut  fmts = None ; 
237236    for  ( ty,  list)  in  info. dependency_formats . iter ( )  { 
238237        match  ty { 
239-             config :: CrateType :: Executable 
240-             | config :: CrateType :: Staticlib 
241-             | config :: CrateType :: Cdylib 
242-             | config :: CrateType :: ProcMacro  => { 
238+             CrateType :: Executable 
239+             | CrateType :: Staticlib 
240+             | CrateType :: Cdylib 
241+             | CrateType :: ProcMacro  => { 
243242                fmts = Some ( list) ; 
244243                break ; 
245244            } 
@@ -461,7 +460,7 @@ fn link_staticlib<'a, B: ArchiveBuilder<'a>>(
461460// links to all upstream files as well. 
462461fn  link_natively < ' a ,  B :  ArchiveBuilder < ' a > > ( 
463462    sess :  & ' a  Session , 
464-     crate_type :  config :: CrateType , 
463+     crate_type :  CrateType , 
465464    out_filename :  & Path , 
466465    codegen_results :  & CodegenResults , 
467466    tmpdir :  & Path , 
@@ -664,13 +663,13 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
664663    } 
665664} 
666665
667- fn  link_sanitizer_runtime ( sess :  & Session ,  crate_type :  config :: CrateType ,  linker :  & mut  dyn  Linker )  { 
666+ fn  link_sanitizer_runtime ( sess :  & Session ,  crate_type :  CrateType ,  linker :  & mut  dyn  Linker )  { 
668667    let  sanitizer = match  & sess. opts . debugging_opts . sanitizer  { 
669668        Some ( s)  => s, 
670669        None  => return , 
671670    } ; 
672671
673-     if  crate_type != config :: CrateType :: Executable  { 
672+     if  crate_type != CrateType :: Executable  { 
674673        return ; 
675674    } 
676675
@@ -826,7 +825,7 @@ fn preserve_objects_for_their_debuginfo(sess: &Session) -> bool {
826825        . crate_types 
827826        . borrow ( ) 
828827        . iter ( ) 
829-         . any ( |& x| x != config :: CrateType :: Rlib  && x != config :: CrateType :: Staticlib ) ; 
828+         . any ( |& x| x != CrateType :: Rlib  && x != CrateType :: Staticlib ) ; 
830829    if  !output_linked { 
831830        return  false ; 
832831    } 
@@ -1132,8 +1131,8 @@ fn exec_linker(
11321131} 
11331132
11341133/// Add begin object files defined by the target spec. 
1135- fn  add_pre_link_objects ( cmd :  & mut  dyn  Linker ,  sess :  & Session ,  crate_type :  config :: CrateType )  { 
1136-     let  pre_link_objects = if  crate_type == config :: CrateType :: Executable  { 
1134+ fn  add_pre_link_objects ( cmd :  & mut  dyn  Linker ,  sess :  & Session ,  crate_type :  CrateType )  { 
1135+     let  pre_link_objects = if  crate_type == CrateType :: Executable  { 
11371136        & sess. target . target . options . pre_link_objects_exe 
11381137    }  else  { 
11391138        & sess. target . target . options . pre_link_objects_dll 
@@ -1142,15 +1141,15 @@ fn add_pre_link_objects(cmd: &mut dyn Linker, sess: &Session, crate_type: config
11421141        cmd. add_object ( & get_object_file_path ( sess,  obj) ) ; 
11431142    } 
11441143
1145-     if  crate_type == config :: CrateType :: Executable  && sess. crt_static ( Some ( crate_type) )  { 
1144+     if  crate_type == CrateType :: Executable  && sess. crt_static ( Some ( crate_type) )  { 
11461145        for  obj in  & sess. target . target . options . pre_link_objects_exe_crt  { 
11471146            cmd. add_object ( & get_object_file_path ( sess,  obj) ) ; 
11481147        } 
11491148    } 
11501149} 
11511150
11521151/// Add end object files defined by the target spec. 
1153- fn  add_post_link_objects ( cmd :  & mut  dyn  Linker ,  sess :  & Session ,  crate_type :  config :: CrateType )  { 
1152+ fn  add_post_link_objects ( cmd :  & mut  dyn  Linker ,  sess :  & Session ,  crate_type :  CrateType )  { 
11541153    for  obj in  & sess. target . target . options . post_link_objects  { 
11551154        cmd. add_object ( & get_object_file_path ( sess,  obj) ) ; 
11561155    } 
@@ -1167,7 +1166,7 @@ fn add_pre_link_args(
11671166    cmd :  & mut  dyn  Linker , 
11681167    sess :  & Session , 
11691168    flavor :  LinkerFlavor , 
1170-     crate_type :  config :: CrateType , 
1169+     crate_type :  CrateType , 
11711170)  { 
11721171    if  let  Some ( args)  = sess. target . target . options . pre_link_args . get ( & flavor)  { 
11731172        cmd. args ( args) ; 
@@ -1197,13 +1196,13 @@ fn add_late_link_args(
11971196    cmd :  & mut  dyn  Linker , 
11981197    sess :  & Session , 
11991198    flavor :  LinkerFlavor , 
1200-     crate_type :  config :: CrateType , 
1199+     crate_type :  CrateType , 
12011200    codegen_results :  & CodegenResults , 
12021201)  { 
12031202    if  let  Some ( args)  = sess. target . target . options . late_link_args . get ( & flavor)  { 
12041203        cmd. args ( args) ; 
12051204    } 
1206-     let  any_dynamic_crate = crate_type == config :: CrateType :: Dylib 
1205+     let  any_dynamic_crate = crate_type == CrateType :: Dylib 
12071206        || codegen_results. crate_info . dependency_formats . iter ( ) . any ( |( ty,  list) | { 
12081207            * ty == crate_type && list. iter ( ) . any ( |& linkage| linkage == Linkage :: Dynamic ) 
12091208        } ) ; 
@@ -1243,13 +1242,13 @@ fn add_local_crate_allocator_objects(cmd: &mut dyn Linker, codegen_results: &Cod
12431242/// Add object files containing metadata for the current crate. 
12441243fn  add_local_crate_metadata_objects ( 
12451244    cmd :  & mut  dyn  Linker , 
1246-     crate_type :  config :: CrateType , 
1245+     crate_type :  CrateType , 
12471246    codegen_results :  & CodegenResults , 
12481247)  { 
12491248    // When linking a dynamic library, we put the metadata into a section of the 
12501249    // executable. This metadata is in a separate object file from the main 
12511250    // object file, so we link that in here. 
1252-     if  crate_type == config :: CrateType :: Dylib  || crate_type == config :: CrateType :: ProcMacro  { 
1251+     if  crate_type == CrateType :: Dylib  || crate_type == CrateType :: ProcMacro  { 
12531252        if  let  Some ( obj)  = codegen_results. metadata_module . as_ref ( ) . and_then ( |m| m. object . as_ref ( ) ) 
12541253        { 
12551254            cmd. add_object ( obj) ; 
@@ -1263,7 +1262,7 @@ fn add_local_crate_metadata_objects(
12631262fn  link_local_crate_native_libs_and_dependent_crate_libs < ' a ,  B :  ArchiveBuilder < ' a > > ( 
12641263    cmd :  & mut  dyn  Linker , 
12651264    sess :  & ' a  Session , 
1266-     crate_type :  config :: CrateType , 
1265+     crate_type :  CrateType , 
12671266    codegen_results :  & CodegenResults , 
12681267    tmpdir :  & Path , 
12691268)  { 
@@ -1326,10 +1325,10 @@ fn add_position_independent_executable_args(
13261325    cmd :  & mut  dyn  Linker , 
13271326    sess :  & Session , 
13281327    flavor :  LinkerFlavor , 
1329-     crate_type :  config :: CrateType , 
1328+     crate_type :  CrateType , 
13301329    codegen_results :  & CodegenResults , 
13311330)  { 
1332-     if  crate_type != config :: CrateType :: Executable  { 
1331+     if  crate_type != CrateType :: Executable  { 
13331332        return ; 
13341333    } 
13351334
@@ -1407,7 +1406,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
14071406    path :  & Path , 
14081407    flavor :  LinkerFlavor , 
14091408    sess :  & ' a  Session , 
1410-     crate_type :  config :: CrateType , 
1409+     crate_type :  CrateType , 
14111410    tmpdir :  & Path , 
14121411    out_filename :  & Path , 
14131412    codegen_results :  & CodegenResults , 
@@ -1463,7 +1462,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
14631462    cmd. output_filename ( out_filename) ; 
14641463
14651464    // OBJECT-FILES-NO, AUDIT-ORDER 
1466-     if  crate_type == config :: CrateType :: Executable  && sess. target . target . options . is_like_windows  { 
1465+     if  crate_type == CrateType :: Executable  && sess. target . target . options . is_like_windows  { 
14671466        if  let  Some ( ref  s)  = codegen_results. windows_subsystem  { 
14681467            cmd. subsystem ( s) ; 
14691468        } 
@@ -1486,7 +1485,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
14861485    // Try to strip as much out of the generated object by removing unused 
14871486    // sections if possible. See more comments in linker.rs 
14881487    if  !sess. opts . cg . link_dead_code  { 
1489-         let  keep_metadata = crate_type == config :: CrateType :: Dylib ; 
1488+         let  keep_metadata = crate_type == CrateType :: Dylib ; 
14901489        cmd. gc_sections ( keep_metadata) ; 
14911490    } 
14921491
@@ -1522,10 +1521,10 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
15221521
15231522    // NO-OPT-OUT, OBJECT-FILES-NO, AUDIT-ORDER 
15241523    // Tell the linker what we're doing. 
1525-     if  crate_type != config :: CrateType :: Executable  { 
1524+     if  crate_type != CrateType :: Executable  { 
15261525        cmd. build_dylib ( out_filename) ; 
15271526    } 
1528-     if  crate_type == config :: CrateType :: Executable  && sess. crt_static ( Some ( crate_type) )  { 
1527+     if  crate_type == CrateType :: Executable  && sess. crt_static ( Some ( crate_type) )  { 
15291528        cmd. build_static_executable ( ) ; 
15301529    } 
15311530
@@ -1619,7 +1618,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
16191618    cmd :  & mut  dyn  Linker , 
16201619    sess :  & ' a  Session , 
16211620    codegen_results :  & CodegenResults , 
1622-     crate_type :  config :: CrateType , 
1621+     crate_type :  CrateType , 
16231622    tmpdir :  & Path , 
16241623)  { 
16251624    // All of the heavy lifting has previously been accomplished by the 
@@ -1780,7 +1779,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
17801779        sess :  & ' a  Session , 
17811780        codegen_results :  & CodegenResults , 
17821781        tmpdir :  & Path , 
1783-         crate_type :  config :: CrateType , 
1782+         crate_type :  CrateType , 
17841783        cnum :  CrateNum , 
17851784    )  { 
17861785        let  src = & codegen_results. crate_info . used_crate_source [ & cnum] ; 
@@ -1796,7 +1795,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
17961795
17971796        if  ( !are_upstream_rust_objects_already_included ( sess) 
17981797            || ignored_for_lto ( sess,  & codegen_results. crate_info ,  cnum) ) 
1799-             && crate_type != config :: CrateType :: Dylib 
1798+             && crate_type != CrateType :: Dylib 
18001799            && !skip_native
18011800        { 
18021801            cmd. link_rlib ( & fix_windows_verbatim_for_gcc ( cratepath) ) ; 
@@ -1857,7 +1856,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
18571856            // Note, though, that we don't want to include the whole of a 
18581857            // compiler-builtins crate (e.g., compiler-rt) because it'll get 
18591858            // repeatedly linked anyway. 
1860-             if  crate_type == config :: CrateType :: Dylib 
1859+             if  crate_type == CrateType :: Dylib 
18611860                && codegen_results. crate_info . compiler_builtins  != Some ( cnum) 
18621861            { 
18631862                cmd. link_whole_rlib ( & fix_windows_verbatim_for_gcc ( & dst) ) ; 
@@ -1905,7 +1904,7 @@ fn add_upstream_native_libraries(
19051904    cmd :  & mut  dyn  Linker , 
19061905    sess :  & Session , 
19071906    codegen_results :  & CodegenResults , 
1908-     crate_type :  config :: CrateType , 
1907+     crate_type :  CrateType , 
19091908)  { 
19101909    // Be sure to use a topological sorting of crates because there may be 
19111910    // interdependencies between native libraries. When passing -nodefaultlibs, 
0 commit comments