Add visit_projection_elem method to visitors
This commit is contained in:
parent
f2023ac599
commit
a8d70d1b4a
1 changed files with 35 additions and 18 deletions
|
@ -166,6 +166,15 @@ macro_rules! make_mir_visitor {
|
|||
self.super_projection(base, projection, context, location);
|
||||
}
|
||||
|
||||
fn visit_projection_elem(&mut self,
|
||||
base: & $($mutability)? PlaceBase<'tcx>,
|
||||
proj_base: & $($mutability)? [PlaceElem<'tcx>],
|
||||
elem: & $($mutability)? PlaceElem<'tcx>,
|
||||
context: PlaceContext,
|
||||
location: Location) {
|
||||
self.super_projection_elem(base, proj_base, elem, context, location);
|
||||
}
|
||||
|
||||
fn visit_constant(&mut self,
|
||||
constant: & $($mutability)? Constant<'tcx>,
|
||||
location: Location) {
|
||||
|
@ -727,25 +736,33 @@ macro_rules! make_mir_visitor {
|
|||
location: Location) {
|
||||
if let [proj_base @ .., elem] = projection {
|
||||
self.visit_projection(base, proj_base, context, location);
|
||||
self.visit_projection_elem(base, proj_base, elem, context, location);
|
||||
}
|
||||
}
|
||||
|
||||
match elem {
|
||||
ProjectionElem::Field(_field, ty) => {
|
||||
self.visit_ty(ty, TyContext::Location(location));
|
||||
}
|
||||
ProjectionElem::Index(local) => {
|
||||
self.visit_local(
|
||||
local,
|
||||
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy),
|
||||
location
|
||||
);
|
||||
}
|
||||
ProjectionElem::Deref |
|
||||
ProjectionElem::Subslice { from: _, to: _ } |
|
||||
ProjectionElem::ConstantIndex { offset: _,
|
||||
min_length: _,
|
||||
from_end: _ } |
|
||||
ProjectionElem::Downcast(_, _) => {
|
||||
}
|
||||
fn super_projection_elem(&mut self,
|
||||
_base: & $($mutability)? PlaceBase<'tcx>,
|
||||
_proj_base: & $($mutability)? [PlaceElem<'tcx>],
|
||||
elem: & $($mutability)? PlaceElem<'tcx>,
|
||||
_context: PlaceContext,
|
||||
location: Location) {
|
||||
match elem {
|
||||
ProjectionElem::Field(_field, ty) => {
|
||||
self.visit_ty(ty, TyContext::Location(location));
|
||||
}
|
||||
ProjectionElem::Index(local) => {
|
||||
self.visit_local(
|
||||
local,
|
||||
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy),
|
||||
location
|
||||
);
|
||||
}
|
||||
ProjectionElem::Deref |
|
||||
ProjectionElem::Subslice { from: _, to: _ } |
|
||||
ProjectionElem::ConstantIndex { offset: _,
|
||||
min_length: _,
|
||||
from_end: _ } |
|
||||
ProjectionElem::Downcast(_, _) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue