about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-15 08:31:46 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-15 09:26:45 +1100
commit64a9c9cfea7f454bcc48852f0e1b99074d615ddc (patch)
tree8c2f44ceb0685b581f773b74091c71b3799fc75f /compiler
parent502ce8287bc3c86dca07acc38c5ff9431a6097be (diff)
downloadrust-64a9c9cfea7f454bcc48852f0e1b99074d615ddc.tar.gz
rust-64a9c9cfea7f454bcc48852f0e1b99074d615ddc.zip
Reinstate some delayed bugs.
These were changed to `has_errors` assertions in #121071 because that
seemed reasonable, but evidently not.

Fixes #121103.
Fixes #121108.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs4
-rw-r--r--compiler/rustc_mir_transform/src/lib.rs3
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index 73d1d891bb9..942aae3d536 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -323,7 +323,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
                     )
                 }
                 ExprKind::Yield(opt_expr) => self.lower_expr_yield(e.span, opt_expr.as_deref()),
-                ExprKind::Err => hir::ExprKind::Err(self.dcx().has_errors().unwrap()),
+                ExprKind::Err => {
+                    hir::ExprKind::Err(self.dcx().span_delayed_bug(e.span, "lowered ExprKind::Err"))
+                }
                 ExprKind::Try(sub_expr) => self.lower_expr_try(e.span, sub_expr),
 
                 ExprKind::Paren(_) | ExprKind::ForLoop { .. } => {
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index c11fd5fcc90..b4fa7f3bea6 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -265,7 +265,8 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs {
     let body = &tcx.mir_const(def).borrow();
 
     if body.return_ty().references_error() {
-        assert!(tcx.dcx().has_errors().is_some(), "mir_const_qualif: MIR had errors");
+        // It's possible to reach here without an error being emitted (#121103).
+        tcx.dcx().span_delayed_bug(body.span, "mir_const_qualif: MIR had errors");
         return Default::default();
     }