Prepare simplify MutVisitor to have projections interned
This commit is contained in:
parent
e069e9ccac
commit
591cc9aede
1 changed files with 20 additions and 0 deletions
|
|
@ -366,7 +366,27 @@ impl<'tcx> MutVisitor<'tcx> for LocalUpdater {
|
|||
});
|
||||
self.super_basic_block_data(block, data);
|
||||
}
|
||||
|
||||
fn visit_local(&mut self, l: &mut Local, _: PlaceContext, _: Location) {
|
||||
*l = self.map[*l].unwrap();
|
||||
}
|
||||
|
||||
fn visit_place(
|
||||
&mut self,
|
||||
place: &mut Place<'tcx>,
|
||||
context: PlaceContext,
|
||||
location: Location,
|
||||
) {
|
||||
self.visit_place_base(&mut place.base, context, location);
|
||||
|
||||
let new_projection: Vec<_> = place.projection.iter().map(|elem|
|
||||
if let PlaceElem::Index(local) = elem {
|
||||
PlaceElem::Index(self.map[*local].unwrap())
|
||||
} else {
|
||||
elem.clone()
|
||||
}
|
||||
).collect();
|
||||
|
||||
place.projection = new_projection.into_boxed_slice();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue