diff options
| author | Rose Hudson <cv21874@bristol.ac.uk> | 2022-07-11 14:42:49 +0100 |
|---|---|---|
| committer | Rose Hudson <cv21874@bristol.ac.uk> | 2022-07-11 14:42:49 +0100 |
| commit | d84f7394a487f51ab5afcc6ca8df66ec6460ec8c (patch) | |
| tree | f771e652896c9f4a6eaf712d910fcd4b743075c3 /compiler | |
| parent | 7d1f57a757af4fe5d47a6f6d3167761ec61b7894 (diff) | |
| download | rust-d84f7394a487f51ab5afcc6ca8df66ec6460ec8c.tar.gz rust-d84f7394a487f51ab5afcc6ca8df66ec6460ec8c.zip | |
use PlaceRef::iter_projections to fix old FIXME
I added this function in 53481a5a8fde83ed1a5d7e8302be028a4c7d8da5
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_middle/src/mir/visit.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index d1477f9e2ae..0ecb83996a8 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -1111,11 +1111,9 @@ macro_rules! visit_place_fns { 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); } } |
