about summary refs log tree commit diff
path: root/src/librustc_mir/transform
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-03-07 17:27:34 +0100
committerGitHub <noreply@github.com>2020-03-07 17:27:34 +0100
commitf1f4864de3ecfa106d03f2172f2c80edf8eeb02c (patch)
tree49faa3c7b1b796e528b03fb1af1258ae9d59cd81 /src/librustc_mir/transform
parent10f999b72d24fa181a3ec54fd21807b6a664e615 (diff)
parent0ed6e795fb3e8e70765576b929e3eb030c4f10d3 (diff)
downloadrust-f1f4864de3ecfa106d03f2172f2c80edf8eeb02c.tar.gz
rust-f1f4864de3ecfa106d03f2172f2c80edf8eeb02c.zip
Rollup merge of #69787 - spastorino:use-local-directly-its-copy, r=oli-obk
mir::Local is Copy we can pass it by value in these cases

r? @oli-obk
Diffstat (limited to 'src/librustc_mir/transform')
-rw-r--r--src/librustc_mir/transform/check_consts/validation.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs
index 1553f826c7e..133772407c5 100644
--- a/src/librustc_mir/transform/check_consts/validation.rs
+++ b/src/librustc_mir/transform/check_consts/validation.rs
@@ -276,7 +276,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
                         }
                     };
                     self.visit_place_base(&place.local, ctx, location);
-                    self.visit_projection(&place.local, reborrowed_proj, ctx, location);
+                    self.visit_projection(place.local, reborrowed_proj, ctx, location);
                     return;
                 }
             }
@@ -289,7 +289,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
                         Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
                     };
                     self.visit_place_base(&place.local, ctx, location);
-                    self.visit_projection(&place.local, reborrowed_proj, ctx, location);
+                    self.visit_projection(place.local, reborrowed_proj, ctx, location);
                     return;
                 }
             }
@@ -408,7 +408,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
     }
     fn visit_projection_elem(
         &mut self,
-        place_local: &Local,
+        place_local: Local,
         proj_base: &[PlaceElem<'tcx>],
         elem: &PlaceElem<'tcx>,
         context: PlaceContext,
@@ -428,11 +428,11 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
 
         match elem {
             ProjectionElem::Deref => {
-                let base_ty = Place::ty_from(*place_local, proj_base, *self.body, self.tcx).ty;
+                let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
                 if let ty::RawPtr(_) = base_ty.kind {
                     if proj_base.is_empty() {
                         if let (local, []) = (place_local, proj_base) {
-                            let decl = &self.body.local_decls[*local];
+                            let decl = &self.body.local_decls[local];
                             if let LocalInfo::StaticRef { def_id, .. } = decl.local_info {
                                 let span = decl.source_info.span;
                                 self.check_static(def_id, span);
@@ -452,7 +452,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
             | ProjectionElem::Subslice { .. }
             | ProjectionElem::Field(..)
             | ProjectionElem::Index(_) => {
-                let base_ty = Place::ty_from(*place_local, proj_base, *self.body, self.tcx).ty;
+                let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
                 match base_ty.ty_adt_def() {
                     Some(def) if def.is_union() => {
                         self.check_op(ops::UnionAccess);