diff options
Diffstat (limited to 'tests/ui/self/arbitrary-self-from-method-substs.rs')
-rw-r--r-- | tests/ui/self/arbitrary-self-from-method-substs.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/self/arbitrary-self-from-method-substs.rs b/tests/ui/self/arbitrary-self-from-method-substs.rs new file mode 100644 index 000000000..0f911a208 --- /dev/null +++ b/tests/ui/self/arbitrary-self-from-method-substs.rs @@ -0,0 +1,16 @@ +#![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 +} |