about summary refs log tree commit diff
path: root/tests/ui/traits/pointee-deduction.rs
blob: 541daf230878213bd4c48545542cd73fff6fc81c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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(dead_code)] <T as Foo>::Bar);
struct Wrapper2<T: Foo>(#[allow(dead_code)] <Wrapper1<T> as Pointee>::Metadata);

fn main() {
    let _: Wrapper2<()> = Wrapper2(());
    let _ = Layout::new::<Wrapper2<()>>();
}