Skip to content

Commit

Permalink
match array for constantindex and subslice
Browse files Browse the repository at this point in the history
  • Loading branch information
ouz-a committed Sep 22, 2023
1 parent 442c87a commit 63df126
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions compiler/rustc_mir_dataflow/src/move_paths/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
}
},
ProjectionElem::Field(_, _) => match place_ty.kind() {
ty::Adt(adt, _) if adt.has_dtor(tcx) => {
return Err(MoveError::cannot_move_out_of(
self.loc,
InteriorOfTypeWithDestructor { container_ty: place_ty },
));
}
ty::Adt(adt, _) => {
if adt.has_dtor(tcx) {
return Err(MoveError::cannot_move_out_of(
self.loc,
InteriorOfTypeWithDestructor { container_ty: place_ty },
));
}
if adt.is_union() {
union_path.get_or_insert(base);
}
Expand Down Expand Up @@ -207,7 +207,8 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
},
));
}
_ => (),
ty::Array(_, _) => (),
_ => bug!("Unexpected type {:#?}", place_ty.is_array()),
}
}
ProjectionElem::Index(_) => match place_ty.kind() {
Expand All @@ -226,7 +227,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
},
));
}
_ => (),
_ => bug!("Unexpected type {place_ty:#?}"),
},
// `OpaqueCast` only transmutes the type, so no moves there and
// `Downcast` only changes information about a `Place` without moving
Expand Down

0 comments on commit 63df126

Please sign in to comment.