diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-02-23 02:51:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-23 02:51:50 +0100 |
| commit | cc07061190713059dc533f68a450799dbfb70c5e (patch) | |
| tree | 3ca9bb1a40af3badf72591121aae373e6a4e2287 /compiler/rustc_middle/src/mir | |
| parent | 7b9ef2fde4233a30b15bc7b92004a4cc0bb22dc5 (diff) | |
| parent | a9c61888896da6feea45875813b894e7fa4067f6 (diff) | |
| download | rust-cc07061190713059dc533f68a450799dbfb70c5e.tar.gz rust-cc07061190713059dc533f68a450799dbfb70c5e.zip | |
Rollup merge of #82091 - henryboisdequin:use-place-ref-more, r=RalfJung
use PlaceRef abstractions more consistently Addresses this [comment](https://github.com/rust-lang/rust/pull/80865/files#r558978715) Associated issue: #80647 r? ```@RalfJung```
Diffstat (limited to 'compiler/rustc_middle/src/mir')
| -rw-r--r-- | compiler/rustc_middle/src/mir/visit.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 023555d91cc..9530efaedbc 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -998,12 +998,11 @@ macro_rules! visit_place_fns { () => { fn visit_projection( &mut self, - local: Local, - projection: &[PlaceElem<'tcx>], + place_ref: PlaceRef<'tcx>, context: PlaceContext, location: Location, ) { - self.super_projection(local, projection, context, location); + self.super_projection(place_ref, context, location); } fn visit_projection_elem( @@ -1033,20 +1032,20 @@ macro_rules! visit_place_fns { self.visit_local(&place.local, context, location); - self.visit_projection(place.local, &place.projection, context, location); + self.visit_projection(place.as_ref(), context, location); } fn super_projection( &mut self, - local: Local, - projection: &[PlaceElem<'tcx>], + place_ref: PlaceRef<'tcx>, context: PlaceContext, location: Location, ) { - let mut cursor = projection; + // 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(local, cursor, elem, context, location); + self.visit_projection_elem(place_ref.local, cursor, elem, context, location); } } |
