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 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,