summaryrefslogtreecommitdiffstats
path: root/tests/ui/associated-item/associated-item-duplicate-names-3.rs
blob: 3a70a2f943ffd5822c62fd4362c3be5480cfc718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//
// Before the introduction of the "duplicate associated type" error, the
// program below used to result in the "ambiguous associated type" error E0223,
// which is unexpected.

trait Foo {
    type Bar;
}

struct Baz;

impl Foo for Baz {
    type Bar = i16;
    type Bar = u16; //~ ERROR duplicate definitions
}

fn main() {
    let x: Baz::Bar = 5;
    //~^ ERROR ambiguous associated type
}