@@ -1499,10 +1499,13 @@ impl<'test> TestCx<'test> {
14991499 _ => AllowUnused :: No ,
15001500 } ;
15011501
1502- let mut rustc =
1503- self . make_compile_args ( & self . testpaths . file , output_file, emit_metadata, allow_unused) ;
1504-
1505- rustc. arg ( "-L" ) . arg ( & self . aux_output_dir_name ( ) ) ;
1502+ let rustc = self . make_compile_args (
1503+ & self . testpaths . file ,
1504+ output_file,
1505+ emit_metadata,
1506+ allow_unused,
1507+ LinkToAux :: Yes ,
1508+ ) ;
15061509
15071510 self . compose_and_run_compiler ( rustc, None )
15081511 }
@@ -1729,8 +1732,13 @@ impl<'test> TestCx<'test> {
17291732 // Create the directory for the stdout/stderr files.
17301733 create_dir_all ( aux_cx. output_base_dir ( ) ) . unwrap ( ) ;
17311734 let input_file = & aux_testpaths. file ;
1732- let mut aux_rustc =
1733- aux_cx. make_compile_args ( input_file, aux_output, EmitMetadata :: No , AllowUnused :: No ) ;
1735+ let mut aux_rustc = aux_cx. make_compile_args (
1736+ input_file,
1737+ aux_output,
1738+ EmitMetadata :: No ,
1739+ AllowUnused :: No ,
1740+ LinkToAux :: No ,
1741+ ) ;
17341742
17351743 for key in & aux_props. unset_rustc_env {
17361744 aux_rustc. env_remove ( key) ;
@@ -1869,6 +1877,7 @@ impl<'test> TestCx<'test> {
18691877 output_file : TargetLocation ,
18701878 emit_metadata : EmitMetadata ,
18711879 allow_unused : AllowUnused ,
1880+ link_to_aux : LinkToAux ,
18721881 ) -> Command {
18731882 let is_aux = input_file. components ( ) . map ( |c| c. as_os_str ( ) ) . any ( |c| c == "auxiliary" ) ;
18741883 let is_rustdoc = self . is_rustdoc ( ) && !is_aux;
@@ -2056,6 +2065,10 @@ impl<'test> TestCx<'test> {
20562065 rustc. arg ( "-Ctarget-feature=-crt-static" ) ;
20572066 }
20582067
2068+ if let LinkToAux :: Yes = link_to_aux {
2069+ rustc. arg ( "-L" ) . arg ( self . aux_output_dir_name ( ) ) ;
2070+ }
2071+
20592072 rustc. args ( & self . props . compile_flags ) ;
20602073
20612074 rustc
@@ -2247,13 +2260,16 @@ impl<'test> TestCx<'test> {
22472260 // codegen tests (using FileCheck)
22482261
22492262 fn compile_test_and_save_ir ( & self ) -> ProcRes {
2250- let aux_dir = self . aux_output_dir_name ( ) ;
2251-
22522263 let output_file = TargetLocation :: ThisDirectory ( self . output_base_dir ( ) ) ;
22532264 let input_file = & self . testpaths . file ;
2254- let mut rustc =
2255- self . make_compile_args ( input_file, output_file, EmitMetadata :: No , AllowUnused :: No ) ;
2256- rustc. arg ( "-L" ) . arg ( aux_dir) . arg ( "--emit=llvm-ir" ) ;
2265+ let mut rustc = self . make_compile_args (
2266+ input_file,
2267+ output_file,
2268+ EmitMetadata :: No ,
2269+ AllowUnused :: No ,
2270+ LinkToAux :: Yes ,
2271+ ) ;
2272+ rustc. arg ( "--emit=llvm-ir" ) ;
22572273
22582274 self . compose_and_run_compiler ( rustc, None )
22592275 }
@@ -2265,10 +2281,13 @@ impl<'test> TestCx<'test> {
22652281
22662282 let output_file = TargetLocation :: ThisFile ( output_path. clone ( ) ) ;
22672283 let input_file = & self . testpaths . file ;
2268- let mut rustc =
2269- self . make_compile_args ( input_file, output_file, EmitMetadata :: No , AllowUnused :: No ) ;
2270-
2271- rustc. arg ( "-L" ) . arg ( self . aux_output_dir_name ( ) ) ;
2284+ let mut rustc = self . make_compile_args (
2285+ input_file,
2286+ output_file,
2287+ EmitMetadata :: No ,
2288+ AllowUnused :: No ,
2289+ LinkToAux :: Yes ,
2290+ ) ;
22722291
22732292 match self . props . assembly_output . as_ref ( ) . map ( AsRef :: as_ref) {
22742293 Some ( "emit-asm" ) => {
@@ -2409,8 +2428,8 @@ impl<'test> TestCx<'test> {
24092428 output_file,
24102429 EmitMetadata :: No ,
24112430 AllowUnused :: Yes ,
2431+ LinkToAux :: Yes ,
24122432 ) ;
2413- rustc. arg ( "-L" ) . arg ( & new_rustdoc. aux_output_dir_name ( ) ) ;
24142433 new_rustdoc. build_all_auxiliary ( & mut rustc) ;
24152434
24162435 let proc_res = new_rustdoc. document ( & compare_dir) ;
@@ -3354,13 +3373,13 @@ impl<'test> TestCx<'test> {
33543373 if self . props . run_rustfix && self . config . compare_mode . is_none ( ) {
33553374 // And finally, compile the fixed code and make sure it both
33563375 // succeeds and has no diagnostics.
3357- let mut rustc = self . make_compile_args (
3376+ let rustc = self . make_compile_args (
33583377 & self . testpaths . file . with_extension ( UI_FIXED ) ,
33593378 TargetLocation :: ThisFile ( self . make_exe_name ( ) ) ,
33603379 emit_metadata,
33613380 AllowUnused :: No ,
3381+ LinkToAux :: Yes ,
33623382 ) ;
3363- rustc. arg ( "-L" ) . arg ( & self . aux_output_dir_name ( ) ) ;
33643383 let res = self . compose_and_run_compiler ( rustc, None ) ;
33653384 if !res. status . success ( ) {
33663385 self . fatal_proc_rec ( "failed to compile fixed code" , & res) ;
@@ -3948,3 +3967,8 @@ enum AllowUnused {
39483967 Yes ,
39493968 No ,
39503969}
3970+
3971+ enum LinkToAux {
3972+ Yes ,
3973+ No ,
3974+ }
0 commit comments