match array for constantindex and subslice

This commit is contained in:
ouz-a 2023-09-22 16:28:45 +03:00
parent 442c87a0b0
commit 63df126f59

View File

@ -158,13 +158,13 @@ fn move_path_for(&mut self, place: Place<'tcx>) -> Result<MovePathIndex, MoveErr
}
},
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);
}
@ -207,7 +207,8 @@ fn move_path_for(&mut self, place: Place<'tcx>) -> Result<MovePathIndex, MoveErr
},
));
}
_ => (),
ty::Array(_, _) => (),
_ => bug!("Unexpected type {:#?}", place_ty.is_array()),
}
}
ProjectionElem::Index(_) => match place_ty.kind() {
@ -226,7 +227,7 @@ fn move_path_for(&mut self, place: Place<'tcx>) -> Result<MovePathIndex, MoveErr
},
));
}
_ => (),
_ => bug!("Unexpected type {place_ty:#?}"),
},
// `OpaqueCast` only transmutes the type, so no moves there and
// `Downcast` only changes information about a `Place` without moving