mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
29 lines
452 B
Rust
29 lines
452 B
Rust
//@ run-pass
|
|
#![allow(unused_variables)]
|
|
use std::marker::PhantomData;
|
|
|
|
struct TheType<T> {
|
|
t: PhantomData<T>
|
|
}
|
|
|
|
pub trait TheTrait {
|
|
type TheAssociatedType;
|
|
}
|
|
|
|
impl TheTrait for () {
|
|
type TheAssociatedType = ();
|
|
}
|
|
|
|
pub trait Shape<P: TheTrait> {
|
|
fn doit(&self) {
|
|
}
|
|
}
|
|
|
|
impl<P: TheTrait> Shape<P> for TheType<P::TheAssociatedType> {
|
|
}
|
|
|
|
fn main() {
|
|
let ball = TheType { t: PhantomData };
|
|
let handle: &dyn Shape<()> = &ball;
|
|
}
|