@@ -38,3 +38,28 @@ fn test_union_info_roundtrip() {
38
38
let decoded: ItemEnum = bincode:: deserialize ( & encoded) . unwrap ( ) ;
39
39
assert_eq ! ( u, decoded) ;
40
40
}
41
+
42
+ // The memory used by a `Crate` can get large. These types are the ones that
43
+ // contribute the most to its size.
44
+ #[ test]
45
+ #[ cfg( target_pointer_width = "64" ) ]
46
+ fn test_type_sizes ( ) {
47
+ // tidy-alphabetical-start
48
+ assert_eq ! ( size_of:: <AssocItemConstraint >( ) , 208 ) ;
49
+ assert_eq ! ( size_of:: <Crate >( ) , 184 ) ;
50
+ assert_eq ! ( size_of:: <ExternalCrate >( ) , 48 ) ;
51
+ assert_eq ! ( size_of:: <FunctionPointer >( ) , 168 ) ;
52
+ assert_eq ! ( size_of:: <GenericArg >( ) , 80 ) ;
53
+ assert_eq ! ( size_of:: <GenericArgs >( ) , 104 ) ;
54
+ assert_eq ! ( size_of:: <GenericBound >( ) , 72 ) ;
55
+ assert_eq ! ( size_of:: <GenericParamDef >( ) , 136 ) ;
56
+ assert_eq ! ( size_of:: <Impl >( ) , 304 ) ;
57
+ assert_eq ! ( size_of:: <Item >( ) , 552 ) ;
58
+ assert_eq ! ( size_of:: <ItemSummary >( ) , 32 ) ;
59
+ assert_eq ! ( size_of:: <PolyTrait >( ) , 64 ) ;
60
+ assert_eq ! ( size_of:: <PreciseCapturingArg >( ) , 32 ) ;
61
+ assert_eq ! ( size_of:: <TargetFeature >( ) , 80 ) ;
62
+ assert_eq ! ( size_of:: <Type >( ) , 80 ) ;
63
+ assert_eq ! ( size_of:: <WherePredicate >( ) , 160 ) ;
64
+ // tidy-alphabetical-end
65
+ }
0 commit comments