mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
17 lines
256 B
Rust
17 lines
256 B
Rust
#![feature(arbitrary_self_types)]
|
|
|
|
use std::ops::Deref;
|
|
|
|
struct Foo(u32);
|
|
impl Foo {
|
|
fn get<R: Deref<Target=Self>>(self: R) -> u32 {
|
|
self.0
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let mut foo = Foo(1);
|
|
foo.get::<&Foo>();
|
|
//~^ ERROR mismatched types
|
|
}
|