Skip to content

E0034 should provide the disambiguated syntax for the candidates #37767

Closed

Description

@gnzlbg

Currently, with the following code:

trait A { fn foo(&self) {} }
trait B : A { fn foo(&self) {} }

fn bar<T: B>(a: &T) {
  a.foo()
}

fn main() {}

prints the following error message:

error[E0034]: multiple applicable items in scope
 --> <anon>:5:5
  |
5 |   a.foo()
  |     ^^^ multiple `foo` found
  |
note: candidate #1 is defined in the trait `A`
 --> <anon>:1:11
  |
1 | trait A { fn foo(&self) {} }
  |           ^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `B`
 --> <anon>:2:15
  |
2 | trait B : A { fn foo(&self) {} }
  |               ^^^^^^^^^^^^^^^^

error: aborting due to previous error

It would be nice if it would tell me what exactly do I need to type in order to choose candidate 1 or candidate 2. In particular, when associated types, Input/Output parameters, ... are involved, the disambiguation syntax can be tricky.

Activity

  1. added a commit that references this issue on Jan 18, 2017
    c8af93f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions