@@ -800,9 +800,6 @@ pub struct Place<'tcx> {
800800 pub projection : & ' tcx List < PlaceElem < ' tcx > > ,
801801}
802802
803- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
804- static_assert_size ! ( Place <' _>, 16 ) ;
805-
806803#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
807804#[ derive( TyEncodable , TyDecodable , HashStable ) ]
808805pub enum ProjectionElem < V , T > {
@@ -866,11 +863,6 @@ pub enum ProjectionElem<V, T> {
866863/// and the index is a local.
867864pub type PlaceElem < ' tcx > = ProjectionElem < Local , Ty < ' tcx > > ;
868865
869- // This type is fairly frequently used, so we shouldn't unintentionally increase
870- // its size.
871- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
872- static_assert_size ! ( PlaceElem <' _>, 24 ) ;
873-
874866///////////////////////////////////////////////////////////////////////////
875867// Operands
876868
@@ -913,9 +905,6 @@ pub enum Operand<'tcx> {
913905 Constant ( Box < Constant < ' tcx > > ) ,
914906}
915907
916- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
917- static_assert_size ! ( Operand <' _>, 24 ) ;
918-
919908///////////////////////////////////////////////////////////////////////////
920909// Rvalues
921910
@@ -1067,9 +1056,6 @@ pub enum Rvalue<'tcx> {
10671056 CopyForDeref ( Place < ' tcx > ) ,
10681057}
10691058
1070- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
1071- static_assert_size ! ( Rvalue <' _>, 40 ) ;
1072-
10731059#[ derive( Clone , Copy , Debug , PartialEq , Eq , TyEncodable , TyDecodable , Hash , HashStable ) ]
10741060pub enum CastKind {
10751061 /// An exposing pointer to address cast. A cast between a pointer and an integer type, or
@@ -1105,9 +1091,6 @@ pub enum AggregateKind<'tcx> {
11051091 Generator ( LocalDefId , SubstsRef < ' tcx > , hir:: Movability ) ,
11061092}
11071093
1108- #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
1109- static_assert_size ! ( AggregateKind <' _>, 48 ) ;
1110-
11111094#[ derive( Copy , Clone , Debug , PartialEq , Eq , TyEncodable , TyDecodable , Hash , HashStable ) ]
11121095pub enum NullOp {
11131096 /// Returns the size of a value of that type
@@ -1171,3 +1154,15 @@ pub enum BinOp {
11711154 /// The `ptr.offset` operator
11721155 Offset ,
11731156}
1157+
1158+ // Some nodes are used a lot. Make sure they don't unintentionally get bigger.
1159+ #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
1160+ mod size_asserts {
1161+ use super :: * ;
1162+ // These are in alphabetical order, which is easy to maintain.
1163+ static_assert_size ! ( AggregateKind <' _>, 48 ) ;
1164+ static_assert_size ! ( Operand <' _>, 24 ) ;
1165+ static_assert_size ! ( Place <' _>, 16 ) ;
1166+ static_assert_size ! ( PlaceElem <' _>, 24 ) ;
1167+ static_assert_size ! ( Rvalue <' _>, 40 ) ;
1168+ }
0 commit comments