Prepare renumber MutVisitor to have projections interned
This commit is contained in:
parent
591cc9aede
commit
bb7d6d1c70
1 changed files with 21 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
use rustc::ty::subst::SubstsRef;
|
use rustc::ty::subst::SubstsRef;
|
||||||
use rustc::ty::{self, Ty, TypeFoldable};
|
use rustc::ty::{self, Ty, TypeFoldable};
|
||||||
use rustc::mir::{Location, Body, Promoted};
|
use rustc::mir::{Body, Location, Place, PlaceElem, Promoted};
|
||||||
use rustc::mir::visit::{MutVisitor, TyContext};
|
use rustc::mir::visit::{MutVisitor, PlaceContext, TyContext};
|
||||||
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
|
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
|
|
||||||
|
@ -62,6 +62,25 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'tcx> {
|
||||||
debug!("visit_ty: ty={:?}", ty);
|
debug!("visit_ty: ty={:?}", ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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::Field(field, ty) = elem {
|
||||||
|
PlaceElem::Field(*field, self.renumber_regions(ty))
|
||||||
|
} else {
|
||||||
|
elem.clone()
|
||||||
|
}
|
||||||
|
).collect();
|
||||||
|
|
||||||
|
place.projection = new_projection.into_boxed_slice();
|
||||||
|
}
|
||||||
|
|
||||||
fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, location: Location) {
|
fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, location: Location) {
|
||||||
debug!("visit_substs(substs={:?}, location={:?})", substs, location);
|
debug!("visit_substs(substs={:?}, location={:?})", substs, location);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue