@@ -660,13 +660,6 @@ impl Config {
660
660
}
661
661
}
662
662
663
- fn has_cfg_prefix ( & self , line : & str , prefix : & str ) -> bool {
664
- // returns whether this line contains this prefix or not. For prefix
665
- // "ignore", returns true if line says "ignore-x86_64", "ignore-arch",
666
- // "ignore-android" etc.
667
- line. starts_with ( prefix) && line. as_bytes ( ) . get ( prefix. len ( ) ) == Some ( & b'-' )
668
- }
669
-
670
663
fn parse_name_directive ( & self , line : & str , directive : & str ) -> bool {
671
664
// Ensure the directive is a whole word. Do not match "ignore-x86" when
672
665
// the line says "ignore-x86_64".
@@ -878,7 +871,7 @@ pub fn make_test_description<R: Read>(
878
871
// The ignore reason must be a &'static str, so we have to leak memory to
879
872
// create it. This is fine, as the header is parsed only at the start of
880
873
// compiletest so it won't grow indefinitely.
881
- ignore_message = Some ( Box :: leak( Box :: <str >:: from( reason) ) ) ;
874
+ ignore_message = Some ( & * Box :: leak( Box :: <str >:: from( reason) ) ) ;
882
875
}
883
876
IgnoreDecision :: Error { message } => {
884
877
eprintln!( "error: {}: {message}" , path. display( ) ) ;
@@ -889,46 +882,8 @@ pub fn make_test_description<R: Read>(
889
882
} ;
890
883
}
891
884
892
- {
893
- let parsed = parse_cfg_name_directive ( config, ln, "ignore" ) ;
894
- ignore = match parsed. outcome {
895
- MatchOutcome :: Match => {
896
- let reason = parsed. pretty_reason . unwrap ( ) ;
897
- // The ignore reason must be a &'static str, so we have to leak memory to
898
- // create it. This is fine, as the header is parsed only at the start of
899
- // compiletest so it won't grow indefinitely.
900
- ignore_message = Some ( Box :: leak ( Box :: < str > :: from ( match parsed. comment {
901
- Some ( comment) => format ! ( "ignored {reason} ({comment})" ) ,
902
- None => format ! ( "ignored {reason}" ) ,
903
- } ) ) as & str ) ;
904
- true
905
- }
906
- MatchOutcome :: NoMatch => ignore,
907
- MatchOutcome :: External => ignore,
908
- MatchOutcome :: Invalid => panic ! ( "invalid line in {}: {ln}" , path. display( ) ) ,
909
- } ;
910
- }
911
-
912
- if config. has_cfg_prefix ( ln, "only" ) {
913
- let parsed = parse_cfg_name_directive ( config, ln, "only" ) ;
914
- ignore = match parsed. outcome {
915
- MatchOutcome :: Match => ignore,
916
- MatchOutcome :: NoMatch => {
917
- let reason = parsed. pretty_reason . unwrap ( ) ;
918
- // The ignore reason must be a &'static str, so we have to leak memory to
919
- // create it. This is fine, as the header is parsed only at the start of
920
- // compiletest so it won't grow indefinitely.
921
- ignore_message = Some ( Box :: leak ( Box :: < str > :: from ( match parsed. comment {
922
- Some ( comment) => format ! ( "only executed {reason} ({comment})" ) ,
923
- None => format ! ( "only executed {reason}" ) ,
924
- } ) ) as & str ) ;
925
- true
926
- }
927
- MatchOutcome :: External => ignore,
928
- MatchOutcome :: Invalid => panic ! ( "invalid line in {}: {ln}" , path. display( ) ) ,
929
- } ;
930
- }
931
-
885
+ decision ! ( cfg:: handle_ignore( config, ln) ) ;
886
+ decision ! ( cfg:: handle_only( config, ln) ) ;
932
887
decision ! ( needs:: handle_needs( & needs_cache, config, ln) ) ;
933
888
decision ! ( ignore_llvm( config, ln) ) ;
934
889
decision ! ( ignore_cdb( config, ln) ) ;
0 commit comments