Skip to content

"ambiguous associated type" when there's not ambiguity #50905

Closed
@stepancheg

Description

@stepancheg
trait Bar {
    type Baz;
}

trait Foo {
    type Bar : Bar;
}

fn _qux<F : Foo>(param: F::Bar::Baz) {}


fn main(){
}
error[E0223]: ambiguous associated type
 --> src/main.rs:9:25
  |
9 | fn _qux<F : Foo>(param: F::Bar::Baz) {}
  |                         ^^^^^^^^^^^ ambiguous associated type
  |
  = note: specify the type using the syntax `<<F as Foo>::Bar as Trait>::Baz`

For me it looks like there's no ambiguity here: Foo has only one Bar and Bar has only one Baz.

https://play.rust-lang.org/?gist=347da3f223a841b8ee96ee4a744ba180&version=nightly&mode=debug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions