diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index da7a19139c65..82630c7a2f94 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -126,6 +126,12 @@ pub struct TestProps { // empty before the test starts. Incremental mode tests will reuse the // incremental directory between passes in the same test. pub incremental: bool, + // If `true`, this test is a known bug. + // + // When set, some requirements are relaxed. Currently, this only means no + // error annotations are needed, but this may be updated in the future to + // include other relaxations. + pub known_bug: bool, // How far should the test proceed while still passing. pass_mode: Option, // Ignore `--pass` overrides from the command line for this test. @@ -176,6 +182,7 @@ impl TestProps { forbid_output: vec![], incremental_dir: None, incremental: false, + known_bug: false, pass_mode: None, fail_mode: None, ignore_pass: false, @@ -362,6 +369,10 @@ impl TestProps { if !self.incremental { self.incremental = config.parse_incremental(ln); } + + if !self.known_bug { + self.known_bug = config.parse_known_bug(ln); + } }); } @@ -751,6 +762,10 @@ impl Config { fn parse_incremental(&self, line: &str) -> bool { self.parse_name_directive(line, "incremental") } + + fn parse_known_bug(&self, line: &str) -> bool { + self.parse_name_directive(line, "known-bug") + } } fn expand_variables(mut value: String, config: &Config) -> String { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index f6ddac3a65e0..03f8256d5e32 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1310,7 +1310,14 @@ impl<'test> TestCx<'test> { } None => { - if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) { + // If the test is a known bug, don't require that the error is annotated + if !self.props.known_bug + && self.is_unexpected_compiler_message( + actual_error, + expect_help, + expect_note, + ) + { self.error(&format!( "{}:{}: unexpected {}: '{}'", file_name,