]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/pointee-deduction.rs
Rollup merge of #106321 - compiler-errors:delayed-bug-backtrace, r=Nilstrieb
[rust.git] / tests / ui / traits / pointee-deduction.rs
1 // run-pass
2
3 #![feature(ptr_metadata)]
4
5 use std::alloc::Layout;
6 use std::ptr::Pointee;
7
8 trait Foo {
9     type Bar;
10 }
11
12 impl Foo for () {
13     type Bar = ();
14 }
15
16 struct Wrapper1<T: Foo>(#[allow(unused_tuple_struct_fields)] <T as Foo>::Bar);
17 struct Wrapper2<T: Foo>(#[allow(unused_tuple_struct_fields)] <Wrapper1<T> as Pointee>::Metadata);
18
19 fn main() {
20     let _: Wrapper2<()> = Wrapper2(());
21     let _ = Layout::new::<Wrapper2<()>>();
22 }