summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/pointee-deduction.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/traits/pointee-deduction.rs')
-rw-r--r--src/test/ui/traits/pointee-deduction.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/traits/pointee-deduction.rs b/src/test/ui/traits/pointee-deduction.rs
new file mode 100644
index 000000000..c333b0129
--- /dev/null
+++ b/src/test/ui/traits/pointee-deduction.rs
@@ -0,0 +1,22 @@
+// run-pass
+
+#![feature(ptr_metadata)]
+
+use std::alloc::Layout;
+use std::ptr::Pointee;
+
+trait Foo {
+ type Bar;
+}
+
+impl Foo for () {
+ type Bar = ();
+}
+
+struct Wrapper1<T: Foo>(#[allow(unused_tuple_struct_fields)] <T as Foo>::Bar);
+struct Wrapper2<T: Foo>(#[allow(unused_tuple_struct_fields)] <Wrapper1<T> as Pointee>::Metadata);
+
+fn main() {
+ let _: Wrapper2<()> = Wrapper2(());
+ let _ = Layout::new::<Wrapper2<()>>();
+}