about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/rustdoc/type-layout.rs43
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 {}