Skip to content

Commit a8d70d1

Browse files
committed
Add visit_projection_elem method to visitors
1 parent f2023ac commit a8d70d1

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

src/librustc/mir/visit.rs

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ macro_rules! make_mir_visitor {
166166
self.super_projection(base, projection, context, location);
167167
}
168168

169+
fn visit_projection_elem(&mut self,
170+
base: & $($mutability)? PlaceBase<'tcx>,
171+
proj_base: & $($mutability)? [PlaceElem<'tcx>],
172+
elem: & $($mutability)? PlaceElem<'tcx>,
173+
context: PlaceContext,
174+
location: Location) {
175+
self.super_projection_elem(base, proj_base, elem, context, location);
176+
}
177+
169178
fn visit_constant(&mut self,
170179
constant: & $($mutability)? Constant<'tcx>,
171180
location: Location) {
@@ -727,25 +736,33 @@ macro_rules! make_mir_visitor {
727736
location: Location) {
728737
if let [proj_base @ .., elem] = projection {
729738
self.visit_projection(base, proj_base, context, location);
739+
self.visit_projection_elem(base, proj_base, elem, context, location);
740+
}
741+
}
730742

731-
match elem {
732-
ProjectionElem::Field(_field, ty) => {
733-
self.visit_ty(ty, TyContext::Location(location));
734-
}
735-
ProjectionElem::Index(local) => {
736-
self.visit_local(
737-
local,
738-
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy),
739-
location
740-
);
741-
}
742-
ProjectionElem::Deref |
743-
ProjectionElem::Subslice { from: _, to: _ } |
744-
ProjectionElem::ConstantIndex { offset: _,
745-
min_length: _,
746-
from_end: _ } |
747-
ProjectionElem::Downcast(_, _) => {
748-
}
743+
fn super_projection_elem(&mut self,
744+
_base: & $($mutability)? PlaceBase<'tcx>,
745+
_proj_base: & $($mutability)? [PlaceElem<'tcx>],
746+
elem: & $($mutability)? PlaceElem<'tcx>,
747+
_context: PlaceContext,
748+
location: Location) {
749+
match elem {
750+
ProjectionElem::Field(_field, ty) => {
751+
self.visit_ty(ty, TyContext::Location(location));
752+
}
753+
ProjectionElem::Index(local) => {
754+
self.visit_local(
755+
local,
756+
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy),
757+
location
758+
);
759+
}
760+
ProjectionElem::Deref |
761+
ProjectionElem::Subslice { from: _, to: _ } |
762+
ProjectionElem::ConstantIndex { offset: _,
763+
min_length: _,
764+
from_end: _ } |
765+
ProjectionElem::Downcast(_, _) => {
749766
}
750767
}
751768
}

0 commit comments

Comments
 (0)