@@ -1046,6 +1046,7 @@ pub enum Rvalue<'tcx> {
1046
1046
BinaryOp ( BinOp , Operand < ' tcx > , Operand < ' tcx > ) ,
1047
1047
CheckedBinaryOp ( BinOp , Operand < ' tcx > , Operand < ' tcx > ) ,
1048
1048
1049
+ NullaryOp ( NullOp , Ty < ' tcx > ) ,
1049
1050
UnaryOp ( UnOp , Operand < ' tcx > ) ,
1050
1051
1051
1052
/// Read the discriminant of an ADT.
@@ -1054,9 +1055,6 @@ pub enum Rvalue<'tcx> {
1054
1055
/// be defined to return, say, a 0) if ADT is not an enum.
1055
1056
Discriminant ( Lvalue < ' tcx > ) ,
1056
1057
1057
- /// Creates an *uninitialized* Box
1058
- Box ( Ty < ' tcx > ) ,
1059
-
1060
1058
/// Create an aggregate value, like a tuple or struct. This is
1061
1059
/// only needed because we want to distinguish `dest = Foo { x:
1062
1060
/// ..., y: ... }` from `dest.x = ...; dest.y = ...;` in the case
@@ -1132,6 +1130,8 @@ pub enum BinOp {
1132
1130
Ge ,
1133
1131
/// The `>` operator (greater than)
1134
1132
Gt ,
1133
+ /// The `ptr.offset` operator
1134
+ Offset ,
1135
1135
}
1136
1136
1137
1137
impl BinOp {
@@ -1144,6 +1144,14 @@ impl BinOp {
1144
1144
}
1145
1145
}
1146
1146
1147
+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , RustcEncodable , RustcDecodable ) ]
1148
+ pub enum NullOp {
1149
+ /// Return the size of a value of that type
1150
+ SizeOf ,
1151
+ /// Create a new uninitialized box for a value of that type
1152
+ Box ,
1153
+ }
1154
+
1147
1155
#[ derive( Copy , Clone , Debug , PartialEq , Eq , RustcEncodable , RustcDecodable ) ]
1148
1156
pub enum UnOp {
1149
1157
/// The `!` operator for logical inversion
@@ -1167,7 +1175,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
1167
1175
}
1168
1176
UnaryOp ( ref op, ref a) => write ! ( fmt, "{:?}({:?})" , op, a) ,
1169
1177
Discriminant ( ref lval) => write ! ( fmt, "discriminant({:?})" , lval) ,
1170
- Box ( ref t) => write ! ( fmt, "Box ({:?})" , t) ,
1178
+ NullaryOp ( ref op , ref t) => write ! ( fmt, "{:?} ({:?})" , op , t) ,
1171
1179
Ref ( _, borrow_kind, ref lv) => {
1172
1180
let kind_str = match borrow_kind {
1173
1181
BorrowKind :: Shared => "" ,
@@ -1601,7 +1609,7 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
1601
1609
CheckedBinaryOp ( op, rhs. fold_with ( folder) , lhs. fold_with ( folder) ) ,
1602
1610
UnaryOp ( op, ref val) => UnaryOp ( op, val. fold_with ( folder) ) ,
1603
1611
Discriminant ( ref lval) => Discriminant ( lval. fold_with ( folder) ) ,
1604
- Box ( ty) => Box ( ty. fold_with ( folder) ) ,
1612
+ NullaryOp ( op , ty) => NullaryOp ( op , ty. fold_with ( folder) ) ,
1605
1613
Aggregate ( ref kind, ref fields) => {
1606
1614
let kind = box match * * kind {
1607
1615
AggregateKind :: Array ( ty) => AggregateKind :: Array ( ty. fold_with ( folder) ) ,
@@ -1629,7 +1637,7 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
1629
1637
rhs. visit_with ( visitor) || lhs. visit_with ( visitor) ,
1630
1638
UnaryOp ( _, ref val) => val. visit_with ( visitor) ,
1631
1639
Discriminant ( ref lval) => lval. visit_with ( visitor) ,
1632
- Box ( ty) => ty. visit_with ( visitor) ,
1640
+ NullaryOp ( _ , ty) => ty. visit_with ( visitor) ,
1633
1641
Aggregate ( ref kind, ref fields) => {
1634
1642
( match * * kind {
1635
1643
AggregateKind :: Array ( ty) => ty. visit_with ( visitor) ,
0 commit comments