mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
20 lines
296 B
Rust
20 lines
296 B
Rust
//@ run-pass
|
|
trait Device {
|
|
type Resources;
|
|
}
|
|
#[allow(dead_code)]
|
|
struct Foo<D, R>(D, R);
|
|
|
|
impl<D: Device> Foo<D, D::Resources> {
|
|
fn present(&self) {}
|
|
}
|
|
|
|
struct Res;
|
|
struct Dev;
|
|
|
|
impl Device for Dev { type Resources = Res; }
|
|
|
|
fn main() {
|
|
let foo = Foo(Dev, Res);
|
|
foo.present();
|
|
}
|