Skip to content

Commit abb723d

Browse files
committed
Remove redundant checks.
1 parent 7ae1851 commit abb723d

File tree

1 file changed

+2
-16
lines changed
  • compiler/rustc_borrowck/src

1 file changed

+2
-16
lines changed

Diff for: compiler/rustc_borrowck/src/lib.rs

+2-16
Original file line numberDiff line numberDiff line change
@@ -1693,10 +1693,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16931693
self.move_errors.push(MoveError::new(
16941694
place,
16951695
location,
1696-
InteriorOfSliceOrArray {
1697-
ty: place_ty.ty,
1698-
is_index: matches!(elem, ProjectionElem::Index(..)),
1699-
},
1696+
InteriorOfSliceOrArray { ty: place_ty.ty, is_index: false },
17001697
));
17011698
return;
17021699
}
@@ -1705,25 +1702,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
17051702
}
17061703
}
17071704
ProjectionElem::Index(_) => match place_ty.ty.kind() {
1708-
ty::Array(..) => {
1705+
ty::Array(..) | ty::Slice(..) => {
17091706
self.move_errors.push(MoveError::new(
17101707
place,
17111708
location,
17121709
InteriorOfSliceOrArray { ty: place_ty.ty, is_index: true },
17131710
));
17141711
return;
17151712
}
1716-
ty::Slice(_) => {
1717-
self.move_errors.push(MoveError::new(
1718-
place,
1719-
location,
1720-
InteriorOfSliceOrArray {
1721-
ty: place_ty.ty,
1722-
is_index: matches!(elem, ProjectionElem::Index(..)),
1723-
},
1724-
));
1725-
return;
1726-
}
17271713
_ => bug!("Unexpected type {place_ty:#?}"),
17281714
},
17291715
// `OpaqueCast`: only transmutes the type, so no moves there.

0 commit comments

Comments
 (0)