summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/pointee-deduction.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/pointee-deduction.rs')
-rw-r--r--tests/ui/traits/pointee-deduction.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/traits/pointee-deduction.rs b/tests/ui/traits/pointee-deduction.rs
new file mode 100644
index 000000000..c333b0129
--- /dev/null
+++ b/tests/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<()>>();
+}