@@ -1112,22 +1112,22 @@ actual:\n\
1112
1112
}
1113
1113
1114
1114
fn compile_test ( & self ) -> ProcRes {
1115
- let mut rustc = self . make_compile_args (
1116
- & self . testpaths . file , TargetLocation :: ThisFile ( self . make_exe_name ( ) ) ) ;
1117
-
1118
- rustc. arg ( "-L" ) . arg ( & self . aux_output_dir_name ( ) ) ;
1119
-
1120
- match self . config . mode {
1115
+ let allow_unused = match self . config . mode {
1121
1116
CompileFail | Ui => {
1122
1117
// compile-fail and ui tests tend to have tons of unused code as
1123
1118
// it's just testing various pieces of the compile, but we don't
1124
1119
// want to actually assert warnings about all this code. Instead
1125
1120
// let's just ignore unused code warnings by defaults and tests
1126
1121
// can turn it back on if needed.
1127
- rustc . args ( & [ "-A" , "unused" ] ) ;
1122
+ AllowUnused :: Yes
1128
1123
}
1129
- _ => { }
1130
- }
1124
+ _ => AllowUnused :: No
1125
+ } ;
1126
+
1127
+ let mut rustc = self . make_compile_args (
1128
+ & self . testpaths . file , TargetLocation :: ThisFile ( self . make_exe_name ( ) ) , allow_unused) ;
1129
+
1130
+ rustc. arg ( "-L" ) . arg ( & self . aux_output_dir_name ( ) ) ;
1131
1131
1132
1132
self . compose_and_run_compiler ( rustc, None )
1133
1133
}
@@ -1271,7 +1271,7 @@ actual:\n\
1271
1271
testpaths : & aux_testpaths,
1272
1272
revision : self . revision
1273
1273
} ;
1274
- let mut aux_rustc = aux_cx. make_compile_args ( & aux_testpaths. file , aux_output) ;
1274
+ let mut aux_rustc = aux_cx. make_compile_args ( & aux_testpaths. file , aux_output, AllowUnused :: No ) ;
1275
1275
1276
1276
let crate_type = if aux_props. no_prefer_dynamic {
1277
1277
None
@@ -1367,7 +1367,7 @@ actual:\n\
1367
1367
result
1368
1368
}
1369
1369
1370
- fn make_compile_args ( & self , input_file : & Path , output_file : TargetLocation ) -> Command {
1370
+ fn make_compile_args ( & self , input_file : & Path , output_file : TargetLocation , allow_unused : AllowUnused ) -> Command {
1371
1371
let mut rustc = Command :: new ( & self . config . rustc_path ) ;
1372
1372
rustc. arg ( input_file)
1373
1373
. arg ( "-L" ) . arg ( & self . config . build_base ) ;
@@ -1471,6 +1471,13 @@ actual:\n\
1471
1471
rustc. arg ( format ! ( "-Clinker={}" , linker) ) ;
1472
1472
}
1473
1473
1474
+ match allow_unused {
1475
+ AllowUnused :: Yes => {
1476
+ rustc. args ( & [ "-A" , "unused" ] ) ;
1477
+ }
1478
+ AllowUnused :: No => { }
1479
+ }
1480
+
1474
1481
rustc. args ( & self . props . compile_flags ) ;
1475
1482
1476
1483
rustc
@@ -1699,7 +1706,7 @@ actual:\n\
1699
1706
1700
1707
let output_file = TargetLocation :: ThisDirectory (
1701
1708
self . output_base_name ( ) . parent ( ) . unwrap ( ) . to_path_buf ( ) ) ;
1702
- let mut rustc = self . make_compile_args ( & self . testpaths . file , output_file) ;
1709
+ let mut rustc = self . make_compile_args ( & self . testpaths . file , output_file, AllowUnused :: No ) ;
1703
1710
rustc. arg ( "-L" ) . arg ( aux_dir)
1704
1711
. arg ( "--emit=llvm-ir" ) ;
1705
1712
@@ -2343,6 +2350,7 @@ actual:\n\
2343
2350
let mut rustc = self . make_compile_args (
2344
2351
& self . testpaths . file . with_extension ( UI_FIXED ) ,
2345
2352
TargetLocation :: ThisFile ( self . make_exe_name ( ) ) ,
2353
+ AllowUnused :: No ,
2346
2354
) ;
2347
2355
rustc. arg ( "-L" ) . arg ( & self . aux_output_dir_name ( ) ) ;
2348
2356
let res = self . compose_and_run_compiler ( rustc, None ) ;
@@ -2667,6 +2675,11 @@ enum ExpectedLine<T: AsRef<str>> {
2667
2675
Text ( T )
2668
2676
}
2669
2677
2678
+ enum AllowUnused {
2679
+ Yes ,
2680
+ No ,
2681
+ }
2682
+
2670
2683
impl < T > fmt:: Debug for ExpectedLine < T >
2671
2684
where
2672
2685
T : AsRef < str > + fmt:: Debug
0 commit comments