mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
30 lines
583 B
Rust
30 lines
583 B
Rust
// check-pass
|
|
// edition:2018
|
|
|
|
#![feature(ptr_metadata)]
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
type Opaque = impl std::future::Future;
|
|
|
|
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() {}
|