Skip to content

Commit 63df126

Browse files
committed
match array for constantindex and subslice
1 parent 442c87a commit 63df126

File tree

1 file changed

+9
-8
lines changed
  • compiler/rustc_mir_dataflow/src/move_paths

1 file changed

+9
-8
lines changed

compiler/rustc_mir_dataflow/src/move_paths/builder.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
158158
}
159159
},
160160
ProjectionElem::Field(_, _) => match place_ty.kind() {
161-
ty::Adt(adt, _) if adt.has_dtor(tcx) => {
162-
return Err(MoveError::cannot_move_out_of(
163-
self.loc,
164-
InteriorOfTypeWithDestructor { container_ty: place_ty },
165-
));
166-
}
167161
ty::Adt(adt, _) => {
162+
if adt.has_dtor(tcx) {
163+
return Err(MoveError::cannot_move_out_of(
164+
self.loc,
165+
InteriorOfTypeWithDestructor { container_ty: place_ty },
166+
));
167+
}
168168
if adt.is_union() {
169169
union_path.get_or_insert(base);
170170
}
@@ -207,7 +207,8 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
207207
},
208208
));
209209
}
210-
_ => (),
210+
ty::Array(_, _) => (),
211+
_ => bug!("Unexpected type {:#?}", place_ty.is_array()),
211212
}
212213
}
213214
ProjectionElem::Index(_) => match place_ty.kind() {
@@ -226,7 +227,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
226227
},
227228
));
228229
}
229-
_ => (),
230+
_ => bug!("Unexpected type {place_ty:#?}"),
230231
},
231232
// `OpaqueCast` only transmutes the type, so no moves there and
232233
// `Downcast` only changes information about a `Place` without moving

0 commit comments

Comments
 (0)