@@ -1046,6 +1046,7 @@ pub enum Rvalue<'tcx> {
10461046 BinaryOp ( BinOp , Operand < ' tcx > , Operand < ' tcx > ) ,
10471047 CheckedBinaryOp ( BinOp , Operand < ' tcx > , Operand < ' tcx > ) ,
10481048
1049+ NullaryOp ( NullOp , Ty < ' tcx > ) ,
10491050 UnaryOp ( UnOp , Operand < ' tcx > ) ,
10501051
10511052 /// Read the discriminant of an ADT.
@@ -1054,9 +1055,6 @@ pub enum Rvalue<'tcx> {
10541055 /// be defined to return, say, a 0) if ADT is not an enum.
10551056 Discriminant ( Lvalue < ' tcx > ) ,
10561057
1057- /// Creates an *uninitialized* Box
1058- Box ( Ty < ' tcx > ) ,
1059-
10601058 /// Create an aggregate value, like a tuple or struct. This is
10611059 /// only needed because we want to distinguish `dest = Foo { x:
10621060 /// ..., y: ... }` from `dest.x = ...; dest.y = ...;` in the case
@@ -1132,6 +1130,8 @@ pub enum BinOp {
11321130 Ge ,
11331131 /// The `>` operator (greater than)
11341132 Gt ,
1133+ /// The `ptr.offset` operator
1134+ Offset ,
11351135}
11361136
11371137impl BinOp {
@@ -1144,6 +1144,14 @@ impl BinOp {
11441144 }
11451145}
11461146
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+
11471155#[ derive( Copy , Clone , Debug , PartialEq , Eq , RustcEncodable , RustcDecodable ) ]
11481156pub enum UnOp {
11491157 /// The `!` operator for logical inversion
@@ -1167,7 +1175,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
11671175 }
11681176 UnaryOp ( ref op, ref a) => write ! ( fmt, "{:?}({:?})" , op, a) ,
11691177 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) ,
11711179 Ref ( _, borrow_kind, ref lv) => {
11721180 let kind_str = match borrow_kind {
11731181 BorrowKind :: Shared => "" ,
@@ -1601,7 +1609,7 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
16011609 CheckedBinaryOp ( op, rhs. fold_with ( folder) , lhs. fold_with ( folder) ) ,
16021610 UnaryOp ( op, ref val) => UnaryOp ( op, val. fold_with ( folder) ) ,
16031611 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) ) ,
16051613 Aggregate ( ref kind, ref fields) => {
16061614 let kind = box match * * kind {
16071615 AggregateKind :: Array ( ty) => AggregateKind :: Array ( ty. fold_with ( folder) ) ,
@@ -1629,7 +1637,7 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
16291637 rhs. visit_with ( visitor) || lhs. visit_with ( visitor) ,
16301638 UnaryOp ( _, ref val) => val. visit_with ( visitor) ,
16311639 Discriminant ( ref lval) => lval. visit_with ( visitor) ,
1632- Box ( ty) => ty. visit_with ( visitor) ,
1640+ NullaryOp ( _ , ty) => ty. visit_with ( visitor) ,
16331641 Aggregate ( ref kind, ref fields) => {
16341642 ( match * * kind {
16351643 AggregateKind :: Array ( ty) => ty. visit_with ( visitor) ,
0 commit comments