@@ -541,16 +541,15 @@ impl TestProps {
541
541
}
542
542
543
543
fn update_pass_mode ( & mut self , ln : & str , revision : Option < & str > , config : & Config ) {
544
- let check_no_run = |s| {
545
- if config. mode != Mode :: Ui && config. mode != Mode :: Incremental {
546
- panic ! ( "`{}` header is only supported in UI and incremental tests" , s) ;
547
- }
548
- if config. mode == Mode :: Incremental
549
- && !revision. map_or ( false , |r| r. starts_with ( "cfail" ) )
550
- && !self . revisions . iter ( ) . all ( |r| r. starts_with ( "cfail" ) )
551
- {
552
- panic ! ( "`{}` header is only supported in `cfail` incremental tests" , s) ;
544
+ let check_no_run = |s| match ( config. mode , s) {
545
+ ( Mode :: Ui , _) => ( ) ,
546
+ ( Mode :: Codegen , "build-pass" ) => ( ) ,
547
+ ( Mode :: Incremental , _) => {
548
+ if revision. is_some ( ) && !self . revisions . iter ( ) . all ( |r| r. starts_with ( "cfail" ) ) {
549
+ panic ! ( "`{s}` header is only supported in `cfail` incremental tests" )
550
+ }
553
551
}
552
+ ( mode, _) => panic ! ( "`{s}` header is not supported in `{mode}` tests" ) ,
554
553
} ;
555
554
let pass_mode = if config. parse_name_directive ( ln, "check-pass" ) {
556
555
check_no_run ( "check-pass" ) ;
@@ -559,9 +558,7 @@ impl TestProps {
559
558
check_no_run ( "build-pass" ) ;
560
559
Some ( PassMode :: Build )
561
560
} else if config. parse_name_directive ( ln, "run-pass" ) {
562
- if config. mode != Mode :: Ui {
563
- panic ! ( "`run-pass` header is only supported in UI tests" )
564
- }
561
+ check_no_run ( "run-pass" ) ;
565
562
Some ( PassMode :: Run )
566
563
} else {
567
564
None
0 commit comments