Skip to content

Commit a9c6188

Browse files
make super_projection take a PlaceRef
1 parent 5ec4b06 commit a9c6188

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

compiler/rustc_middle/src/mir/visit.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ macro_rules! visit_place_fns {
10021002
context: PlaceContext,
10031003
location: Location,
10041004
) {
1005-
self.super_projection(place_ref.local, place_ref.projection, context, location);
1005+
self.super_projection(place_ref, context, location);
10061006
}
10071007

10081008
fn visit_projection_elem(
@@ -1037,15 +1037,15 @@ macro_rules! visit_place_fns {
10371037

10381038
fn super_projection(
10391039
&mut self,
1040-
local: Local,
1041-
projection: &[PlaceElem<'tcx>],
1040+
place_ref: PlaceRef<'tcx>,
10421041
context: PlaceContext,
10431042
location: Location,
10441043
) {
1045-
let mut cursor = projection;
1044+
// FIXME: Use PlaceRef::iter_projections, once that exists.
1045+
let mut cursor = place_ref.projection;
10461046
while let &[ref proj_base @ .., elem] = cursor {
10471047
cursor = proj_base;
1048-
self.visit_projection_elem(local, cursor, elem, context, location);
1048+
self.visit_projection_elem(place_ref.local, cursor, elem, context, location);
10491049
}
10501050
}
10511051

compiler/rustc_mir/src/transform/simplify.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,7 @@ impl UsedLocals {
414414
} else {
415415
// A definition. Although, it still might use other locals for indexing.
416416
self.super_projection(
417-
place.local,
418-
&place.projection,
417+
place.as_ref(),
419418
PlaceContext::MutatingUse(MutatingUseContext::Projection),
420419
location,
421420
);

0 commit comments

Comments
 (0)