@@ -541,16 +541,15 @@ impl TestProps {
541541 }
542542
543543 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+ }
553551 }
552+ ( mode, _) => panic ! ( "`{s}` header is not supported in `{mode}` tests" ) ,
554553 } ;
555554 let pass_mode = if config. parse_name_directive ( ln, "check-pass" ) {
556555 check_no_run ( "check-pass" ) ;
@@ -559,9 +558,7 @@ impl TestProps {
559558 check_no_run ( "build-pass" ) ;
560559 Some ( PassMode :: Build )
561560 } 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" ) ;
565562 Some ( PassMode :: Run )
566563 } else {
567564 None
0 commit comments