1 // compile-flags: --show-type-layout -Z unstable-options
3 // @has type_layout/struct.Foo.html 'Size: '
10 // @has type_layout/enum.Bar.html 'Size: '
14 B(&'a str, (std::collections::HashMap<String, usize>, Foo)),
17 // @has type_layout/union.Baz.html 'Size: '
25 // @has type_layout/struct.X.html 'Size: '
29 // @has type_layout/struct.Y.html 'Size: '
34 // @has type_layout/struct.Z.html 'Size: '
38 // We can't compute layout for generic types.
39 // @has type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters'
41 pub struct Generic<T>(T);
43 // We *can*, however, compute layout for types that are only generic over lifetimes,
44 // because lifetimes are a type-system construct.
45 // @has type_layout/struct.GenericLifetimes.html 'Size: '
47 pub struct GenericLifetimes<'a>(&'a str);
49 // @has type_layout/struct.Unsized.html 'Size: '
51 pub struct Unsized([u8]);
53 // @!has type_layout/trait.MyTrait.html 'Size: '
56 // @has type_layout/enum.Variants.html 'Size: '
58 // @has - '<code>A</code>: 0 bytes'
59 // @has - '<code>B</code>: 1 byte'
65 // @has type_layout/enum.WithNiche.html 'Size: '
66 // @has - //p '4 bytes'
67 // @has - '<code>None</code>: 0 bytes'
68 // @has - '<code>Some</code>: 4 bytes'
71 Some(std::num::NonZeroU32),