From 36cf48bae70957f28c141cdefdb248688c87e11c Mon Sep 17 00:00:00 2001 From: Jack Huey <31162821+jackh726@users.noreply.github.com> Date: Mon, 14 Feb 2022 17:22:49 -0500 Subject: [PATCH] Don't allow error annotations in known-bug tests --- src/tools/compiletest/src/runtest.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 03f8256d5e324..7fe7db0801b47 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1274,6 +1274,16 @@ impl<'test> TestCx<'test> { self.fatal_proc_rec("process did not return an error status", proc_res); } + if self.props.known_bug { + if !expected_errors.is_empty() { + self.fatal_proc_rec( + "`known_bug` tests should not have an expected errors", + proc_res, + ); + } + return; + } + // On Windows, keep all '\' path separators to match the paths reported in the JSON output // from the compiler let os_file_name = self.testpaths.file.display().to_string(); @@ -1311,13 +1321,7 @@ impl<'test> TestCx<'test> { None => { // 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, - ) - { + if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) { self.error(&format!( "{}:{}: unexpected {}: '{}'", file_name,