Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9859e2b

Browse files
committed
Add test for memory layout information
1 parent 20b30ac commit 9859e2b

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/test/rustdoc/type-layout.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// @has type_layout/struct.Foo.html 'Size: '
2+
// @has - ' bytes'
3+
pub struct Foo {
4+
pub a: usize,
5+
b: Vec<String>,
6+
}
7+
8+
// @has type_layout/enum.Bar.html 'Size: '
9+
// @has - ' bytes'
10+
pub enum Bar<'a> {
11+
A(String),
12+
B(&'a str, (std::collections::HashMap<String, usize>, Foo)),
13+
}
14+
15+
// @has type_layout/union.Baz.html 'Size: '
16+
// @has - ' bytes'
17+
pub union Baz {
18+
a: &'static str,
19+
b: usize,
20+
c: &'static [u8],
21+
}
22+
23+
// @has type_layout/struct.X.html 'Size: '
24+
// @has - ' bytes'
25+
pub struct X(usize);
26+
27+
// @has type_layout/struct.Y.html 'Size: '
28+
// @has - ' byte'
29+
// @!has - ' bytes'
30+
pub struct Y(u8);
31+
32+
// @!has type_layout/struct.Generic.html 'Size: '
33+
pub struct Generic<T>(T);
34+
35+
// @has type_layout/struct.Unsized.html 'Size: '
36+
// @has - '(unsized)'
37+
pub struct Unsized([u8]);
38+
39+
// @!has type_layout/type.TypeAlias.html 'Size: '
40+
pub type TypeAlias = X;
41+
42+
// @!has type_layout/trait.MyTrait.html 'Size: '
43+
pub trait MyTrait {}

0 commit comments

Comments
 (0)