1 // compile-flags: --show-type-layout -Z unstable-options
3 // @hasraw type_layout/struct.Foo.html 'Size: '
5 // @has - '//*[@id="layout"]/a[@href="#layout"]' ''
11 // @hasraw type_layout/enum.Bar.html 'Size: '
15 B(&'a str, (std::collections::HashMap<String, usize>, Foo)),
18 // @hasraw type_layout/union.Baz.html 'Size: '
26 // @hasraw type_layout/struct.X.html 'Size: '
30 // @hasraw type_layout/struct.Y.html 'Size: '
32 // @!hasraw - ' bytes'
35 // @hasraw type_layout/struct.Z.html 'Size: '
36 // @hasraw - '0 bytes'
39 // We can't compute layout for generic types.
40 // @hasraw type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters'
41 // @!hasraw - 'Size: '
42 pub struct Generic<T>(T);
44 // We *can*, however, compute layout for types that are only generic over lifetimes,
45 // because lifetimes are a type-system construct.
46 // @hasraw type_layout/struct.GenericLifetimes.html 'Size: '
48 pub struct GenericLifetimes<'a>(&'a str);
50 // @hasraw type_layout/struct.Unsized.html 'Size: '
51 // @hasraw - '(unsized)'
52 pub struct Unsized([u8]);
54 // @hasraw type_layout/type.TypeAlias.html 'Size: '
56 pub type TypeAlias = X;
58 // @hasraw type_layout/type.GenericTypeAlias.html 'Size: '
59 // @hasraw - '8 bytes'
60 pub type GenericTypeAlias = (Generic<(u32, ())>, Generic<u32>);
62 // Regression test for the rustdoc equivalent of #85103.
63 // @hasraw type_layout/type.Edges.html 'Encountered an error during type layout; the type failed to be normalized.'
64 pub type Edges<'a, E> = std::borrow::Cow<'a, [E]>;
66 // @!hasraw type_layout/trait.MyTrait.html 'Size: '
69 // @hasraw type_layout/enum.Variants.html 'Size: '
70 // @hasraw - '2 bytes'
71 // @hasraw - '<code>A</code>: 0 bytes'
72 // @hasraw - '<code>B</code>: 1 byte'
78 // @hasraw type_layout/enum.WithNiche.html 'Size: '
79 // @has - //p '4 bytes'
80 // @hasraw - '<code>None</code>: 0 bytes'
81 // @hasraw - '<code>Some</code>: 4 bytes'
84 Some(std::num::NonZeroU32),