@@ -46,7 +46,7 @@ impl EarlyProps {
46
46
47
47
pub fn from_reader < R : Read > ( config : & Config , testfile : & Path , rdr : R ) -> Self {
48
48
let mut props = EarlyProps :: default ( ) ;
49
- iter_header ( testfile, rdr, & mut |_, ln, _| {
49
+ iter_header ( config . mode , testfile, rdr, & mut |_, ln, _| {
50
50
config. push_name_value_directive ( ln, directives:: AUX_BUILD , & mut props. aux , |r| {
51
51
r. trim ( ) . to_string ( )
52
52
} ) ;
@@ -306,7 +306,7 @@ impl TestProps {
306
306
if !testfile. is_dir ( ) {
307
307
let file = File :: open ( testfile) . unwrap ( ) ;
308
308
309
- iter_header ( testfile, file, & mut |revision, ln, _| {
309
+ iter_header ( self . config . mode , testfile, file, & mut |revision, ln, _| {
310
310
if revision. is_some ( ) && revision != cfg {
311
311
return ;
312
312
}
@@ -628,11 +628,17 @@ pub fn line_directive<'line>(
628
628
}
629
629
}
630
630
631
- fn iter_header < R : Read > ( testfile : & Path , rdr : R , it : & mut dyn FnMut ( Option < & str > , & str , usize ) ) {
632
- iter_header_extra ( testfile, rdr, & [ ] , it)
631
+ fn iter_header < R : Read > (
632
+ mode : Mode ,
633
+ testfile : & Path ,
634
+ rdr : R ,
635
+ it : & mut dyn FnMut ( Option < & str > , & str , usize ) ,
636
+ ) {
637
+ iter_header_extra ( mode, testfile, rdr, & [ ] , it)
633
638
}
634
639
635
640
fn iter_header_extra (
641
+ mode : Mode ,
636
642
testfile : & Path ,
637
643
rdr : impl Read ,
638
644
extra_directives : & [ & str ] ,
@@ -648,7 +654,11 @@ fn iter_header_extra(
648
654
it ( None , directive, 0 ) ;
649
655
}
650
656
651
- let comment = if testfile. extension ( ) . is_some_and ( |e| e == "rs" ) { "//" } else { "#" } ;
657
+ let comment = if testfile. extension ( ) . is_some_and ( |e| e == "rs" ) {
658
+ if mode == Mode :: Ui { "//@" } else { "//" }
659
+ } else {
660
+ "#"
661
+ } ;
652
662
653
663
let mut rdr = BufReader :: new ( rdr) ;
654
664
let mut ln = String :: new ( ) ;
@@ -946,12 +956,17 @@ pub fn make_test_description<R: Read>(
946
956
_ => & [ ] ,
947
957
} ;
948
958
949
- iter_header_extra ( path, src, extra_directives, & mut |revision, ln, line_number| {
950
- if revision. is_some ( ) && revision != cfg {
951
- return ;
952
- }
959
+ iter_header_extra (
960
+ config. mode ,
961
+ path,
962
+ src,
963
+ extra_directives,
964
+ & mut |revision, ln, line_number| {
965
+ if revision. is_some ( ) && revision != cfg {
966
+ return ;
967
+ }
953
968
954
- macro_rules! decision {
969
+ macro_rules! decision {
955
970
( $e: expr) => {
956
971
match $e {
957
972
IgnoreDecision :: Ignore { reason } => {
@@ -971,24 +986,25 @@ pub fn make_test_description<R: Read>(
971
986
} ;
972
987
}
973
988
974
- decision ! ( cfg:: handle_ignore( config, ln) ) ;
975
- decision ! ( cfg:: handle_only( config, ln) ) ;
976
- decision ! ( needs:: handle_needs( & cache. needs, config, ln) ) ;
977
- decision ! ( ignore_llvm( config, ln) ) ;
978
- decision ! ( ignore_cdb( config, ln) ) ;
979
- decision ! ( ignore_gdb( config, ln) ) ;
980
- decision ! ( ignore_lldb( config, ln) ) ;
981
-
982
- if config. target == "wasm32-unknown-unknown" {
983
- if config. parse_name_directive ( ln, directives:: CHECK_RUN_RESULTS ) {
984
- decision ! ( IgnoreDecision :: Ignore {
985
- reason: "ignored when checking the run results on WASM" . into( ) ,
986
- } ) ;
989
+ decision ! ( cfg:: handle_ignore( config, ln) ) ;
990
+ decision ! ( cfg:: handle_only( config, ln) ) ;
991
+ decision ! ( needs:: handle_needs( & cache. needs, config, ln) ) ;
992
+ decision ! ( ignore_llvm( config, ln) ) ;
993
+ decision ! ( ignore_cdb( config, ln) ) ;
994
+ decision ! ( ignore_gdb( config, ln) ) ;
995
+ decision ! ( ignore_lldb( config, ln) ) ;
996
+
997
+ if config. target == "wasm32-unknown-unknown" {
998
+ if config. parse_name_directive ( ln, directives:: CHECK_RUN_RESULTS ) {
999
+ decision ! ( IgnoreDecision :: Ignore {
1000
+ reason: "ignored when checking the run results on WASM" . into( ) ,
1001
+ } ) ;
1002
+ }
987
1003
}
988
- }
989
1004
990
- should_fail |= config. parse_name_directive ( ln, "should-fail" ) ;
991
- } ) ;
1005
+ should_fail |= config. parse_name_directive ( ln, "should-fail" ) ;
1006
+ } ,
1007
+ ) ;
992
1008
993
1009
// The `should-fail` annotation doesn't apply to pretty tests,
994
1010
// since we run the pretty printer across all tests by default.
0 commit comments