about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src/move_paths/builder.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-02-13 06:27:38 +0100
committerGitHub <noreply@github.com>2024-02-13 06:27:38 +0100
commit30057f0266b323cc4d4ea248dc0d059b3260258f (patch)
treee517026352363127aae89fa0ad86640828f7fa1f /compiler/rustc_mir_dataflow/src/move_paths/builder.rs
parent1b396913a99759c6b92da2acac7e8a0ed349d773 (diff)
parent2d73597b93d27b94e1b534d84352f51629418380 (diff)
downloadrust-30057f0266b323cc4d4ea248dc0d059b3260258f.tar.gz
rust-30057f0266b323cc4d4ea248dc0d059b3260258f.zip
Rollup merge of #120802 - oli-obk:drop_elab_ice, r=compiler-errors
Bail out of drop elaboration when encountering error types

fixes  #120788
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/move_paths/builder.rs')
-rw-r--r--compiler/rustc_mir_dataflow/src/move_paths/builder.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs
index 80e0d0baf57..c6ec1b5aee4 100644
--- a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs
+++ b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs
@@ -1,7 +1,7 @@
 use rustc_index::IndexVec;
 use rustc_middle::mir::tcx::{PlaceTy, RvalueInitializationState};
 use rustc_middle::mir::*;
-use rustc_middle::ty::{self, Ty, TyCtxt};
+use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
 use smallvec::{smallvec, SmallVec};
 
 use std::mem;
@@ -132,6 +132,9 @@ impl<'b, 'a, 'tcx, F: Fn(Ty<'tcx>) -> bool> Gatherer<'b, 'a, 'tcx, F> {
             let body = self.builder.body;
             let tcx = self.builder.tcx;
             let place_ty = place_ref.ty(body, tcx).ty;
+            if place_ty.references_error() {
+                return MovePathResult::Error;
+            }
             match elem {
                 ProjectionElem::Deref => match place_ty.kind() {
                     ty::Ref(..) | ty::RawPtr(..) => {