diff options
| author | Camelid <camelidcamel@gmail.com> | 2021-04-12 19:06:15 -0700 |
|---|---|---|
| committer | Camelid <camelidcamel@gmail.com> | 2021-05-11 09:55:31 -0700 |
| commit | 9859e2b01d2498ea0465a36bf4055d45e1f96f5b (patch) | |
| tree | 015eb43264bd0cec26e710e28a6e622030b53c90 /src/test/rustdoc | |
| parent | 20b30acfa856309857e8914fb2bb5f831e991d0b (diff) | |
| download | rust-9859e2b01d2498ea0465a36bf4055d45e1f96f5b.tar.gz rust-9859e2b01d2498ea0465a36bf4055d45e1f96f5b.zip | |
Add test for memory layout information
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/type-layout.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/rustdoc/type-layout.rs b/src/test/rustdoc/type-layout.rs new file mode 100644 index 00000000000..261f407a906 --- /dev/null +++ b/src/test/rustdoc/type-layout.rs @@ -0,0 +1,43 @@ +// @has type_layout/struct.Foo.html 'Size: ' +// @has - ' bytes' +pub struct Foo { + pub a: usize, + b: Vec<String>, +} + +// @has type_layout/enum.Bar.html 'Size: ' +// @has - ' bytes' +pub enum Bar<'a> { + A(String), + B(&'a str, (std::collections::HashMap<String, usize>, Foo)), +} + +// @has type_layout/union.Baz.html 'Size: ' +// @has - ' bytes' +pub union Baz { + a: &'static str, + b: usize, + c: &'static [u8], +} + +// @has type_layout/struct.X.html 'Size: ' +// @has - ' bytes' +pub struct X(usize); + +// @has type_layout/struct.Y.html 'Size: ' +// @has - ' byte' +// @!has - ' bytes' +pub struct Y(u8); + +// @!has type_layout/struct.Generic.html 'Size: ' +pub struct Generic<T>(T); + +// @has type_layout/struct.Unsized.html 'Size: ' +// @has - '(unsized)' +pub struct Unsized([u8]); + +// @!has type_layout/type.TypeAlias.html 'Size: ' +pub type TypeAlias = X; + +// @!has type_layout/trait.MyTrait.html 'Size: ' +pub trait MyTrait {} |
