]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #99154 - rosehuds:master, r=cjgillot
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>
Tue, 12 Jul 2022 11:36:35 +0000 (17:06 +0530)
committerGitHub <noreply@github.com>
Tue, 12 Jul 2022 11:36:35 +0000 (17:06 +0530)
use PlaceRef::iter_projections to fix old FIXME

I added this function in 53481a5a8fde83ed1a5d7e8302be028a4c7d8da5

compiler/rustc_middle/src/mir/visit.rs

index d1477f9e2ae100bb99a430a420cfe68bc34f3e54..0ecb83996a8af7ae6c9d238d0d1c820359208fb3 100644 (file)
@@ -1111,11 +1111,9 @@ fn super_projection(
             context: PlaceContext,
             location: Location,
         ) {
-            // FIXME: Use PlaceRef::iter_projections, once that exists.
-            let mut cursor = place_ref.projection;
-            while let &[ref proj_base @ .., elem] = cursor {
-                cursor = proj_base;
-                self.visit_projection_elem(place_ref.local, cursor, elem, context, location);
+            for (base, elem) in place_ref.iter_projections().rev() {
+                let base_proj = base.projection;
+                self.visit_projection_elem(place_ref.local, base_proj, elem, context, location);
             }
         }