@@ -671,17 +671,6 @@ pub fn line_directive<'line>(
671
671
}
672
672
}
673
673
674
- fn iter_header < R : Read > (
675
- mode : Mode ,
676
- suite : & str ,
677
- poisoned : & mut bool ,
678
- testfile : & Path ,
679
- rdr : R ,
680
- it : & mut dyn FnMut ( Option < & str > , & str , & str , usize ) ,
681
- ) {
682
- iter_header_extra ( mode, suite, poisoned, testfile, rdr, & [ ] , it)
683
- }
684
-
685
674
/// This is generated by collecting directives from ui tests and then extracting their directive
686
675
/// names. This is **not** an exhaustive list of all possible directives. Instead, this is a
687
676
/// best-effort approximation for diagnostics.
@@ -800,23 +789,38 @@ const DIAGNOSTICS_DIRECTIVE_NAMES: &[&str] = &[
800
789
"unset-rustc-env" ,
801
790
] ;
802
791
803
- fn iter_header_extra (
792
+ fn iter_header (
804
793
mode : Mode ,
805
794
suite : & str ,
806
795
poisoned : & mut bool ,
807
796
testfile : & Path ,
808
797
rdr : impl Read ,
809
- extra_directives : & [ & str ] ,
798
+ // Callback arguments: (revision_name, original_line, line, line_number)
810
799
it : & mut dyn FnMut ( Option < & str > , & str , & str , usize ) ,
811
800
) {
812
801
if testfile. is_dir ( ) {
813
802
return ;
814
803
}
815
804
816
- // Process any extra directives supplied by the caller (e.g. because they
817
- // are implied by the test mode), with a dummy line number of 0.
818
- for directive in extra_directives {
819
- it ( None , directive, directive, 0 ) ;
805
+ // Coverage tests in coverage-run mode always have these extra directives,
806
+ // without needing to specify them manually in every test file.
807
+ // (Some of the comments below have been copied over from the old
808
+ // `tests/run-make/coverage-reports/Makefile`, which no longer exists.)
809
+ if mode == Mode :: CoverageRun {
810
+ let extra_directives: & [ & str ] = & [
811
+ "needs-profiler-support" ,
812
+ // FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
813
+ // properly. Since we only have GCC on the CI ignore the test for now.
814
+ "ignore-windows-gnu" ,
815
+ // FIXME(pietroalbini): this test currently does not work on cross-compiled
816
+ // targets because remote-test is not capable of sending back the *.profraw
817
+ // files generated by the LLVM instrumentation.
818
+ "ignore-cross-compile" ,
819
+ ] ;
820
+ // Process the extra implied directives, with a dummy line number of 0.
821
+ for directive in extra_directives {
822
+ it ( None , "" , directive, 0 ) ;
823
+ }
820
824
}
821
825
822
826
let comment = if testfile. extension ( ) . is_some_and ( |e| e == "rs" ) {
@@ -1148,35 +1152,14 @@ pub fn make_test_description<R: Read>(
1148
1152
let mut ignore_message = None ;
1149
1153
let mut should_fail = false ;
1150
1154
1151
- let extra_directives: & [ & str ] = match config. mode {
1152
- // The coverage-run tests are treated as having these extra directives,
1153
- // without needing to specify them manually in every test file.
1154
- // (Some of the comments below have been copied over from
1155
- // `tests/run-make/coverage-reports/Makefile`, which no longer exists.)
1156
- Mode :: CoverageRun => {
1157
- & [
1158
- "needs-profiler-support" ,
1159
- // FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
1160
- // properly. Since we only have GCC on the CI ignore the test for now.
1161
- "ignore-windows-gnu" ,
1162
- // FIXME(pietroalbini): this test currently does not work on cross-compiled
1163
- // targets because remote-test is not capable of sending back the *.profraw
1164
- // files generated by the LLVM instrumentation.
1165
- "ignore-cross-compile" ,
1166
- ]
1167
- }
1168
- _ => & [ ] ,
1169
- } ;
1170
-
1171
1155
let mut local_poisoned = false ;
1172
1156
1173
- iter_header_extra (
1157
+ iter_header (
1174
1158
config. mode ,
1175
1159
& config. suite ,
1176
1160
& mut local_poisoned,
1177
1161
path,
1178
1162
src,
1179
- extra_directives,
1180
1163
& mut |revision, og_ln, ln, line_number| {
1181
1164
if revision. is_some ( ) && revision != cfg {
1182
1165
return ;
0 commit comments