Skip to content

Commit bb42071

Browse files
committed
Auto merge of #46425 - eddyb:mir-place, r=nikomatsakis
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.
2 parents 6805b01 + 473f044 commit bb42071

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1592
-1591
lines changed

src/librustc/ich/impls_mir.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -272,24 +272,24 @@ for mir::StatementKind<'gcx> {
272272
mem::discriminant(self).hash_stable(hcx, hasher);
273273

274274
match *self {
275-
mir::StatementKind::Assign(ref lvalue, ref rvalue) => {
276-
lvalue.hash_stable(hcx, hasher);
275+
mir::StatementKind::Assign(ref place, ref rvalue) => {
276+
place.hash_stable(hcx, hasher);
277277
rvalue.hash_stable(hcx, hasher);
278278
}
279-
mir::StatementKind::SetDiscriminant { ref lvalue, variant_index } => {
280-
lvalue.hash_stable(hcx, hasher);
279+
mir::StatementKind::SetDiscriminant { ref place, variant_index } => {
280+
place.hash_stable(hcx, hasher);
281281
variant_index.hash_stable(hcx, hasher);
282282
}
283-
mir::StatementKind::StorageLive(ref lvalue) |
284-
mir::StatementKind::StorageDead(ref lvalue) => {
285-
lvalue.hash_stable(hcx, hasher);
283+
mir::StatementKind::StorageLive(ref place) |
284+
mir::StatementKind::StorageDead(ref place) => {
285+
place.hash_stable(hcx, hasher);
286286
}
287287
mir::StatementKind::EndRegion(ref region_scope) => {
288288
region_scope.hash_stable(hcx, hasher);
289289
}
290-
mir::StatementKind::Validate(ref op, ref lvalues) => {
290+
mir::StatementKind::Validate(ref op, ref places) => {
291291
op.hash_stable(hcx, hasher);
292-
lvalues.hash_stable(hcx, hasher);
292+
places.hash_stable(hcx, hasher);
293293
}
294294
mir::StatementKind::Nop => {}
295295
mir::StatementKind::InlineAsm { ref asm, ref outputs, ref inputs } => {
@@ -309,7 +309,7 @@ impl<'gcx, T> HashStable<StableHashingContext<'gcx>>
309309
hcx: &mut StableHashingContext<'gcx>,
310310
hasher: &mut StableHasher<W>)
311311
{
312-
self.lval.hash_stable(hcx, hasher);
312+
self.place.hash_stable(hcx, hasher);
313313
self.ty.hash_stable(hcx, hasher);
314314
self.re.hash_stable(hcx, hasher);
315315
self.mutbl.hash_stable(hcx, hasher);
@@ -318,20 +318,20 @@ impl<'gcx, T> HashStable<StableHashingContext<'gcx>>
318318

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

321-
impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Lvalue<'gcx> {
321+
impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Place<'gcx> {
322322
fn hash_stable<W: StableHasherResult>(&self,
323323
hcx: &mut StableHashingContext<'gcx>,
324324
hasher: &mut StableHasher<W>) {
325325
mem::discriminant(self).hash_stable(hcx, hasher);
326326
match *self {
327-
mir::Lvalue::Local(ref local) => {
327+
mir::Place::Local(ref local) => {
328328
local.hash_stable(hcx, hasher);
329329
}
330-
mir::Lvalue::Static(ref statik) => {
330+
mir::Place::Static(ref statik) => {
331331
statik.hash_stable(hcx, hasher);
332332
}
333-
mir::Lvalue::Projection(ref lvalue_projection) => {
334-
lvalue_projection.hash_stable(hcx, hasher);
333+
mir::Place::Projection(ref place_projection) => {
334+
place_projection.hash_stable(hcx, hasher);
335335
}
336336
}
337337
}
@@ -420,11 +420,11 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Operand<'gcx> {
420420
mem::discriminant(self).hash_stable(hcx, hasher);
421421

422422
match *self {
423-
mir::Operand::Copy(ref lvalue) => {
424-
lvalue.hash_stable(hcx, hasher);
423+
mir::Operand::Copy(ref place) => {
424+
place.hash_stable(hcx, hasher);
425425
}
426-
mir::Operand::Move(ref lvalue) => {
427-
lvalue.hash_stable(hcx, hasher);
426+
mir::Operand::Move(ref place) => {
427+
place.hash_stable(hcx, hasher);
428428
}
429429
mir::Operand::Constant(ref constant) => {
430430
constant.hash_stable(hcx, hasher);
@@ -447,13 +447,13 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Rvalue<'gcx> {
447447
operand.hash_stable(hcx, hasher);
448448
val.hash_stable(hcx, hasher);
449449
}
450-
mir::Rvalue::Ref(region, borrow_kind, ref lvalue) => {
450+
mir::Rvalue::Ref(region, borrow_kind, ref place) => {
451451
region.hash_stable(hcx, hasher);
452452
borrow_kind.hash_stable(hcx, hasher);
453-
lvalue.hash_stable(hcx, hasher);
453+
place.hash_stable(hcx, hasher);
454454
}
455-
mir::Rvalue::Len(ref lvalue) => {
456-
lvalue.hash_stable(hcx, hasher);
455+
mir::Rvalue::Len(ref place) => {
456+
place.hash_stable(hcx, hasher);
457457
}
458458
mir::Rvalue::Cast(cast_kind, ref operand, ty) => {
459459
cast_kind.hash_stable(hcx, hasher);
@@ -470,8 +470,8 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Rvalue<'gcx> {
470470
op.hash_stable(hcx, hasher);
471471
operand.hash_stable(hcx, hasher);
472472
}
473-
mir::Rvalue::Discriminant(ref lvalue) => {
474-
lvalue.hash_stable(hcx, hasher);
473+
mir::Rvalue::Discriminant(ref place) => {
474+
place.hash_stable(hcx, hasher);
475475
}
476476
mir::Rvalue::NullaryOp(op, ty) => {
477477
op.hash_stable(hcx, hasher);

src/librustc/infer/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use hir::def_id::DefId;
2121
use middle::free_region::{FreeRegionMap, RegionRelations};
2222
use middle::region;
2323
use middle::lang_items;
24-
use mir::tcx::LvalueTy;
24+
use mir::tcx::PlaceTy;
2525
use ty::subst::{Kind, Subst, Substs};
2626
use ty::{TyVid, IntVid, FloatVid};
2727
use ty::{self, Ty, TyCtxt};
@@ -518,15 +518,15 @@ impl_trans_normalize!('gcx,
518518
ty::ExistentialTraitRef<'gcx>
519519
);
520520

521-
impl<'gcx> TransNormalize<'gcx> for LvalueTy<'gcx> {
521+
impl<'gcx> TransNormalize<'gcx> for PlaceTy<'gcx> {
522522
fn trans_normalize<'a, 'tcx>(&self,
523523
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
524524
param_env: ty::ParamEnv<'tcx>)
525525
-> Self {
526526
match *self {
527-
LvalueTy::Ty { ty } => LvalueTy::Ty { ty: ty.trans_normalize(infcx, param_env) },
528-
LvalueTy::Downcast { adt_def, substs, variant_index } => {
529-
LvalueTy::Downcast {
527+
PlaceTy::Ty { ty } => PlaceTy::Ty { ty: ty.trans_normalize(infcx, param_env) },
528+
PlaceTy::Downcast { adt_def, substs, variant_index } => {
529+
PlaceTy::Downcast {
530530
adt_def,
531531
substs: substs.trans_normalize(infcx, param_env),
532532
variant_index,

0 commit comments

Comments
 (0)