Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mir::Local is Copy we can pass it by value in these cases #69787

Merged
merged 1 commit into from
Mar 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/librustc/mir/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ macro_rules! visit_place_fns {
() => (
fn visit_projection(
&mut self,
local: &Local,
local: Local,
projection: &[PlaceElem<'tcx>],
context: PlaceContext,
location: Location,
Expand All @@ -898,7 +898,7 @@ macro_rules! visit_place_fns {

fn visit_projection_elem(
&mut self,
local: &Local,
local: Local,
proj_base: &[PlaceElem<'tcx>],
elem: &PlaceElem<'tcx>,
context: PlaceContext,
Expand All @@ -925,15 +925,15 @@ macro_rules! visit_place_fns {

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

self.visit_projection(&place.local,
self.visit_projection(place.local,
&place.projection,
context,
location);
}

fn super_projection(
&mut self,
local: &Local,
local: Local,
projection: &[PlaceElem<'tcx>],
context: PlaceContext,
location: Location,
Expand All @@ -947,7 +947,7 @@ macro_rules! visit_place_fns {

fn super_projection_elem(
&mut self,
_local: &Local,
_local: Local,
_proj_base: &[PlaceElem<'tcx>],
elem: &PlaceElem<'tcx>,
_context: PlaceContext,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/mir/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
}

self.visit_place_base(&place_ref.local, context, location);
self.visit_projection(&place_ref.local, place_ref.projection, context, location);
self.visit_projection(place_ref.local, place_ref.projection, context, location);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/librustc_mir/transform/check_consts/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
}
};
self.visit_place_base(&place.local, ctx, location);
self.visit_projection(&place.local, reborrowed_proj, ctx, location);
self.visit_projection(place.local, reborrowed_proj, ctx, location);
return;
}
}
Expand All @@ -289,7 +289,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
};
self.visit_place_base(&place.local, ctx, location);
self.visit_projection(&place.local, reborrowed_proj, ctx, location);
self.visit_projection(place.local, reborrowed_proj, ctx, location);
return;
}
}
Expand Down Expand Up @@ -408,7 +408,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
}
fn visit_projection_elem(
&mut self,
place_local: &Local,
place_local: Local,
proj_base: &[PlaceElem<'tcx>],
elem: &PlaceElem<'tcx>,
context: PlaceContext,
Expand All @@ -428,11 +428,11 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {

match elem {
ProjectionElem::Deref => {
let base_ty = Place::ty_from(*place_local, proj_base, *self.body, self.tcx).ty;
let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
if let ty::RawPtr(_) = base_ty.kind {
if proj_base.is_empty() {
if let (local, []) = (place_local, proj_base) {
let decl = &self.body.local_decls[*local];
let decl = &self.body.local_decls[local];
if let LocalInfo::StaticRef { def_id, .. } = decl.local_info {
let span = decl.source_info.span;
self.check_static(def_id, span);
Expand All @@ -452,7 +452,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
| ProjectionElem::Subslice { .. }
| ProjectionElem::Field(..)
| ProjectionElem::Index(_) => {
let base_ty = Place::ty_from(*place_local, proj_base, *self.body, self.tcx).ty;
let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
match base_ty.ty_adt_def() {
Some(def) if def.is_union() => {
self.check_op(ops::UnionAccess);
Expand Down