diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-09 14:41:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-09 14:41:51 +0100 |
| commit | 116efb5bb10ba6264e4b6e2ee65427103f6c365a (patch) | |
| tree | 544de019c4634161f946075f8d95bb2b587f1bdc /compiler/rustc_mir_transform/src | |
| parent | 475c47a3c14d6c09486509029e288daced2bed86 (diff) | |
| parent | e32c1ddc5274636c03697f180224f4fa6721f200 (diff) | |
| download | rust-116efb5bb10ba6264e4b6e2ee65427103f6c365a.tar.gz rust-116efb5bb10ba6264e4b6e2ee65427103f6c365a.zip | |
Rollup merge of #120817 - compiler-errors:more-mir-errors, r=oli-obk
Fix more `ty::Error` ICEs in MIR passes Fixes #120791 - Add a check for `ty::Error` in the `ByMove` coroutine pass Fixes #120816 - Add a check for `ty::Error` in the MIR validator Also a drive-by fix for a FIXME I had asked oli to add r? oli-obk
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/coroutine/by_move_body.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs b/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs index fcd4715b9e8..e40f4520671 100644 --- a/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs +++ b/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs @@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxIndexSet; use rustc_hir as hir; use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::{self, dump_mir, MirPass}; -use rustc_middle::ty::{self, InstanceDef, Ty, TyCtxt}; +use rustc_middle::ty::{self, InstanceDef, Ty, TyCtxt, TypeVisitableExt}; use rustc_target::abi::FieldIdx; pub struct ByMoveBody; @@ -23,7 +23,10 @@ impl<'tcx> MirPass<'tcx> for ByMoveBody { return; }; let coroutine_ty = body.local_decls[ty::CAPTURE_STRUCT_LOCAL].ty; - let ty::Coroutine(_, args) = *coroutine_ty.kind() else { bug!() }; + if coroutine_ty.references_error() { + return; + } + let ty::Coroutine(_, args) = *coroutine_ty.kind() else { bug!("{body:#?}") }; let coroutine_kind = args.as_coroutine().kind_ty().to_opt_closure_kind().unwrap(); if coroutine_kind == ty::ClosureKind::FnOnce { |
