mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
19 lines
202 B
Rust
19 lines
202 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();
|
|
}
|