mirror of
https://github.com/rust-lang/rust
synced 2024-09-05 16:57:03 +00:00
22 lines
273 B
Rust
22 lines
273 B
Rust
//@ run-pass
|
|
#![feature(arbitrary_self_types)]
|
|
|
|
struct Foo;
|
|
struct Bar;
|
|
|
|
impl std::ops::Deref for Bar {
|
|
type Target = Foo;
|
|
|
|
fn deref(&self) -> &Foo {
|
|
&Foo
|
|
}
|
|
}
|
|
|
|
impl Foo {
|
|
fn bar(self: Bar) -> i32 { 3 }
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(3, Bar.bar());
|
|
}
|