about summary refs log tree commit diff
path: root/tests/ui/feature-gates/feature-gate-sized-hierarchy.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/feature-gates/feature-gate-sized-hierarchy.rs')
-rw-r--r--tests/ui/feature-gates/feature-gate-sized-hierarchy.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/feature-gates/feature-gate-sized-hierarchy.rs b/tests/ui/feature-gates/feature-gate-sized-hierarchy.rs
new file mode 100644
index 00000000000..33688c2e2ce
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-sized-hierarchy.rs
@@ -0,0 +1,29 @@
+#![feature(extern_types)]
+#![feature(sized_hierarchy)]
+
+use std::marker::{MetaSized, PointeeSized};
+
+fn needs_pointeesized<T: PointeeSized>() {}
+fn needs_metasized<T: MetaSized>() {}
+fn needs_sized<T: Sized>() {}
+
+fn main() {
+    needs_pointeesized::<u8>();
+    needs_metasized::<u8>();
+    needs_sized::<u8>();
+
+    needs_pointeesized::<str>();
+    needs_metasized::<str>();
+    needs_sized::<str>();
+//~^ ERROR the size for values of type `str` cannot be known at compilation time
+
+    extern "C" {
+        type Foo;
+    }
+
+    needs_pointeesized::<Foo>();
+    needs_metasized::<Foo>();
+//~^ ERROR the size for values of type `main::Foo` cannot be known
+    needs_sized::<Foo>();
+//~^ ERROR the size for values of type `main::Foo` cannot be known at compilation time
+}