@@ -796,9 +796,6 @@ pub struct Place<'tcx> {
796796 pub projection : & ' tcx List < PlaceElem < ' tcx > > ,
797797}
798798
799- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
800- static_assert_size ! ( Place <' _>, 16 ) ;
801-
802799#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
803800#[ derive( TyEncodable , TyDecodable , HashStable ) ]
804801pub enum ProjectionElem < V , T > {
@@ -862,11 +859,6 @@ pub enum ProjectionElem<V, T> {
862859/// and the index is a local.
863860pub type PlaceElem < ' tcx > = ProjectionElem < Local , Ty < ' tcx > > ;
864861
865- // This type is fairly frequently used, so we shouldn't unintentionally increase
866- // its size.
867- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
868- static_assert_size ! ( PlaceElem <' _>, 24 ) ;
869-
870862///////////////////////////////////////////////////////////////////////////
871863// Operands
872864
@@ -909,9 +901,6 @@ pub enum Operand<'tcx> {
909901 Constant ( Box < Constant < ' tcx > > ) ,
910902}
911903
912- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
913- static_assert_size ! ( Operand <' _>, 24 ) ;
914-
915904///////////////////////////////////////////////////////////////////////////
916905// Rvalues
917906
@@ -1063,9 +1052,6 @@ pub enum Rvalue<'tcx> {
10631052 CopyForDeref ( Place < ' tcx > ) ,
10641053}
10651054
1066- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
1067- static_assert_size ! ( Rvalue <' _>, 40 ) ;
1068-
10691055#[ derive( Clone , Copy , Debug , PartialEq , Eq , TyEncodable , TyDecodable , Hash , HashStable ) ]
10701056pub enum CastKind {
10711057 /// An exposing pointer to address cast. A cast between a pointer and an integer type, or
@@ -1099,9 +1085,6 @@ pub enum AggregateKind<'tcx> {
10991085 Generator ( DefId , SubstsRef < ' tcx > , hir:: Movability ) ,
11001086}
11011087
1102- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
1103- static_assert_size ! ( AggregateKind <' _>, 48 ) ;
1104-
11051088#[ derive( Copy , Clone , Debug , PartialEq , Eq , TyEncodable , TyDecodable , Hash , HashStable ) ]
11061089pub enum NullOp {
11071090 /// Returns the size of a value of that type
@@ -1165,3 +1148,15 @@ pub enum BinOp {
11651148 /// The `ptr.offset` operator
11661149 Offset ,
11671150}
1151+
1152+ // Some nodes are used a lot. Make sure they don't unintentionally get bigger.
1153+ #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
1154+ mod size_asserts {
1155+ use super :: * ;
1156+ // These are in alphabetical order, which is easy to maintain.
1157+ static_assert_size ! ( AggregateKind <' _>, 48 ) ;
1158+ static_assert_size ! ( Operand <' _>, 24 ) ;
1159+ static_assert_size ! ( Place <' _>, 16 ) ;
1160+ static_assert_size ! ( PlaceElem <' _>, 24 ) ;
1161+ static_assert_size ! ( Rvalue <' _>, 40 ) ;
1162+ }
0 commit comments