Add test for memory layout information

This commit is contained in:
Camelid 2021-04-12 19:06:15 -07:00
parent 20b30acfa8
commit 9859e2b01d
1 changed files with 43 additions and 0 deletions

View File

@ -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 {}