summaryrefslogtreecommitdiffstats
path: root/tests/ui/self/self-impl.rs
blob: ed250ce522f404efe04413554830684e100120c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Test that unsupported uses of `Self` in impls don't crash

struct Bar;

trait Foo {
    type Baz;
}

trait SuperFoo {
    type SuperBaz;
}

impl Foo for Bar {
    type Baz = bool;
}

impl SuperFoo for Bar {
    type SuperBaz = bool;
}

impl Bar {
    fn f() {
        let _: <Self>::Baz = true;
        //~^ ERROR ambiguous associated type
        let _: Self::Baz = true;
        //~^ ERROR ambiguous associated type
    }
}

fn main() {}