blob: 5deec77a225bc0c6764de284c9ad892e4bee2b58 [file] [log] [blame] [edit]
//@ build-pass
#![allow(function_casts_as_integer)]
trait Supertrait<T> {
fn method(&self) {}
}
impl<T> Supertrait<T> for () {}
trait WithAssoc {
type Assoc;
}
trait Trait<P: WithAssoc>: Supertrait<P::Assoc> + Supertrait<()> {}
fn upcast<P>(x: &dyn Trait<P>) -> &dyn Supertrait<()> {
x
}
fn call<P>(x: &dyn Trait<P>) {
x.method();
}
fn main() {
println!("{:p}", upcast::<()> as *const ());
println!("{:p}", call::<()> as *const ());
}