@@ -641,14 +641,14 @@ pub enum TerminatorKind<'tcx> {
641
641
/// Indicates a terminator that can never be reached.
642
642
Unreachable ,
643
643
644
- /// Drop the Lvalue
644
+ /// Drop the Place
645
645
Drop {
646
- location : Lvalue < ' tcx > ,
646
+ location : Place < ' tcx > ,
647
647
target : BasicBlock ,
648
648
unwind : Option < BasicBlock >
649
649
} ,
650
650
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
652
652
/// that the assignment to LV occurs *even if* the destructor for
653
653
/// lvalue unwinds. Its semantics are best explained by by the
654
654
/// elaboration:
@@ -675,7 +675,7 @@ pub enum TerminatorKind<'tcx> {
675
675
/// }
676
676
/// ```
677
677
DropAndReplace {
678
- location : Lvalue < ' tcx > ,
678
+ location : Place < ' tcx > ,
679
679
value : Operand < ' tcx > ,
680
680
target : BasicBlock ,
681
681
unwind : Option < BasicBlock > ,
@@ -691,7 +691,7 @@ pub enum TerminatorKind<'tcx> {
691
691
/// reused across function calls without duplicating the contents.
692
692
args : Vec < Operand < ' tcx > > ,
693
693
/// Destination for the return value. If some, the call is converging.
694
- destination : Option < ( Lvalue < ' tcx > , BasicBlock ) > ,
694
+ destination : Option < ( Place < ' tcx > , BasicBlock ) > ,
695
695
/// Cleanups to be done if the call unwinds.
696
696
cleanup : Option < BasicBlock >
697
697
} ,
@@ -1002,11 +1002,11 @@ impl<'tcx> Statement<'tcx> {
1002
1002
1003
1003
#[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
1004
1004
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 > ) ,
1007
1007
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 } ,
1010
1010
1011
1011
/// Start a live range for the storage of the local.
1012
1012
StorageLive ( Local ) ,
@@ -1017,14 +1017,14 @@ pub enum StatementKind<'tcx> {
1017
1017
/// Execute a piece of inline Assembly.
1018
1018
InlineAsm {
1019
1019
asm : Box < InlineAsm > ,
1020
- outputs : Vec < Lvalue < ' tcx > > ,
1020
+ outputs : Vec < Place < ' tcx > > ,
1021
1021
inputs : Vec < Operand < ' tcx > >
1022
1022
} ,
1023
1023
1024
1024
/// Assert the given lvalues to be valid inhabitants of their type. These statements are
1025
1025
/// currently only interpreted by miri and only generated when "-Z mir-emit-validate" is passed.
1026
1026
/// 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 > > > ) ,
1028
1028
1029
1029
/// Mark one terminating point of a region scope (i.e. static region).
1030
1030
/// (The starting point(s) arise implicitly from borrows.)
@@ -1107,20 +1107,20 @@ impl<'tcx> Debug for Statement<'tcx> {
1107
1107
}
1108
1108
1109
1109
///////////////////////////////////////////////////////////////////////////
1110
- // Lvalues
1110
+ // Places
1111
1111
1112
1112
/// A path to a value; something that can be evaluated without
1113
1113
/// changing or disturbing program state.
1114
1114
#[ derive( Clone , PartialEq , RustcEncodable , RustcDecodable ) ]
1115
- pub enum Lvalue < ' tcx > {
1115
+ pub enum Place < ' tcx > {
1116
1116
/// local variable
1117
1117
Local ( Local ) ,
1118
1118
1119
1119
/// static or static mut variable
1120
1120
Static ( Box < Static < ' tcx > > ) ,
1121
1121
1122
1122
/// projection out of an lvalue (access a field, deref a pointer, etc)
1123
- Projection ( Box < LvalueProjection < ' tcx > > ) ,
1123
+ Projection ( Box < PlaceProjection < ' tcx > > ) ,
1124
1124
}
1125
1125
1126
1126
/// The def-id of a static, along with its normalized type (which is
@@ -1138,8 +1138,8 @@ impl_stable_hash_for!(struct Static<'tcx> {
1138
1138
1139
1139
/// The `Projection` data structure defines things of the form `B.x`
1140
1140
/// 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.
1143
1143
#[ derive( Clone , Debug , PartialEq , Eq , Hash , RustcEncodable , RustcDecodable ) ]
1144
1144
pub struct Projection < ' tcx , B , V , T > {
1145
1145
pub base : B ,
@@ -1186,42 +1186,42 @@ pub enum ProjectionElem<'tcx, V, T> {
1186
1186
1187
1187
/// Alias for projections as they appear in lvalues, where the base is an lvalue
1188
1188
/// 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 > > ;
1190
1190
1191
1191
/// Alias for projections as they appear in lvalues, where the base is an lvalue
1192
1192
/// 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 > > ;
1194
1194
1195
1195
newtype_index ! ( Field { DEBUG_FORMAT = "field[{}]" } ) ;
1196
1196
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 > {
1199
1199
self . elem ( ProjectionElem :: Field ( f, ty) )
1200
1200
}
1201
1201
1202
- pub fn deref ( self ) -> Lvalue < ' tcx > {
1202
+ pub fn deref ( self ) -> Place < ' tcx > {
1203
1203
self . elem ( ProjectionElem :: Deref )
1204
1204
}
1205
1205
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 > {
1207
1207
self . elem ( ProjectionElem :: Downcast ( adt_def, variant_index) )
1208
1208
}
1209
1209
1210
- pub fn index ( self , index : Local ) -> Lvalue < ' tcx > {
1210
+ pub fn index ( self , index : Local ) -> Place < ' tcx > {
1211
1211
self . elem ( ProjectionElem :: Index ( index) )
1212
1212
}
1213
1213
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 {
1216
1216
base : self ,
1217
1217
elem,
1218
1218
} ) )
1219
1219
}
1220
1220
}
1221
1221
1222
- impl < ' tcx > Debug for Lvalue < ' tcx > {
1222
+ impl < ' tcx > Debug for Place < ' tcx > {
1223
1223
fn fmt ( & self , fmt : & mut Formatter ) -> fmt:: Result {
1224
- use self :: Lvalue :: * ;
1224
+ use self :: Place :: * ;
1225
1225
1226
1226
match * self {
1227
1227
Local ( id) => write ! ( fmt, "{:?}" , id) ,
@@ -1281,13 +1281,13 @@ pub enum Operand<'tcx> {
1281
1281
///
1282
1282
/// This implies that the type of the lvalue must be `Copy`; this is true
1283
1283
/// by construction during build, but also checked by the MIR type checker.
1284
- Copy ( Lvalue < ' tcx > ) ,
1284
+ Copy ( Place < ' tcx > ) ,
1285
1285
/// Move: The value (including old borrows of it) will not be used again.
1286
1286
///
1287
1287
/// Safe for values of all types (modulo future developments towards `?Move`).
1288
1288
/// Correct usage patterns are enforced by the borrow checker for safe code.
1289
1289
/// `Copy` may be converted to `Move` to enable "last-use" optimizations.
1290
- Move ( Lvalue < ' tcx > ) ,
1290
+ Move ( Place < ' tcx > ) ,
1291
1291
Constant ( Box < Constant < ' tcx > > ) ,
1292
1292
}
1293
1293
@@ -1336,10 +1336,10 @@ pub enum Rvalue<'tcx> {
1336
1336
Repeat ( Operand < ' tcx > , ConstUsize ) ,
1337
1337
1338
1338
/// &x or &mut x
1339
- Ref ( Region < ' tcx > , BorrowKind , Lvalue < ' tcx > ) ,
1339
+ Ref ( Region < ' tcx > , BorrowKind , Place < ' tcx > ) ,
1340
1340
1341
1341
/// length of a [X] or [X;n] value
1342
- Len ( Lvalue < ' tcx > ) ,
1342
+ Len ( Place < ' tcx > ) ,
1343
1343
1344
1344
Cast ( CastKind , Operand < ' tcx > , Ty < ' tcx > ) ,
1345
1345
@@ -1353,7 +1353,7 @@ pub enum Rvalue<'tcx> {
1353
1353
///
1354
1354
/// Undefined (i.e. no effort is made to make it defined, but there’s no reason why it cannot
1355
1355
/// be defined to return, say, a 0) if ADT is not an enum.
1356
- Discriminant ( Lvalue < ' tcx > ) ,
1356
+ Discriminant ( Place < ' tcx > ) ,
1357
1357
1358
1358
/// Create an aggregate value, like a tuple or struct. This is
1359
1359
/// only needed because we want to distinguish `dest = Foo { x:
@@ -1828,7 +1828,7 @@ impl<'tcx> TypeFoldable<'tcx> for BasicBlockData<'tcx> {
1828
1828
}
1829
1829
}
1830
1830
1831
- impl < ' tcx > TypeFoldable < ' tcx > for ValidationOperand < ' tcx , Lvalue < ' tcx > > {
1831
+ impl < ' tcx > TypeFoldable < ' tcx > for ValidationOperand < ' tcx , Place < ' tcx > > {
1832
1832
fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , folder : & mut F ) -> Self {
1833
1833
ValidationOperand {
1834
1834
lval : self . lval . fold_with ( folder) ,
@@ -2012,16 +2012,16 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
2012
2012
}
2013
2013
}
2014
2014
2015
- impl < ' tcx > TypeFoldable < ' tcx > for Lvalue < ' tcx > {
2015
+ impl < ' tcx > TypeFoldable < ' tcx > for Place < ' tcx > {
2016
2016
fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , folder : & mut F ) -> Self {
2017
2017
match self {
2018
- & Lvalue :: Projection ( ref p) => Lvalue :: Projection ( p. fold_with ( folder) ) ,
2018
+ & Place :: Projection ( ref p) => Place :: Projection ( p. fold_with ( folder) ) ,
2019
2019
_ => self . clone ( )
2020
2020
}
2021
2021
}
2022
2022
2023
2023
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 {
2025
2025
p. visit_with ( visitor)
2026
2026
} else {
2027
2027
false
0 commit comments