mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
21 lines
397 B
Rust
21 lines
397 B
Rust
//
|
|
// 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
|
|
}
|