@@ -924,7 +924,14 @@ fn iter_header(
924
924
925
925
impl Config {
926
926
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 ] =
928
935
[ "CHECK" , "COM" , "NEXT" , "SAME" , "EMPTY" , "NOT" , "COUNT" , "DAG" , "LABEL" ] ;
929
936
930
937
if let Some ( raw) = self . parse_name_value_directive ( line, "revisions" ) {
@@ -933,25 +940,38 @@ impl Config {
933
940
}
934
941
935
942
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 ( ) ) {
938
945
panic ! (
939
946
"duplicate revision: `{}` in line `{}`: {}" ,
940
947
revision,
941
948
raw,
942
949
testfile. display( )
943
950
) ;
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)
946
964
{
947
965
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 `{}`: {}",
950
969
raw,
951
970
testfile. display( )
952
971
) ;
953
972
}
954
- existing. push ( revision) ;
973
+
974
+ existing. push ( revision. to_string ( ) ) ;
955
975
}
956
976
}
957
977
}
0 commit comments