summaryrefslogtreecommitdiffstats
path: root/tests/ui/self/arbitrary-self-from-method-substs.rs
blob: 004445dc327231fd12963d7b71fa96fbc74232ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// revisions: default feature
#![cfg_attr(feature, feature(arbitrary_self_types))]

use std::ops::Deref;

struct Foo(u32);
impl Foo {
    fn get<R: Deref<Target = Self>>(self: R) -> u32 {
        //[default]~^ ERROR: `R` cannot be used as the type of `self`
        self.0
    }
}

fn main() {
    let mut foo = Foo(1);
    foo.get::<&Foo>();
    //[feature]~^ ERROR mismatched types
}