Implement Place::as_place_ref
This commit is contained in:
parent
98d2324875
commit
e11adb13b6
2 changed files with 8 additions and 6 deletions
|
@ -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<'_> {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue