about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/borrow_check/place_ext.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs
index 50067345c65..411fa5b5967 100644
--- a/src/librustc_mir/borrow_check/place_ext.rs
+++ b/src/librustc_mir/borrow_check/place_ext.rs
@@ -57,7 +57,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
 
             if *elem == ProjectionElem::Deref {
                 let ty = Place::ty_from(&self.base, proj_base, body, tcx).ty;
-                match ty.sty {
+                if let ty::RawPtr(..) | ty::Ref(_, _, hir::MutImmutable) = ty.sty {
                     // For both derefs of raw pointers and `&T`
                     // references, the original path is `Copy` and
                     // therefore not significant.  In particular,
@@ -68,8 +68,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
                     // original path into a new variable and
                     // borrowed *that* one, leaving the original
                     // path unborrowed.
-                    ty::RawPtr(..) | ty::Ref(_, _, hir::MutImmutable) => return true,
-                    _ => {}
+                    return true;
                 }
             }
         }