@@ -46,7 +46,8 @@ 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 ( config. mode , testfile, rdr, & mut |_, ln, _| {
49
+ let mut poisoned = false ;
50
+ iter_header ( config. mode , & mut poisoned, testfile, rdr, & mut |_, ln, _| {
50
51
config. push_name_value_directive ( ln, directives:: AUX_BUILD , & mut props. aux , |r| {
51
52
r. trim ( ) . to_string ( )
52
53
} ) ;
@@ -58,6 +59,12 @@ impl EarlyProps {
58
59
) ;
59
60
config. parse_and_update_revisions ( ln, & mut props. revisions ) ;
60
61
} ) ;
62
+
63
+ if poisoned {
64
+ eprintln ! ( "errors encountered during EarlyProps parsing: {}" , testfile. display( ) ) ;
65
+ panic ! ( "errors encountered during EarlyProps parsing" ) ;
66
+ }
67
+
61
68
return props;
62
69
}
63
70
}
@@ -306,7 +313,9 @@ impl TestProps {
306
313
if !testfile. is_dir ( ) {
307
314
let file = File :: open ( testfile) . unwrap ( ) ;
308
315
309
- iter_header ( self . config . mode , testfile, file, & mut |revision, ln, _| {
316
+ let mut poisoned = false ;
317
+
318
+ iter_header ( config. mode , & mut poisoned, testfile, file, & mut |revision, ln, _| {
310
319
if revision. is_some ( ) && revision != cfg {
311
320
return ;
312
321
}
@@ -505,6 +514,11 @@ impl TestProps {
505
514
self . llvm_cov_flags . extend ( split_flags ( & flags) ) ;
506
515
}
507
516
} ) ;
517
+
518
+ if poisoned {
519
+ eprintln ! ( "errors encountered during TestProps parsing: {}" , testfile. display( ) ) ;
520
+ panic ! ( "errors encountered during TestProps parsing" ) ;
521
+ }
508
522
}
509
523
510
524
if self . should_ice {
@@ -630,15 +644,17 @@ pub fn line_directive<'line>(
630
644
631
645
fn iter_header < R : Read > (
632
646
mode : Mode ,
647
+ poisoned : & mut bool ,
633
648
testfile : & Path ,
634
649
rdr : R ,
635
650
it : & mut dyn FnMut ( Option < & str > , & str , usize ) ,
636
651
) {
637
- iter_header_extra ( mode, testfile, rdr, & [ ] , it)
652
+ iter_header_extra ( mode, poisoned , testfile, rdr, & [ ] , it)
638
653
}
639
654
640
655
fn iter_header_extra (
641
656
mode : Mode ,
657
+ poisoned : & mut bool ,
642
658
testfile : & Path ,
643
659
rdr : impl Read ,
644
660
extra_directives : & [ & str ] ,
@@ -677,8 +693,20 @@ fn iter_header_extra(
677
693
let ln = ln. trim ( ) ;
678
694
if ln. starts_with ( "fn" ) || ln. starts_with ( "mod" ) {
679
695
return ;
696
+
697
+ // First try to accept `ui_test` style comments
680
698
} else if let Some ( ( lncfg, ln) ) = line_directive ( comment, ln) {
681
699
it ( lncfg, ln, line_number) ;
700
+ } else if mode == Mode :: Ui && line_directive ( "//" , ln) . is_some ( ) {
701
+ // We have a comment that's *successfully* parsed as an legacy-style directive.
702
+ // We emit an error here to warn the user.
703
+ * poisoned = true ;
704
+ eprintln ! (
705
+ "error: detected legacy-style directives in ui test: {}:{}, please use `ui_test`-style directives `//@` instead" ,
706
+ testfile. display( ) ,
707
+ line_number,
708
+ ) ;
709
+ return ;
682
710
}
683
711
}
684
712
}
@@ -956,8 +984,11 @@ pub fn make_test_description<R: Read>(
956
984
_ => & [ ] ,
957
985
} ;
958
986
987
+ let mut local_poisoned = false ;
988
+
959
989
iter_header_extra (
960
990
config. mode ,
991
+ & mut local_poisoned,
961
992
path,
962
993
src,
963
994
extra_directives,
@@ -1006,6 +1037,11 @@ pub fn make_test_description<R: Read>(
1006
1037
} ,
1007
1038
) ;
1008
1039
1040
+ if local_poisoned {
1041
+ eprintln ! ( "errors encountered when trying to make test description: {}" , path. display( ) ) ;
1042
+ panic ! ( "errors encountered when trying to make test description" ) ;
1043
+ }
1044
+
1009
1045
// The `should-fail` annotation doesn't apply to pretty tests,
1010
1046
// since we run the pretty printer across all tests by default.
1011
1047
// If desired, we could add a `should-fail-pretty` annotation.
0 commit comments