Revert "Make LocalAnalizer visitor iterate instead of recurse"
This reverts commit 0cfaa28bc5
.
This commit is contained in:
parent
c8865d8e19
commit
4c326174d2
1 changed files with 36 additions and 47 deletions
|
@ -154,11 +154,9 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
|
|||
context: PlaceContext,
|
||||
location: Location) {
|
||||
debug!("visit_place(place={:?}, context={:?})", place, context);
|
||||
let mut context = context;
|
||||
let cx = self.fx.cx;
|
||||
|
||||
place.iterate(|place_base, place_projections| {
|
||||
for proj in place_projections {
|
||||
if let mir::Place::Projection(ref proj) = *place {
|
||||
// Allow uses of projections that are ZSTs or from scalar fields.
|
||||
let is_consume = match context {
|
||||
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) |
|
||||
|
@ -184,7 +182,8 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
|
|||
// Recurse with the same context, instead of `Projection`,
|
||||
// potentially stopping at non-operand projections,
|
||||
// which would trigger `not_ssa` on locals.
|
||||
continue;
|
||||
self.visit_place(&proj.base, context, location);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -197,19 +196,9 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
|
|||
location
|
||||
);
|
||||
}
|
||||
|
||||
context = if context.is_mutating_use() {
|
||||
PlaceContext::MutatingUse(MutatingUseContext::Projection)
|
||||
} else {
|
||||
PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection)
|
||||
};
|
||||
}
|
||||
|
||||
// Default base visit behavior
|
||||
if let mir::PlaceBase::Local(local) = place_base {
|
||||
self.visit_local(local, context, location);
|
||||
}
|
||||
});
|
||||
self.super_place(place, context, location);
|
||||
}
|
||||
|
||||
fn visit_local(&mut self,
|
||||
|
|
Loading…
Reference in a new issue