]> git.lizzy.rs Git - rust.git/commitdiff
Implement Place::as_place_ref
authorSantiago Pastorino <spastorino@gmail.com>
Tue, 2 Jul 2019 19:01:20 +0000 (21:01 +0200)
committerSantiago Pastorino <spastorino@gmail.com>
Sat, 20 Jul 2019 03:08:38 +0000 (05:08 +0200)
src/librustc/mir/mod.rs
src/librustc_codegen_ssa/mir/analyze.rs

index b569d64e2acd62a7b7f72261b32a3ff0d7bc54d2..c34ac0c7879206239f8b258bdbe7731746bf0673 100644 (file)
@@ -1930,6 +1930,13 @@ fn iterate_over2<'tcx, R>(
 
         iterate_over2(place_base, place_projection, &Projections::Empty, op)
     }
+
+    pub fn as_place_ref(&self) -> PlaceRef<'_, 'tcx> {
+        PlaceRef {
+            base: &self.base,
+            projection: &self.projection,
+        }
+    }
 }
 
 impl From<Local> for Place<'_> {
index 053b28e003c56983a8f22f970d7e1cd28524f4fd..09c346117f9d92ee14a6da3d7aefd21b872bf1ad 100644 (file)
@@ -238,12 +238,7 @@ fn visit_place(&mut self,
                    context: PlaceContext,
                    location: Location) {
         debug!("visit_place(place={:?}, context={:?})", place, context);
-
-        let place_ref = mir::PlaceRef {
-            base: &place.base,
-            projection: &place.projection,
-        };
-        self.process_place(&place_ref, context, location);
+        self.process_place(&place.as_place_ref(), context, location);
     }
 
     fn visit_local(&mut self,