Skip to content

Commit 7c6ff4b

Browse files
committed
Add the known-bug compiletest prop
1 parent 5d8767c commit 7c6ff4b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/tools/compiletest/src/header.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ pub struct TestProps {
126126
// empty before the test starts. Incremental mode tests will reuse the
127127
// incremental directory between passes in the same test.
128128
pub incremental: bool,
129+
// If `true`, this test is a known bug.
130+
//
131+
// When set, some requirements are relaxed. Currently, this only means no
132+
// error annotations are needed, but this may be updated in the future to
133+
// include other relaxations.
134+
pub known_bug: bool,
129135
// How far should the test proceed while still passing.
130136
pass_mode: Option<PassMode>,
131137
// Ignore `--pass` overrides from the command line for this test.
@@ -176,6 +182,7 @@ impl TestProps {
176182
forbid_output: vec![],
177183
incremental_dir: None,
178184
incremental: false,
185+
known_bug: false,
179186
pass_mode: None,
180187
fail_mode: None,
181188
ignore_pass: false,
@@ -362,6 +369,10 @@ impl TestProps {
362369
if !self.incremental {
363370
self.incremental = config.parse_incremental(ln);
364371
}
372+
373+
if !self.known_bug {
374+
self.known_bug = config.parse_known_bug(ln);
375+
}
365376
});
366377
}
367378

@@ -751,6 +762,10 @@ impl Config {
751762
fn parse_incremental(&self, line: &str) -> bool {
752763
self.parse_name_directive(line, "incremental")
753764
}
765+
766+
fn parse_known_bug(&self, line: &str) -> bool {
767+
self.parse_name_directive(line, "known-bug")
768+
}
754769
}
755770

756771
fn expand_variables(mut value: String, config: &Config) -> String {

src/tools/compiletest/src/runtest.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,14 @@ impl<'test> TestCx<'test> {
13101310
}
13111311

13121312
None => {
1313-
if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) {
1313+
// If the test is a known bug, don't require that the error is annotated
1314+
if !self.props.known_bug
1315+
&& self.is_unexpected_compiler_message(
1316+
actual_error,
1317+
expect_help,
1318+
expect_note,
1319+
)
1320+
{
13141321
self.error(&format!(
13151322
"{}:{}: unexpected {}: '{}'",
13161323
file_name,

0 commit comments

Comments
 (0)