- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.P-lowLow priorityLow priority
Description
Currently, E0221 can give an error like:
error[E0221]: ambiguous associated type `A` in bounds of `Self`
  --> src/test/compile-fail/E0221.rs:21:16
   |
21 |         let _: Self::A;
   |                ^^^^^^^ ambiguous associated type `A`
   |
note: associated type `Self` could derive from `Foo`
  --> src/test/compile-fail/E0221.rs:21:16
   |
21 |         let _: Self::A;
   |                ^^^^^^^
note: associated type `Self` could derive from `Bar`
  --> src/test/compile-fail/E0221.rs:21:16
   |
21 |         let _: Self::A;
   |                ^^^^^^^
This isn't terribly helpful. Ideally, we'd like to show where these associated types that cause ambiguity are coming from:
error[E0221]: ambiguous associated type `A` in bounds of `Self`
  --> src/test/compile-fail/E0221.rs:21:16
   |
15 |    type A: T1;
   |    ---------- ambiguous `A` from `Foo`
...
19 |    type A: T2;
   |    ---------- ambiguous `A` from `Bar`
20 |    fn do_something() {
21 |         let _: Self::A;
   |                ^^^^^^^ ambiguous associated type `A`
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.P-lowLow priorityLow priority