about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-12-25 08:46:20 +0000
committerbors <bors@rust-lang.org>2024-12-25 08:46:20 +0000
commita0a5c423463e4f6f82ced50b15fe5afab296b560 (patch)
tree3e6ac416103319c73912a409d4691a442af95bd2
parent68b9e4f5f5566424b8edc2c75feefe3a4ee2fa72 (diff)
parent5a8ecc951846594407c561ae2015fe2fde1a0694 (diff)
downloadrust-a0a5c423463e4f6f82ced50b15fe5afab296b560.tar.gz
rust-a0a5c423463e4f6f82ced50b15fe5afab296b560.zip
Auto merge of #134738 - clubby789:forbid-output-ui, r=jieyouxu
compiletest: Support `forbid-output` in UI tests

The `forbid-output` directive is currently only run in incremental tests (although no incremental tests use it). There are some UI tests 'using' it, but it's doing nothing 😄 Let's fix this

Will also PR the dev guide to note this.

dev-guide PR: https://github.com/rust-lang/rustc-dev-guide/pull/2171
-rw-r--r--src/tools/compiletest/src/runtest/ui.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/runtest/ui.rs b/src/tools/compiletest/src/runtest/ui.rs
index 172b1e32aad..10528de427d 100644
--- a/src/tools/compiletest/src/runtest/ui.rs
+++ b/src/tools/compiletest/src/runtest/ui.rs
@@ -145,12 +145,13 @@ impl TestCx<'_> {
                 self.fatal_proc_rec("test run succeeded!", &proc_res);
             }
 
+            let output_to_check = self.get_output(&proc_res);
             if !self.props.error_patterns.is_empty() || !self.props.regex_error_patterns.is_empty()
             {
                 // "// error-pattern" comments
-                let output_to_check = self.get_output(&proc_res);
                 self.check_all_error_patterns(&output_to_check, &proc_res, pm);
             }
+            self.check_forbid_output(&output_to_check, &proc_res)
         }
 
         debug!(
@@ -181,11 +182,12 @@ impl TestCx<'_> {
             );
             self.fatal(&msg);
         }
+        let output_to_check = self.get_output(&proc_res);
         if check_patterns {
             // "// error-pattern" comments
-            let output_to_check = self.get_output(&proc_res);
             self.check_all_error_patterns(&output_to_check, &proc_res, pm);
         }
+        self.check_forbid_output(&output_to_check, &proc_res);
 
         if self.props.run_rustfix && self.config.compare_mode.is_none() {
             // And finally, compile the fixed code and make sure it both