diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 13cd7db698f..1a74582389d 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -1693,10 +1693,7 @@ fn check_movable_place(&mut self, location: Location, place: Place<'tcx>) { self.move_errors.push(MoveError::new( place, location, - InteriorOfSliceOrArray { - ty: place_ty.ty, - is_index: matches!(elem, ProjectionElem::Index(..)), - }, + InteriorOfSliceOrArray { ty: place_ty.ty, is_index: false }, )); return; } @@ -1705,7 +1702,7 @@ fn check_movable_place(&mut self, location: Location, place: Place<'tcx>) { } } ProjectionElem::Index(_) => match place_ty.ty.kind() { - ty::Array(..) => { + ty::Array(..) | ty::Slice(..) => { self.move_errors.push(MoveError::new( place, location, @@ -1713,17 +1710,6 @@ fn check_movable_place(&mut self, location: Location, place: Place<'tcx>) { )); return; } - ty::Slice(_) => { - self.move_errors.push(MoveError::new( - place, - location, - InteriorOfSliceOrArray { - ty: place_ty.ty, - is_index: matches!(elem, ProjectionElem::Index(..)), - }, - )); - return; - } _ => bug!("Unexpected type {place_ty:#?}"), }, // `OpaqueCast`: only transmutes the type, so no moves there.