about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJack Huey <31162821+jackh726@users.noreply.github.com>2022-02-14 17:22:49 -0500
committerJack Huey <31162821+jackh726@users.noreply.github.com>2022-02-14 17:22:49 -0500
commit36cf48bae70957f28c141cdefdb248688c87e11c (patch)
tree4146bf93f31b3ea3dee9e88c93a5eea1e1cfdc16
parent5aae6546c0839189bd03d49ef3d92833a9f1b060 (diff)
downloadrust-36cf48bae70957f28c141cdefdb248688c87e11c.tar.gz
rust-36cf48bae70957f28c141cdefdb248688c87e11c.zip
Don't allow error annotations in known-bug tests
-rw-r--r--src/tools/compiletest/src/runtest.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 03f8256d5e3..7fe7db0801b 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,