about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2019-07-02 21:01:20 +0200
committerSantiago Pastorino <spastorino@gmail.com>2019-07-20 05:08:38 +0200
commite11adb13b6944836e703ec5e9c5f0fa0bb5b4927 (patch)
treeddc1b16172d45f82b936aa2f78a37ead9b71e2bc
parent98d232487533c5ce157d2a1101bdc401253af82c (diff)
downloadrust-e11adb13b6944836e703ec5e9c5f0fa0bb5b4927.tar.gz
rust-e11adb13b6944836e703ec5e9c5f0fa0bb5b4927.zip
Implement Place::as_place_ref
-rw-r--r--src/librustc/mir/mod.rs7
-rw-r--r--src/librustc_codegen_ssa/mir/analyze.rs7
2 files changed, 8 insertions, 6 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index b569d64e2ac..c34ac0c7879 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -1930,6 +1930,13 @@ impl<'tcx> Place<'tcx> {
 
         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<'_> {
diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs
index 053b28e003c..09c346117f9 100644
--- a/src/librustc_codegen_ssa/mir/analyze.rs
+++ b/src/librustc_codegen_ssa/mir/analyze.rs
@@ -238,12 +238,7 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
                    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,