Skip to content

Commit e11adb1

Browse files
committed
Implement Place::as_place_ref
1 parent 98d2324 commit e11adb1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/librustc/mir/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,13 @@ impl<'tcx> Place<'tcx> {
19301930

19311931
iterate_over2(place_base, place_projection, &Projections::Empty, op)
19321932
}
1933+
1934+
pub fn as_place_ref(&self) -> PlaceRef<'_, 'tcx> {
1935+
PlaceRef {
1936+
base: &self.base,
1937+
projection: &self.projection,
1938+
}
1939+
}
19331940
}
19341941

19351942
impl From<Local> for Place<'_> {

src/librustc_codegen_ssa/mir/analyze.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,7 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
238238
context: PlaceContext,
239239
location: Location) {
240240
debug!("visit_place(place={:?}, context={:?})", place, context);
241-
242-
let place_ref = mir::PlaceRef {
243-
base: &place.base,
244-
projection: &place.projection,
245-
};
246-
self.process_place(&place_ref, context, location);
241+
self.process_place(&place.as_place_ref(), context, location);
247242
}
248243

249244
fn visit_local(&mut self,

0 commit comments

Comments
 (0)