mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
18 lines
203 B
Rust
18 lines
203 B
Rust
//@ run-pass
|
|
struct A(B);
|
|
struct B;
|
|
|
|
use std::ops::Deref;
|
|
|
|
impl Deref for A {
|
|
type Target = B;
|
|
fn deref(&self) -> &B { &self.0 }
|
|
}
|
|
|
|
impl B {
|
|
fn foo(&self) {}
|
|
}
|
|
|
|
fn main() {
|
|
A(B).foo();
|
|
}
|