Skip to content

Commit

Permalink
make super_projection take a PlaceRef
Browse files Browse the repository at this point in the history
  • Loading branch information
henryboisdequin committed Feb 20, 2021
1 parent 5ec4b06 commit a9c6188
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions compiler/rustc_middle/src/mir/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
}
}

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_mir/src/transform/simplify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down

0 comments on commit a9c6188

Please sign in to comment.