Skip to content

Commit 5ec4b06

Browse files
make visit_projection take a PlaceRef
1 parent 30c5125 commit 5ec4b06

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

compiler/rustc_codegen_ssa/src/mir/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
199199
}
200200

201201
self.visit_local(&place_ref.local, context, location);
202-
self.visit_projection(place_ref.local, place_ref.projection, context, location);
202+
self.visit_projection(*place_ref, context, location);
203203
}
204204
}
205205
}

compiler/rustc_middle/src/mir/visit.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -998,12 +998,11 @@ macro_rules! visit_place_fns {
998998
() => {
999999
fn visit_projection(
10001000
&mut self,
1001-
local: Local,
1002-
projection: &[PlaceElem<'tcx>],
1001+
place_ref: PlaceRef<'tcx>,
10031002
context: PlaceContext,
10041003
location: Location,
10051004
) {
1006-
self.super_projection(local, projection, context, location);
1005+
self.super_projection(place_ref.local, place_ref.projection, context, location);
10071006
}
10081007

10091008
fn visit_projection_elem(
@@ -1033,7 +1032,7 @@ macro_rules! visit_place_fns {
10331032

10341033
self.visit_local(&place.local, context, location);
10351034

1036-
self.visit_projection(place.local, &place.projection, context, location);
1035+
self.visit_projection(place.as_ref(), context, location);
10371036
}
10381037

10391038
fn super_projection(

compiler/rustc_mir/src/dataflow/impls/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ where
9595

9696
// We purposefully do not call `super_place` here to avoid calling `visit_local` for this
9797
// place with one of the `Projection` variants of `PlaceContext`.
98-
self.visit_projection(local, projection, context, location);
98+
self.visit_projection(place.as_ref(), context, location);
9999

100100
match DefUse::for_place(context) {
101101
// Treat derefs as a use of the base local. `*p = 4` is not a def of `p` but a use.

compiler/rustc_mir/src/transform/check_consts/validation.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,7 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
508508
}
509509
};
510510
self.visit_local(&reborrowed_place_ref.local, ctx, location);
511-
self.visit_projection(
512-
reborrowed_place_ref.local,
513-
reborrowed_place_ref.projection,
514-
ctx,
515-
location,
516-
);
511+
self.visit_projection(reborrowed_place_ref, ctx, location);
517512
return;
518513
}
519514
}
@@ -526,12 +521,7 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
526521
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
527522
};
528523
self.visit_local(&reborrowed_place_ref.local, ctx, location);
529-
self.visit_projection(
530-
reborrowed_place_ref.local,
531-
reborrowed_place_ref.projection,
532-
ctx,
533-
location,
534-
);
524+
self.visit_projection(reborrowed_place_ref, ctx, location);
535525
return;
536526
}
537527
}

0 commit comments

Comments
 (0)