|
1 | 1 | use rustc::ty::subst::SubstsRef;
|
2 | 2 | use rustc::ty::{self, Ty, TypeFoldable};
|
3 |
| -use rustc::mir::{Location, Body, Promoted}; |
4 |
| -use rustc::mir::visit::{MutVisitor, TyContext}; |
| 3 | +use rustc::mir::{Body, Location, Place, PlaceElem, Promoted}; |
| 4 | +use rustc::mir::visit::{MutVisitor, PlaceContext, TyContext}; |
5 | 5 | use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
|
6 | 6 | use rustc_index::vec::IndexVec;
|
7 | 7 |
|
@@ -62,6 +62,25 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'tcx> {
|
62 | 62 | debug!("visit_ty: ty={:?}", ty);
|
63 | 63 | }
|
64 | 64 |
|
| 65 | + fn visit_place( |
| 66 | + &mut self, |
| 67 | + place: &mut Place<'tcx>, |
| 68 | + context: PlaceContext, |
| 69 | + location: Location, |
| 70 | + ) { |
| 71 | + self.visit_place_base(&mut place.base, context, location); |
| 72 | + |
| 73 | + let new_projection: Vec<_> = place.projection.iter().map(|elem| |
| 74 | + if let PlaceElem::Field(field, ty) = elem { |
| 75 | + PlaceElem::Field(*field, self.renumber_regions(ty)) |
| 76 | + } else { |
| 77 | + elem.clone() |
| 78 | + } |
| 79 | + ).collect(); |
| 80 | + |
| 81 | + place.projection = new_projection.into_boxed_slice(); |
| 82 | + } |
| 83 | + |
65 | 84 | fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, location: Location) {
|
66 | 85 | debug!("visit_substs(substs={:?}, location={:?})", substs, location);
|
67 | 86 |
|
|
0 commit comments