@@ -1499,10 +1499,13 @@ impl<'test> TestCx<'test> {
1499
1499
_ => AllowUnused :: No ,
1500
1500
} ;
1501
1501
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
+ ) ;
1506
1509
1507
1510
self . compose_and_run_compiler ( rustc, None )
1508
1511
}
@@ -1729,8 +1732,13 @@ impl<'test> TestCx<'test> {
1729
1732
// Create the directory for the stdout/stderr files.
1730
1733
create_dir_all ( aux_cx. output_base_dir ( ) ) . unwrap ( ) ;
1731
1734
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
+ ) ;
1734
1742
1735
1743
for key in & aux_props. unset_rustc_env {
1736
1744
aux_rustc. env_remove ( key) ;
@@ -1869,6 +1877,7 @@ impl<'test> TestCx<'test> {
1869
1877
output_file : TargetLocation ,
1870
1878
emit_metadata : EmitMetadata ,
1871
1879
allow_unused : AllowUnused ,
1880
+ link_to_aux : LinkToAux ,
1872
1881
) -> Command {
1873
1882
let is_aux = input_file. components ( ) . map ( |c| c. as_os_str ( ) ) . any ( |c| c == "auxiliary" ) ;
1874
1883
let is_rustdoc = self . is_rustdoc ( ) && !is_aux;
@@ -2056,6 +2065,10 @@ impl<'test> TestCx<'test> {
2056
2065
rustc. arg ( "-Ctarget-feature=-crt-static" ) ;
2057
2066
}
2058
2067
2068
+ if let LinkToAux :: Yes = link_to_aux {
2069
+ rustc. arg ( "-L" ) . arg ( self . aux_output_dir_name ( ) ) ;
2070
+ }
2071
+
2059
2072
rustc. args ( & self . props . compile_flags ) ;
2060
2073
2061
2074
rustc
@@ -2247,13 +2260,16 @@ impl<'test> TestCx<'test> {
2247
2260
// codegen tests (using FileCheck)
2248
2261
2249
2262
fn compile_test_and_save_ir ( & self ) -> ProcRes {
2250
- let aux_dir = self . aux_output_dir_name ( ) ;
2251
-
2252
2263
let output_file = TargetLocation :: ThisDirectory ( self . output_base_dir ( ) ) ;
2253
2264
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" ) ;
2257
2273
2258
2274
self . compose_and_run_compiler ( rustc, None )
2259
2275
}
@@ -2265,10 +2281,13 @@ impl<'test> TestCx<'test> {
2265
2281
2266
2282
let output_file = TargetLocation :: ThisFile ( output_path. clone ( ) ) ;
2267
2283
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
+ ) ;
2272
2291
2273
2292
match self . props . assembly_output . as_ref ( ) . map ( AsRef :: as_ref) {
2274
2293
Some ( "emit-asm" ) => {
@@ -2409,8 +2428,8 @@ impl<'test> TestCx<'test> {
2409
2428
output_file,
2410
2429
EmitMetadata :: No ,
2411
2430
AllowUnused :: Yes ,
2431
+ LinkToAux :: Yes ,
2412
2432
) ;
2413
- rustc. arg ( "-L" ) . arg ( & new_rustdoc. aux_output_dir_name ( ) ) ;
2414
2433
new_rustdoc. build_all_auxiliary ( & mut rustc) ;
2415
2434
2416
2435
let proc_res = new_rustdoc. document ( & compare_dir) ;
@@ -3354,13 +3373,13 @@ impl<'test> TestCx<'test> {
3354
3373
if self . props . run_rustfix && self . config . compare_mode . is_none ( ) {
3355
3374
// And finally, compile the fixed code and make sure it both
3356
3375
// succeeds and has no diagnostics.
3357
- let mut rustc = self . make_compile_args (
3376
+ let rustc = self . make_compile_args (
3358
3377
& self . testpaths . file . with_extension ( UI_FIXED ) ,
3359
3378
TargetLocation :: ThisFile ( self . make_exe_name ( ) ) ,
3360
3379
emit_metadata,
3361
3380
AllowUnused :: No ,
3381
+ LinkToAux :: Yes ,
3362
3382
) ;
3363
- rustc. arg ( "-L" ) . arg ( & self . aux_output_dir_name ( ) ) ;
3364
3383
let res = self . compose_and_run_compiler ( rustc, None ) ;
3365
3384
if !res. status . success ( ) {
3366
3385
self . fatal_proc_rec ( "failed to compile fixed code" , & res) ;
@@ -3948,3 +3967,8 @@ enum AllowUnused {
3948
3967
Yes ,
3949
3968
No ,
3950
3969
}
3970
+
3971
+ enum LinkToAux {
3972
+ Yes ,
3973
+ No ,
3974
+ }
0 commit comments