rust/tests/ui/traits/new-solver/pointee.rs

24 lines
572 B
Rust
Raw Normal View History

2023-01-24 17:24:25 -06:00
// compile-flags: -Ztrait-solver=next
// check-pass
#![feature(ptr_metadata)]
use std::ptr::{DynMetadata, Pointee};
trait Trait<U> {}
struct MyDst<T: ?Sized>(T);
fn works<T>() {
let _: <T as Pointee>::Metadata = ();
let _: <[T] as Pointee>::Metadata = 1_usize;
let _: <str as Pointee>::Metadata = 1_usize;
let _: <dyn Trait<T> as Pointee>::Metadata = give::<DynMetadata<dyn Trait<T>>>();
let _: <MyDst<T> as Pointee>::Metadata = ();
let _: <((((([u8],),),),),) as Pointee>::Metadata = 1_usize;
}
fn give<U>() -> U {
loop {}
}
fn main() {}