Skip to content

Commit

Permalink
Auto merge of #46425 - eddyb:mir-place, r=nikomatsakis
Browse files Browse the repository at this point in the history
MIR: change "lvalue" terminology to "place".

As pointed out elsewhere, "lvalue" vs "rvalue" is a misleading/obscure distinction and several other choices have been proposed, the one I prefer being "place" vs "value".

This PR only touches the "lvalue" side, and only in MIR-related code, as it's already a lot and could rot.
  • Loading branch information
bors committed Dec 1, 2017
2 parents 6805b01 + 473f044 commit bb42071
Show file tree
Hide file tree
Showing 72 changed files with 1,592 additions and 1,591 deletions.
50 changes: 25 additions & 25 deletions src/librustc/ich/impls_mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,24 +272,24 @@ for mir::StatementKind<'gcx> {
mem::discriminant(self).hash_stable(hcx, hasher);

match *self {
mir::StatementKind::Assign(ref lvalue, ref rvalue) => {
lvalue.hash_stable(hcx, hasher);
mir::StatementKind::Assign(ref place, ref rvalue) => {
place.hash_stable(hcx, hasher);
rvalue.hash_stable(hcx, hasher);
}
mir::StatementKind::SetDiscriminant { ref lvalue, variant_index } => {
lvalue.hash_stable(hcx, hasher);
mir::StatementKind::SetDiscriminant { ref place, variant_index } => {
place.hash_stable(hcx, hasher);
variant_index.hash_stable(hcx, hasher);
}
mir::StatementKind::StorageLive(ref lvalue) |
mir::StatementKind::StorageDead(ref lvalue) => {
lvalue.hash_stable(hcx, hasher);
mir::StatementKind::StorageLive(ref place) |
mir::StatementKind::StorageDead(ref place) => {
place.hash_stable(hcx, hasher);
}
mir::StatementKind::EndRegion(ref region_scope) => {
region_scope.hash_stable(hcx, hasher);
}
mir::StatementKind::Validate(ref op, ref lvalues) => {
mir::StatementKind::Validate(ref op, ref places) => {
op.hash_stable(hcx, hasher);
lvalues.hash_stable(hcx, hasher);
places.hash_stable(hcx, hasher);
}
mir::StatementKind::Nop => {}
mir::StatementKind::InlineAsm { ref asm, ref outputs, ref inputs } => {
Expand All @@ -309,7 +309,7 @@ impl<'gcx, T> HashStable<StableHashingContext<'gcx>>
hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>)
{
self.lval.hash_stable(hcx, hasher);
self.place.hash_stable(hcx, hasher);
self.ty.hash_stable(hcx, hasher);
self.re.hash_stable(hcx, hasher);
self.mutbl.hash_stable(hcx, hasher);
Expand All @@ -318,20 +318,20 @@ impl<'gcx, T> HashStable<StableHashingContext<'gcx>>

impl_stable_hash_for!(enum mir::ValidationOp { Acquire, Release, Suspend(region_scope) });

impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Lvalue<'gcx> {
impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Place<'gcx> {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher);
match *self {
mir::Lvalue::Local(ref local) => {
mir::Place::Local(ref local) => {
local.hash_stable(hcx, hasher);
}
mir::Lvalue::Static(ref statik) => {
mir::Place::Static(ref statik) => {
statik.hash_stable(hcx, hasher);
}
mir::Lvalue::Projection(ref lvalue_projection) => {
lvalue_projection.hash_stable(hcx, hasher);
mir::Place::Projection(ref place_projection) => {
place_projection.hash_stable(hcx, hasher);
}
}
}
Expand Down Expand Up @@ -420,11 +420,11 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Operand<'gcx> {
mem::discriminant(self).hash_stable(hcx, hasher);

match *self {
mir::Operand::Copy(ref lvalue) => {
lvalue.hash_stable(hcx, hasher);
mir::Operand::Copy(ref place) => {
place.hash_stable(hcx, hasher);
}
mir::Operand::Move(ref lvalue) => {
lvalue.hash_stable(hcx, hasher);
mir::Operand::Move(ref place) => {
place.hash_stable(hcx, hasher);
}
mir::Operand::Constant(ref constant) => {
constant.hash_stable(hcx, hasher);
Expand All @@ -447,13 +447,13 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Rvalue<'gcx> {
operand.hash_stable(hcx, hasher);
val.hash_stable(hcx, hasher);
}
mir::Rvalue::Ref(region, borrow_kind, ref lvalue) => {
mir::Rvalue::Ref(region, borrow_kind, ref place) => {
region.hash_stable(hcx, hasher);
borrow_kind.hash_stable(hcx, hasher);
lvalue.hash_stable(hcx, hasher);
place.hash_stable(hcx, hasher);
}
mir::Rvalue::Len(ref lvalue) => {
lvalue.hash_stable(hcx, hasher);
mir::Rvalue::Len(ref place) => {
place.hash_stable(hcx, hasher);
}
mir::Rvalue::Cast(cast_kind, ref operand, ty) => {
cast_kind.hash_stable(hcx, hasher);
Expand All @@ -470,8 +470,8 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Rvalue<'gcx> {
op.hash_stable(hcx, hasher);
operand.hash_stable(hcx, hasher);
}
mir::Rvalue::Discriminant(ref lvalue) => {
lvalue.hash_stable(hcx, hasher);
mir::Rvalue::Discriminant(ref place) => {
place.hash_stable(hcx, hasher);
}
mir::Rvalue::NullaryOp(op, ty) => {
op.hash_stable(hcx, hasher);
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use hir::def_id::DefId;
use middle::free_region::{FreeRegionMap, RegionRelations};
use middle::region;
use middle::lang_items;
use mir::tcx::LvalueTy;
use mir::tcx::PlaceTy;
use ty::subst::{Kind, Subst, Substs};
use ty::{TyVid, IntVid, FloatVid};
use ty::{self, Ty, TyCtxt};
Expand Down Expand Up @@ -518,15 +518,15 @@ impl_trans_normalize!('gcx,
ty::ExistentialTraitRef<'gcx>
);

impl<'gcx> TransNormalize<'gcx> for LvalueTy<'gcx> {
impl<'gcx> TransNormalize<'gcx> for PlaceTy<'gcx> {
fn trans_normalize<'a, 'tcx>(&self,
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
param_env: ty::ParamEnv<'tcx>)
-> Self {
match *self {
LvalueTy::Ty { ty } => LvalueTy::Ty { ty: ty.trans_normalize(infcx, param_env) },
LvalueTy::Downcast { adt_def, substs, variant_index } => {
LvalueTy::Downcast {
PlaceTy::Ty { ty } => PlaceTy::Ty { ty: ty.trans_normalize(infcx, param_env) },
PlaceTy::Downcast { adt_def, substs, variant_index } => {
PlaceTy::Downcast {
adt_def,
substs: substs.trans_normalize(infcx, param_env),
variant_index,
Expand Down
Loading

0 comments on commit bb42071

Please sign in to comment.