1
Fork 0

Rollup merge of #121116 - nnethercote:fix-121103-121108, r=oli-obk

Reinstate some delayed bugs.

These were changed to `has_errors` assertions in #121071 because that seemed reasonable, but evidently not.

Fixes #121103.
Fixes #121108.
This commit is contained in:
Matthias Krüger 2024-02-15 09:20:21 +01:00 committed by GitHub
commit 4899108109
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 57 additions and 2 deletions

View file

@ -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 { .. } => {

View file

@ -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();
}