about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-09 10:08:01 +0000
committerbors <bors@rust-lang.org>2024-04-09 10:08:01 +0000
commit2805aedf9f847039325ebf9d7d36d4f24476b13b (patch)
treea3ad88bb2de89a37c90a249397fb830c9134e393 /compiler/rustc_driver_impl/src
parentbb78dba64ca4158ef2f3488d0d41a82c75a504f2 (diff)
parent3b16ee25684a88247b32ef32e38c119aeb043dc4 (diff)
downloadrust-2805aedf9f847039325ebf9d7d36d4f24476b13b.tar.gz
rust-2805aedf9f847039325ebf9d7d36d4f24476b13b.zip
Auto merge of #123631 - oli-obk:fail_slow, r=jieyouxu
Ensure we do not accidentally insert new early aborts in the analysis passes

pulling the infallible part out into a separate function makes sure that someone needs to change the signature in order to regress this.

We only want to stop compilation in the presence of errors after all analyses are done, but before we start running lints.

per-item we can still stop doing work if previous queries returned errors, but that's a separate story.
Diffstat (limited to 'compiler/rustc_driver_impl/src')
-rw-r--r--compiler/rustc_driver_impl/src/pretty.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_driver_impl/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs
index c9bbe45b212..c0c6201f73d 100644
--- a/compiler/rustc_driver_impl/src/pretty.rs
+++ b/compiler/rustc_driver_impl/src/pretty.rs
@@ -336,7 +336,8 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
         ThirTree => {
             let tcx = ex.tcx();
             let mut out = String::new();
-            if rustc_hir_analysis::check_crate(tcx).is_err() {
+            rustc_hir_analysis::check_crate(tcx);
+            if tcx.dcx().has_errors().is_some() {
                 FatalError.raise();
             }
             debug!("pretty printing THIR tree");
@@ -348,7 +349,8 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
         ThirFlat => {
             let tcx = ex.tcx();
             let mut out = String::new();
-            if rustc_hir_analysis::check_crate(tcx).is_err() {
+            rustc_hir_analysis::check_crate(tcx);
+            if tcx.dcx().has_errors().is_some() {
                 FatalError.raise();
             }
             debug!("pretty printing THIR flat");