@@ -171,7 +171,7 @@ pub(crate) struct TestProps {
171171 /// None for non-UI tests, and for auxiliary crates used by UI tests.
172172 pub ( crate ) pass_fail_mode : Option < PassFailMode > ,
173173 // Ignore `--pass` overrides from the command line for this test.
174- pub ( crate ) ignore_pass : bool ,
174+ pub ( crate ) no_pass_override : bool ,
175175 // rustdoc will test the output of the `--test` option
176176 pub ( crate ) check_test_line_numbers_match : bool ,
177177 // customized normalization rules
@@ -244,7 +244,6 @@ mod directives {
244244 pub ( crate ) const UNSET_RUSTC_ENV : & str = "unset-rustc-env" ;
245245 pub ( crate ) const FORBID_OUTPUT : & str = "forbid-output" ;
246246 pub ( crate ) const CHECK_TEST_LINE_NUMBERS_MATCH : & str = "check-test-line-numbers-match" ;
247- pub ( crate ) const IGNORE_PASS : & str = "ignore-pass" ;
248247 pub ( crate ) const FAILURE_STATUS : & str = "failure-status" ;
249248 pub ( crate ) const DONT_CHECK_FAILURE_STATUS : & str = "dont-check-failure-status" ;
250249 pub ( crate ) const RUN_RUSTFIX : & str = "run-rustfix" ;
@@ -298,7 +297,7 @@ impl TestProps {
298297 incremental : false ,
299298 known_bug : false ,
300299 pass_fail_mode : None ,
301- ignore_pass : false ,
300+ no_pass_override : false ,
302301 check_test_line_numbers_match : false ,
303302 normalize_stdout : vec ! [ ] ,
304303 normalize_stderr : vec ! [ ] ,
@@ -332,7 +331,7 @@ impl TestProps {
332331
333332 // copy over select properties to the aux build:
334333 props. incremental_dir = self . incremental_dir . clone ( ) ;
335- props. ignore_pass = true ;
334+ props. no_pass_override = true ;
336335 props. load_from ( testfile, revision, config) ;
337336
338337 props
@@ -618,7 +617,11 @@ impl Config {
618617 }
619618
620619 fn parse_pp_exact ( & self , line : & DirectiveLine < ' _ > ) -> Option < Utf8PathBuf > {
621- if let Some ( s) = self . parse_name_value_directive ( line, "pp-exact" ) {
620+ // Unusually, `//@ pp-exact` can be used with or without a colon, so to avoid a panic
621+ // in the parse method we need to make sure there is a colon before calling it.
622+ if line. value_after_colon ( ) . is_some ( )
623+ && let Some ( s) = self . parse_name_value_directive ( line, "pp-exact" )
624+ {
622625 Some ( Utf8PathBuf :: from ( & s) )
623626 } else if self . parse_name_directive ( line, "pp-exact" ) {
624627 line. file_path . file_name ( ) . map ( Utf8PathBuf :: from)
@@ -648,10 +651,17 @@ impl Config {
648651 }
649652
650653 fn parse_name_directive ( & self , line : & DirectiveLine < ' _ > , directive : & str ) -> bool {
651- // FIXME(Zalathar): Ideally, this should raise an error if a name-only
652- // directive is followed by a colon, since that's the wrong syntax.
653- // But we would need to fix tests that rely on the current behaviour.
654- line. name == directive
654+ if line. name != directive {
655+ return false ;
656+ }
657+
658+ if line. value_after_colon ( ) . is_some ( ) {
659+ let & DirectiveLine { file_path, line_number, .. } = line;
660+ panic ! (
661+ "{file_path}:{line_number}: directive `{directive}` must not be followed by a colon"
662+ ) ;
663+ }
664+ true
655665 }
656666
657667 fn parse_name_value_directive (
@@ -665,10 +675,9 @@ impl Config {
665675 return None ;
666676 } ;
667677
668- // FIXME(Zalathar): This silently discards directives with a matching
669- // name but no colon. Unfortunately, some directives (e.g. "pp-exact")
670- // currently rely on _not_ panicking here.
671- let value = line. value_after_colon ( ) ?;
678+ let value = line. value_after_colon ( ) . unwrap_or_else ( || {
679+ panic ! ( "{file_path}:{line_number}: directive `{directive}` must be followed by a colon and value" ) ;
680+ } ) ;
672681 debug ! ( "{}: {}" , directive, value) ;
673682 let value = expand_variables ( value. to_owned ( ) , self ) ;
674683
0 commit comments