Skip to content

Commit 511743c

Browse files
committed
MIR: s/Lvalue/Place in type names.
1 parent e3ed212 commit 511743c

Some content is hidden

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

69 files changed

+719
-719
lines changed

src/librustc/ich/impls_mir.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -318,19 +318,19 @@ 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) => {
333+
mir::Place::Projection(ref lvalue_projection) => {
334334
lvalue_projection.hash_stable(hcx, hasher);
335335
}
336336
}

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,

src/librustc/mir/mod.rs

+36-36
Original file line numberDiff line numberDiff line change
@@ -641,14 +641,14 @@ pub enum TerminatorKind<'tcx> {
641641
/// Indicates a terminator that can never be reached.
642642
Unreachable,
643643

644-
/// Drop the Lvalue
644+
/// Drop the Place
645645
Drop {
646-
location: Lvalue<'tcx>,
646+
location: Place<'tcx>,
647647
target: BasicBlock,
648648
unwind: Option<BasicBlock>
649649
},
650650

651-
/// Drop the Lvalue and assign the new value over it. This ensures
651+
/// Drop the Place and assign the new value over it. This ensures
652652
/// that the assignment to LV occurs *even if* the destructor for
653653
/// lvalue unwinds. Its semantics are best explained by by the
654654
/// elaboration:
@@ -675,7 +675,7 @@ pub enum TerminatorKind<'tcx> {
675675
/// }
676676
/// ```
677677
DropAndReplace {
678-
location: Lvalue<'tcx>,
678+
location: Place<'tcx>,
679679
value: Operand<'tcx>,
680680
target: BasicBlock,
681681
unwind: Option<BasicBlock>,
@@ -691,7 +691,7 @@ pub enum TerminatorKind<'tcx> {
691691
/// reused across function calls without duplicating the contents.
692692
args: Vec<Operand<'tcx>>,
693693
/// Destination for the return value. If some, the call is converging.
694-
destination: Option<(Lvalue<'tcx>, BasicBlock)>,
694+
destination: Option<(Place<'tcx>, BasicBlock)>,
695695
/// Cleanups to be done if the call unwinds.
696696
cleanup: Option<BasicBlock>
697697
},
@@ -1002,11 +1002,11 @@ impl<'tcx> Statement<'tcx> {
10021002

10031003
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
10041004
pub enum StatementKind<'tcx> {
1005-
/// Write the RHS Rvalue to the LHS Lvalue.
1006-
Assign(Lvalue<'tcx>, Rvalue<'tcx>),
1005+
/// Write the RHS Rvalue to the LHS Place.
1006+
Assign(Place<'tcx>, Rvalue<'tcx>),
10071007

1008-
/// Write the discriminant for a variant to the enum Lvalue.
1009-
SetDiscriminant { lvalue: Lvalue<'tcx>, variant_index: usize },
1008+
/// Write the discriminant for a variant to the enum Place.
1009+
SetDiscriminant { lvalue: Place<'tcx>, variant_index: usize },
10101010

10111011
/// Start a live range for the storage of the local.
10121012
StorageLive(Local),
@@ -1017,14 +1017,14 @@ pub enum StatementKind<'tcx> {
10171017
/// Execute a piece of inline Assembly.
10181018
InlineAsm {
10191019
asm: Box<InlineAsm>,
1020-
outputs: Vec<Lvalue<'tcx>>,
1020+
outputs: Vec<Place<'tcx>>,
10211021
inputs: Vec<Operand<'tcx>>
10221022
},
10231023

10241024
/// Assert the given lvalues to be valid inhabitants of their type. These statements are
10251025
/// currently only interpreted by miri and only generated when "-Z mir-emit-validate" is passed.
10261026
/// See <https://internals.rust-lang.org/t/types-as-contracts/5562/73> for more details.
1027-
Validate(ValidationOp, Vec<ValidationOperand<'tcx, Lvalue<'tcx>>>),
1027+
Validate(ValidationOp, Vec<ValidationOperand<'tcx, Place<'tcx>>>),
10281028

10291029
/// Mark one terminating point of a region scope (i.e. static region).
10301030
/// (The starting point(s) arise implicitly from borrows.)
@@ -1107,20 +1107,20 @@ impl<'tcx> Debug for Statement<'tcx> {
11071107
}
11081108

11091109
///////////////////////////////////////////////////////////////////////////
1110-
// Lvalues
1110+
// Places
11111111

11121112
/// A path to a value; something that can be evaluated without
11131113
/// changing or disturbing program state.
11141114
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable)]
1115-
pub enum Lvalue<'tcx> {
1115+
pub enum Place<'tcx> {
11161116
/// local variable
11171117
Local(Local),
11181118

11191119
/// static or static mut variable
11201120
Static(Box<Static<'tcx>>),
11211121

11221122
/// projection out of an lvalue (access a field, deref a pointer, etc)
1123-
Projection(Box<LvalueProjection<'tcx>>),
1123+
Projection(Box<PlaceProjection<'tcx>>),
11241124
}
11251125

11261126
/// The def-id of a static, along with its normalized type (which is
@@ -1138,8 +1138,8 @@ impl_stable_hash_for!(struct Static<'tcx> {
11381138

11391139
/// The `Projection` data structure defines things of the form `B.x`
11401140
/// or `*B` or `B[index]`. Note that it is parameterized because it is
1141-
/// shared between `Constant` and `Lvalue`. See the aliases
1142-
/// `LvalueProjection` etc below.
1141+
/// shared between `Constant` and `Place`. See the aliases
1142+
/// `PlaceProjection` etc below.
11431143
#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
11441144
pub struct Projection<'tcx, B, V, T> {
11451145
pub base: B,
@@ -1186,42 +1186,42 @@ pub enum ProjectionElem<'tcx, V, T> {
11861186

11871187
/// Alias for projections as they appear in lvalues, where the base is an lvalue
11881188
/// and the index is a local.
1189-
pub type LvalueProjection<'tcx> = Projection<'tcx, Lvalue<'tcx>, Local, Ty<'tcx>>;
1189+
pub type PlaceProjection<'tcx> = Projection<'tcx, Place<'tcx>, Local, Ty<'tcx>>;
11901190

11911191
/// Alias for projections as they appear in lvalues, where the base is an lvalue
11921192
/// and the index is a local.
1193-
pub type LvalueElem<'tcx> = ProjectionElem<'tcx, Local, Ty<'tcx>>;
1193+
pub type PlaceElem<'tcx> = ProjectionElem<'tcx, Local, Ty<'tcx>>;
11941194

11951195
newtype_index!(Field { DEBUG_FORMAT = "field[{}]" });
11961196

1197-
impl<'tcx> Lvalue<'tcx> {
1198-
pub fn field(self, f: Field, ty: Ty<'tcx>) -> Lvalue<'tcx> {
1197+
impl<'tcx> Place<'tcx> {
1198+
pub fn field(self, f: Field, ty: Ty<'tcx>) -> Place<'tcx> {
11991199
self.elem(ProjectionElem::Field(f, ty))
12001200
}
12011201

1202-
pub fn deref(self) -> Lvalue<'tcx> {
1202+
pub fn deref(self) -> Place<'tcx> {
12031203
self.elem(ProjectionElem::Deref)
12041204
}
12051205

1206-
pub fn downcast(self, adt_def: &'tcx AdtDef, variant_index: usize) -> Lvalue<'tcx> {
1206+
pub fn downcast(self, adt_def: &'tcx AdtDef, variant_index: usize) -> Place<'tcx> {
12071207
self.elem(ProjectionElem::Downcast(adt_def, variant_index))
12081208
}
12091209

1210-
pub fn index(self, index: Local) -> Lvalue<'tcx> {
1210+
pub fn index(self, index: Local) -> Place<'tcx> {
12111211
self.elem(ProjectionElem::Index(index))
12121212
}
12131213

1214-
pub fn elem(self, elem: LvalueElem<'tcx>) -> Lvalue<'tcx> {
1215-
Lvalue::Projection(Box::new(LvalueProjection {
1214+
pub fn elem(self, elem: PlaceElem<'tcx>) -> Place<'tcx> {
1215+
Place::Projection(Box::new(PlaceProjection {
12161216
base: self,
12171217
elem,
12181218
}))
12191219
}
12201220
}
12211221

1222-
impl<'tcx> Debug for Lvalue<'tcx> {
1222+
impl<'tcx> Debug for Place<'tcx> {
12231223
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
1224-
use self::Lvalue::*;
1224+
use self::Place::*;
12251225

12261226
match *self {
12271227
Local(id) => write!(fmt, "{:?}", id),
@@ -1281,13 +1281,13 @@ pub enum Operand<'tcx> {
12811281
///
12821282
/// This implies that the type of the lvalue must be `Copy`; this is true
12831283
/// by construction during build, but also checked by the MIR type checker.
1284-
Copy(Lvalue<'tcx>),
1284+
Copy(Place<'tcx>),
12851285
/// Move: The value (including old borrows of it) will not be used again.
12861286
///
12871287
/// Safe for values of all types (modulo future developments towards `?Move`).
12881288
/// Correct usage patterns are enforced by the borrow checker for safe code.
12891289
/// `Copy` may be converted to `Move` to enable "last-use" optimizations.
1290-
Move(Lvalue<'tcx>),
1290+
Move(Place<'tcx>),
12911291
Constant(Box<Constant<'tcx>>),
12921292
}
12931293

@@ -1336,10 +1336,10 @@ pub enum Rvalue<'tcx> {
13361336
Repeat(Operand<'tcx>, ConstUsize),
13371337

13381338
/// &x or &mut x
1339-
Ref(Region<'tcx>, BorrowKind, Lvalue<'tcx>),
1339+
Ref(Region<'tcx>, BorrowKind, Place<'tcx>),
13401340

13411341
/// length of a [X] or [X;n] value
1342-
Len(Lvalue<'tcx>),
1342+
Len(Place<'tcx>),
13431343

13441344
Cast(CastKind, Operand<'tcx>, Ty<'tcx>),
13451345

@@ -1353,7 +1353,7 @@ pub enum Rvalue<'tcx> {
13531353
///
13541354
/// Undefined (i.e. no effort is made to make it defined, but there’s no reason why it cannot
13551355
/// be defined to return, say, a 0) if ADT is not an enum.
1356-
Discriminant(Lvalue<'tcx>),
1356+
Discriminant(Place<'tcx>),
13571357

13581358
/// Create an aggregate value, like a tuple or struct. This is
13591359
/// only needed because we want to distinguish `dest = Foo { x:
@@ -1828,7 +1828,7 @@ impl<'tcx> TypeFoldable<'tcx> for BasicBlockData<'tcx> {
18281828
}
18291829
}
18301830

1831-
impl<'tcx> TypeFoldable<'tcx> for ValidationOperand<'tcx, Lvalue<'tcx>> {
1831+
impl<'tcx> TypeFoldable<'tcx> for ValidationOperand<'tcx, Place<'tcx>> {
18321832
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
18331833
ValidationOperand {
18341834
lval: self.lval.fold_with(folder),
@@ -2012,16 +2012,16 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
20122012
}
20132013
}
20142014

2015-
impl<'tcx> TypeFoldable<'tcx> for Lvalue<'tcx> {
2015+
impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
20162016
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
20172017
match self {
2018-
&Lvalue::Projection(ref p) => Lvalue::Projection(p.fold_with(folder)),
2018+
&Place::Projection(ref p) => Place::Projection(p.fold_with(folder)),
20192019
_ => self.clone()
20202020
}
20212021
}
20222022

20232023
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
2024-
if let &Lvalue::Projection(ref p) = self {
2024+
if let &Place::Projection(ref p) = self {
20252025
p.visit_with(visitor)
20262026
} else {
20272027
false

0 commit comments

Comments
 (0)