about summary refs log tree commit diff
path: root/tests/ui/traits/pointee-tail-is-generic.rs
blob: b41fb61e4a4ab15876d3cd4863c46d475d6130f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//@ check-pass
//@ edition:2018

#![feature(ptr_metadata)]
#![feature(type_alias_impl_trait)]

pub type Opaque = impl std::future::Future;

#[define_opaque(Opaque)]
fn opaque() -> Opaque {
    async {}
}

fn a<T>() {
    // type parameter T is known to be sized
    is_thin::<T>();
    // tail of ADT (which is a type param) is known to be sized
    is_thin::<std::cell::Cell<T>>();
    // opaque type is known to be sized
    is_thin::<Opaque>();
}

fn a2<T: Iterator>() {
    // associated type is known to be sized
    is_thin::<T::Item>();
}

fn is_thin<T: std::ptr::Pointee<Metadata = ()>>() {}

fn main() {}