make visit_projection
take a PlaceRef
This commit is contained in:
parent
30c5125fbe
commit
5ec4b060a7
4 changed files with 7 additions and 18 deletions
|
@ -199,7 +199,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.visit_local(&place_ref.local, context, location);
|
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(
|
fn visit_projection(
|
||||||
&mut self,
|
&mut self,
|
||||||
local: Local,
|
place_ref: PlaceRef<'tcx>,
|
||||||
projection: &[PlaceElem<'tcx>],
|
|
||||||
context: PlaceContext,
|
context: PlaceContext,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
self.super_projection(local, projection, context, location);
|
self.super_projection(place_ref.local, place_ref.projection, context, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_projection_elem(
|
fn visit_projection_elem(
|
||||||
|
@ -1033,7 +1032,7 @@ macro_rules! visit_place_fns {
|
||||||
|
|
||||||
self.visit_local(&place.local, context, location);
|
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(
|
fn super_projection(
|
||||||
|
|
|
@ -95,7 +95,7 @@ where
|
||||||
|
|
||||||
// We purposefully do not call `super_place` here to avoid calling `visit_local` for this
|
// We purposefully do not call `super_place` here to avoid calling `visit_local` for this
|
||||||
// place with one of the `Projection` variants of `PlaceContext`.
|
// 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) {
|
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.
|
// 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_local(&reborrowed_place_ref.local, ctx, location);
|
||||||
self.visit_projection(
|
self.visit_projection(reborrowed_place_ref, ctx, location);
|
||||||
reborrowed_place_ref.local,
|
|
||||||
reborrowed_place_ref.projection,
|
|
||||||
ctx,
|
|
||||||
location,
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -526,12 +521,7 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
|
||||||
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
|
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
|
||||||
};
|
};
|
||||||
self.visit_local(&reborrowed_place_ref.local, ctx, location);
|
self.visit_local(&reborrowed_place_ref.local, ctx, location);
|
||||||
self.visit_projection(
|
self.visit_projection(reborrowed_place_ref, ctx, location);
|
||||||
reborrowed_place_ref.local,
|
|
||||||
reborrowed_place_ref.projection,
|
|
||||||
ctx,
|
|
||||||
location,
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue