@@ -76,8 +76,6 @@ impl DepKind {
7676 }
7777}
7878
79- static_assert_size ! ( DepKind , 2 ) ;
80-
8179pub fn default_dep_kind_debug ( kind : DepKind , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
8280 f. debug_struct ( "DepKind" ) . field ( "variant" , & kind. variant ) . finish ( )
8381}
@@ -97,15 +95,6 @@ pub struct DepNode {
9795 pub hash : PackedFingerprint ,
9896}
9997
100- // We keep a lot of `DepNode`s in memory during compilation. It's not
101- // required that their size stay the same, but we don't want to change
102- // it inadvertently. This assert just ensures we're aware of any change.
103- #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
104- static_assert_size ! ( DepNode , 18 ) ;
105-
106- #[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" ) ) ) ]
107- static_assert_size ! ( DepNode , 24 ) ;
108-
10998impl DepNode {
11099 /// Creates a new, parameterless DepNode. This method will assert
111100 /// that the DepNode corresponding to the given DepKind actually
@@ -316,3 +305,17 @@ unsafe impl StableOrd for WorkProductId {
316305 // Fingerprint can use unstable (just a tuple of `u64`s), so WorkProductId can as well
317306 const CAN_USE_UNSTABLE_SORT : bool = true ;
318307}
308+
309+ // Some types are used a lot. Make sure they don't unintentionally get bigger.
310+ #[ cfg( target_pointer_width = "64" ) ]
311+ mod size_asserts {
312+ use super :: * ;
313+ use rustc_data_structures:: static_assert_size;
314+ // tidy-alphabetical-start
315+ static_assert_size ! ( DepKind , 2 ) ;
316+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
317+ static_assert_size ! ( DepNode , 18 ) ;
318+ #[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" ) ) ) ]
319+ static_assert_size ! ( DepNode , 24 ) ;
320+ // tidy-alphabetical-end
321+ }
0 commit comments