Skip to content

Commit

Permalink
Remove redundant checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Oct 21, 2023
1 parent 7ae1851 commit abb723d
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1693,10 +1693,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, '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;
}
Expand All @@ -1705,25 +1702,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
}
ProjectionElem::Index(_) => match place_ty.ty.kind() {
ty::Array(..) => {
ty::Array(..) | ty::Slice(..) => {
self.move_errors.push(MoveError::new(
place,
location,
InteriorOfSliceOrArray { ty: place_ty.ty, is_index: true },
));
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.
Expand Down

0 comments on commit abb723d

Please sign in to comment.