about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-10-21 12:10:30 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-10-21 12:10:30 +0000
commitabb723dea21669ca9b0a1d4335ec20c2c30846af (patch)
treedb723f1cb42b8e53f242d102dab8d73a5d51f03a
parent7ae1851803b6adb9c213f6051e705d2f7172ec92 (diff)
downloadrust-abb723dea21669ca9b0a1d4335ec20c2c30846af.tar.gz
rust-abb723dea21669ca9b0a1d4335ec20c2c30846af.zip
Remove redundant checks.
-rw-r--r--compiler/rustc_borrowck/src/lib.rs18
1 files changed, 2 insertions, 16 deletions
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 @@ 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;
                         }
@@ -1705,7 +1702,7 @@ 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,
@@ -1713,17 +1710,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, '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.