@@ -924,7 +924,14 @@ fn iter_header(
924924
925925impl Config {
926926 fn parse_and_update_revisions ( & self , testfile : & Path , line : & str , existing : & mut Vec < String > ) {
927- const FORBIDDEN_REVISION_NAMES : [ & str ; 9 ] =
927+ const FORBIDDEN_REVISION_NAMES : [ & str ; 2 ] = [
928+ // `//@ revisions: true false` Implying `--cfg=true` and `--cfg=false` makes it very
929+ // weird for the test, since if the test writer wants a cfg of the same revision name
930+ // they'd have to use `cfg(r#true)` and `cfg(r#false)`.
931+ "true" , "false" ,
932+ ] ;
933+
934+ const FILECHECK_FORBIDDEN_REVISION_NAMES : [ & str ; 9 ] =
928935 [ "CHECK" , "COM" , "NEXT" , "SAME" , "EMPTY" , "NOT" , "COUNT" , "DAG" , "LABEL" ] ;
929936
930937 if let Some ( raw) = self . parse_name_value_directive ( line, "revisions" ) {
@@ -933,25 +940,38 @@ impl Config {
933940 }
934941
935942 let mut duplicates: HashSet < _ > = existing. iter ( ) . cloned ( ) . collect ( ) ;
936- for revision in raw. split_whitespace ( ) . map ( |r| r . to_string ( ) ) {
937- if !duplicates. insert ( revision. clone ( ) ) {
943+ for revision in raw. split_whitespace ( ) {
944+ if !duplicates. insert ( revision. to_string ( ) ) {
938945 panic ! (
939946 "duplicate revision: `{}` in line `{}`: {}" ,
940947 revision,
941948 raw,
942949 testfile. display( )
943950 ) ;
944- } else if matches ! ( self . mode, Mode :: Assembly | Mode :: Codegen | Mode :: MirOpt )
945- && FORBIDDEN_REVISION_NAMES . contains ( & revision. as_str ( ) )
951+ }
952+
953+ if FORBIDDEN_REVISION_NAMES . contains ( & revision) {
954+ panic ! (
955+ "revision name `{revision}` is not permitted: `{}` in line `{}`: {}" ,
956+ revision,
957+ raw,
958+ testfile. display( )
959+ ) ;
960+ }
961+
962+ if matches ! ( self . mode, Mode :: Assembly | Mode :: Codegen | Mode :: MirOpt )
963+ && FILECHECK_FORBIDDEN_REVISION_NAMES . contains ( & revision)
946964 {
947965 panic ! (
948- "revision name `{revision}` is not permitted in a test suite that uses `FileCheck` annotations\n \
949- as it is confusing when used as custom `FileCheck` prefix: `{revision}` in line `{}`: {}",
966+ "revision name `{revision}` is not permitted in a test suite that uses \
967+ `FileCheck` annotations as it is confusing when used as custom `FileCheck` \
968+ prefix: `{revision}` in line `{}`: {}",
950969 raw,
951970 testfile. display( )
952971 ) ;
953972 }
954- existing. push ( revision) ;
973+
974+ existing. push ( revision. to_string ( ) ) ;
955975 }
956976 }
957977 }
0 commit comments