From e11adb13b6944836e703ec5e9c5f0fa0bb5b4927 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Tue, 2 Jul 2019 21:01:20 +0200 Subject: [PATCH] Implement Place::as_place_ref --- src/librustc/mir/mod.rs | 7 +++++++ src/librustc_codegen_ssa/mir/analyze.rs | 7 +------ 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 @@ 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 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 @@ 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, -- 2.44.0