Skip to content

Commit f1f4864

Browse files
authored
Rollup merge of #69787 - spastorino:use-local-directly-its-copy, r=oli-obk
mir::Local is Copy we can pass it by value in these cases r? @oli-obk
2 parents 10f999b + 0ed6e79 commit f1f4864

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/librustc/mir/visit.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ macro_rules! visit_place_fns {
888888
() => (
889889
fn visit_projection(
890890
&mut self,
891-
local: &Local,
891+
local: Local,
892892
projection: &[PlaceElem<'tcx>],
893893
context: PlaceContext,
894894
location: Location,
@@ -898,7 +898,7 @@ macro_rules! visit_place_fns {
898898

899899
fn visit_projection_elem(
900900
&mut self,
901-
local: &Local,
901+
local: Local,
902902
proj_base: &[PlaceElem<'tcx>],
903903
elem: &PlaceElem<'tcx>,
904904
context: PlaceContext,
@@ -925,15 +925,15 @@ macro_rules! visit_place_fns {
925925

926926
self.visit_place_base(&place.local, context, location);
927927

928-
self.visit_projection(&place.local,
928+
self.visit_projection(place.local,
929929
&place.projection,
930930
context,
931931
location);
932932
}
933933

934934
fn super_projection(
935935
&mut self,
936-
local: &Local,
936+
local: Local,
937937
projection: &[PlaceElem<'tcx>],
938938
context: PlaceContext,
939939
location: Location,
@@ -947,7 +947,7 @@ macro_rules! visit_place_fns {
947947

948948
fn super_projection_elem(
949949
&mut self,
950-
_local: &Local,
950+
_local: Local,
951951
_proj_base: &[PlaceElem<'tcx>],
952952
elem: &PlaceElem<'tcx>,
953953
_context: PlaceContext,

src/librustc_codegen_ssa/mir/analyze.rs

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

205205
self.visit_place_base(&place_ref.local, context, location);
206-
self.visit_projection(&place_ref.local, place_ref.projection, context, location);
206+
self.visit_projection(place_ref.local, place_ref.projection, context, location);
207207
}
208208
}
209209
}

src/librustc_mir/transform/check_consts/validation.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
276276
}
277277
};
278278
self.visit_place_base(&place.local, ctx, location);
279-
self.visit_projection(&place.local, reborrowed_proj, ctx, location);
279+
self.visit_projection(place.local, reborrowed_proj, ctx, location);
280280
return;
281281
}
282282
}
@@ -289,7 +289,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
289289
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
290290
};
291291
self.visit_place_base(&place.local, ctx, location);
292-
self.visit_projection(&place.local, reborrowed_proj, ctx, location);
292+
self.visit_projection(place.local, reborrowed_proj, ctx, location);
293293
return;
294294
}
295295
}
@@ -408,7 +408,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
408408
}
409409
fn visit_projection_elem(
410410
&mut self,
411-
place_local: &Local,
411+
place_local: Local,
412412
proj_base: &[PlaceElem<'tcx>],
413413
elem: &PlaceElem<'tcx>,
414414
context: PlaceContext,
@@ -428,11 +428,11 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
428428

429429
match elem {
430430
ProjectionElem::Deref => {
431-
let base_ty = Place::ty_from(*place_local, proj_base, *self.body, self.tcx).ty;
431+
let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
432432
if let ty::RawPtr(_) = base_ty.kind {
433433
if proj_base.is_empty() {
434434
if let (local, []) = (place_local, proj_base) {
435-
let decl = &self.body.local_decls[*local];
435+
let decl = &self.body.local_decls[local];
436436
if let LocalInfo::StaticRef { def_id, .. } = decl.local_info {
437437
let span = decl.source_info.span;
438438
self.check_static(def_id, span);
@@ -452,7 +452,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
452452
| ProjectionElem::Subslice { .. }
453453
| ProjectionElem::Field(..)
454454
| ProjectionElem::Index(_) => {
455-
let base_ty = Place::ty_from(*place_local, proj_base, *self.body, self.tcx).ty;
455+
let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
456456
match base_ty.ty_adt_def() {
457457
Some(def) if def.is_union() => {
458458
self.check_op(ops::UnionAccess);

0 commit comments

Comments
 (0)