make visit_projection
take a PlaceRef
This commit is contained in:
parent
30c5125fbe
commit
5ec4b060a7
@ -199,7 +199,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
|
||||
}
|
||||
|
||||
self.visit_local(&place_ref.local, context, location);
|
||||
self.visit_projection(place_ref.local, place_ref.projection, context, location);
|
||||
self.visit_projection(*place_ref, context, location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -998,12 +998,11 @@ macro_rules! visit_place_fns {
|
||||
() => {
|
||||
fn visit_projection(
|
||||
&mut self,
|
||||
local: Local,
|
||||
projection: &[PlaceElem<'tcx>],
|
||||
place_ref: PlaceRef<'tcx>,
|
||||
context: PlaceContext,
|
||||
location: Location,
|
||||
) {
|
||||
self.super_projection(local, projection, context, location);
|
||||
self.super_projection(place_ref.local, place_ref.projection, context, location);
|
||||
}
|
||||
|
||||
fn visit_projection_elem(
|
||||
@ -1033,7 +1032,7 @@ macro_rules! visit_place_fns {
|
||||
|
||||
self.visit_local(&place.local, context, location);
|
||||
|
||||
self.visit_projection(place.local, &place.projection, context, location);
|
||||
self.visit_projection(place.as_ref(), context, location);
|
||||
}
|
||||
|
||||
fn super_projection(
|
||||
|
@ -95,7 +95,7 @@ where
|
||||
|
||||
// We purposefully do not call `super_place` here to avoid calling `visit_local` for this
|
||||
// place with one of the `Projection` variants of `PlaceContext`.
|
||||
self.visit_projection(local, projection, context, location);
|
||||
self.visit_projection(place.as_ref(), context, location);
|
||||
|
||||
match DefUse::for_place(context) {
|
||||
// Treat derefs as a use of the base local. `*p = 4` is not a def of `p` but a use.
|
||||
|
@ -508,12 +508,7 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
|
||||
}
|
||||
};
|
||||
self.visit_local(&reborrowed_place_ref.local, ctx, location);
|
||||
self.visit_projection(
|
||||
reborrowed_place_ref.local,
|
||||
reborrowed_place_ref.projection,
|
||||
ctx,
|
||||
location,
|
||||
);
|
||||
self.visit_projection(reborrowed_place_ref, ctx, location);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -526,12 +521,7 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
|
||||
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
|
||||
};
|
||||
self.visit_local(&reborrowed_place_ref.local, ctx, location);
|
||||
self.visit_projection(
|
||||
reborrowed_place_ref.local,
|
||||
reborrowed_place_ref.projection,
|
||||
ctx,
|
||||
location,
|
||||
);
|
||||
self.visit_projection(reborrowed_place_ref, ctx, location);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user