Skip to content

Commit d84f739

Browse files
use PlaceRef::iter_projections to fix old FIXME
I added this function in 53481a5
1 parent 7d1f57a commit d84f739

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

compiler/rustc_middle/src/mir/visit.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1111,11 +1111,9 @@ macro_rules! visit_place_fns {
11111111
context: PlaceContext,
11121112
location: Location,
11131113
) {
1114-
// FIXME: Use PlaceRef::iter_projections, once that exists.
1115-
let mut cursor = place_ref.projection;
1116-
while let &[ref proj_base @ .., elem] = cursor {
1117-
cursor = proj_base;
1118-
self.visit_projection_elem(place_ref.local, cursor, elem, context, location);
1114+
for (base, elem) in place_ref.iter_projections().rev() {
1115+
let base_proj = base.projection;
1116+
self.visit_projection_elem(place_ref.local, base_proj, elem, context, location);
11191117
}
11201118
}
11211119

0 commit comments

Comments
 (0)