diff options
| author | Henry Boisdequin <65845077+henryboisdequin@users.noreply.github.com> | 2021-02-20 16:46:05 +0530 |
|---|---|---|
| committer | Henry Boisdequin <65845077+henryboisdequin@users.noreply.github.com> | 2021-02-20 16:56:08 +0530 |
| commit | a9c61888896da6feea45875813b894e7fa4067f6 (patch) | |
| tree | b32e76cb698bafb89a5605281d707cf4fc12157d | |
| parent | 5ec4b060a793b7e04e87654b1d96f5d1fca23667 (diff) | |
| download | rust-a9c61888896da6feea45875813b894e7fa4067f6.tar.gz rust-a9c61888896da6feea45875813b894e7fa4067f6.zip | |
make `super_projection` take a `PlaceRef`
| -rw-r--r-- | compiler/rustc_middle/src/mir/visit.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_mir/src/transform/simplify.rs | 3 |
2 files changed, 6 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 66dd278b578..9530efaedbc 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -1002,7 +1002,7 @@ macro_rules! visit_place_fns { context: PlaceContext, location: Location, ) { - self.super_projection(place_ref.local, place_ref.projection, context, location); + self.super_projection(place_ref, context, location); } fn visit_projection_elem( @@ -1037,15 +1037,15 @@ macro_rules! visit_place_fns { 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); } } diff --git a/compiler/rustc_mir/src/transform/simplify.rs b/compiler/rustc_mir/src/transform/simplify.rs index 289231e52cb..d9abfec85c9 100644 --- a/compiler/rustc_mir/src/transform/simplify.rs +++ b/compiler/rustc_mir/src/transform/simplify.rs @@ -414,8 +414,7 @@ impl UsedLocals { } else { // A definition. Although, it still might use other locals for indexing. self.super_projection( - place.local, - &place.projection, + place.as_ref(), PlaceContext::MutatingUse(MutatingUseContext::Projection), location, ); |
