@@ -672,17 +672,6 @@ pub fn line_directive<'line>(
672672 }
673673}
674674
675- fn iter_header < R : Read > (
676- mode : Mode ,
677- suite : & str ,
678- poisoned : & mut bool ,
679- testfile : & Path ,
680- rdr : R ,
681- it : & mut dyn FnMut ( HeaderLine < ' _ > ) ,
682- ) {
683- iter_header_extra ( mode, suite, poisoned, testfile, rdr, & [ ] , it)
684- }
685-
686675/// This is generated by collecting directives from ui tests and then extracting their directive
687676/// names. This is **not** an exhaustive list of all possible directives. Instead, this is a
688677/// best-effort approximation for diagnostics.
@@ -813,23 +802,37 @@ struct HeaderLine<'ln> {
813802 line_number : usize ,
814803}
815804
816- fn iter_header_extra (
805+ fn iter_header (
817806 mode : Mode ,
818807 suite : & str ,
819808 poisoned : & mut bool ,
820809 testfile : & Path ,
821810 rdr : impl Read ,
822- extra_directives : & [ & str ] ,
823811 it : & mut dyn FnMut ( HeaderLine < ' _ > ) ,
824812) {
825813 if testfile. is_dir ( ) {
826814 return ;
827815 }
828816
829- // Process any extra directives supplied by the caller (e.g. because they
830- // are implied by the test mode), with a dummy line number of 0.
831- for directive in extra_directives {
832- it ( HeaderLine { header_revision : None , original_line : "" , directive, line_number : 0 } ) ;
817+ // Coverage tests in coverage-run mode always have these extra directives,
818+ // without needing to specify them manually in every test file.
819+ // (Some of the comments below have been copied over from the old
820+ // `tests/run-make/coverage-reports/Makefile`, which no longer exists.)
821+ if mode == Mode :: CoverageRun {
822+ let extra_directives: & [ & str ] = & [
823+ "needs-profiler-support" ,
824+ // FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
825+ // properly. Since we only have GCC on the CI ignore the test for now.
826+ "ignore-windows-gnu" ,
827+ // FIXME(pietroalbini): this test currently does not work on cross-compiled
828+ // targets because remote-test is not capable of sending back the *.profraw
829+ // files generated by the LLVM instrumentation.
830+ "ignore-cross-compile" ,
831+ ] ;
832+ // Process the extra implied directives, with a dummy line number of 0.
833+ for directive in extra_directives {
834+ it ( HeaderLine { header_revision : None , original_line : "" , directive, line_number : 0 } ) ;
835+ }
833836 }
834837
835838 let comment = if testfile. extension ( ) . is_some_and ( |e| e == "rs" ) {
@@ -1162,35 +1165,14 @@ pub fn make_test_description<R: Read>(
11621165 let mut ignore_message = None ;
11631166 let mut should_fail = false ;
11641167
1165- let extra_directives: & [ & str ] = match config. mode {
1166- // The coverage-run tests are treated as having these extra directives,
1167- // without needing to specify them manually in every test file.
1168- // (Some of the comments below have been copied over from
1169- // `tests/run-make/coverage-reports/Makefile`, which no longer exists.)
1170- Mode :: CoverageRun => {
1171- & [
1172- "needs-profiler-support" ,
1173- // FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
1174- // properly. Since we only have GCC on the CI ignore the test for now.
1175- "ignore-windows-gnu" ,
1176- // FIXME(pietroalbini): this test currently does not work on cross-compiled
1177- // targets because remote-test is not capable of sending back the *.profraw
1178- // files generated by the LLVM instrumentation.
1179- "ignore-cross-compile" ,
1180- ]
1181- }
1182- _ => & [ ] ,
1183- } ;
1184-
11851168 let mut local_poisoned = false ;
11861169
1187- iter_header_extra (
1170+ iter_header (
11881171 config. mode ,
11891172 & config. suite ,
11901173 & mut local_poisoned,
11911174 path,
11921175 src,
1193- extra_directives,
11941176 & mut |HeaderLine { header_revision, original_line, directive : ln, line_number } | {
11951177 if header_revision. is_some ( ) && header_revision != cfg {
11961178 return ;
0 commit comments