Skip to content

Unhelpful error with "overlapping" never applicable impls #50715

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
matthewjasper opened this issue May 13, 2018 · 1 comment
Open

Unhelpful error with "overlapping" never applicable impls #50715

matthewjasper opened this issue May 13, 2018 · 1 comment
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@matthewjasper
Copy link
Contributor

matthewjasper commented May 13, 2018

These two implementations are overlapping (it's allowed to write where for<'a> M: B<'a> even when M doesn't implent B<'a>) but the error doesn't say this.

trait A { /* ... */ }
trait B<'a> {}

struct M;

impl A for M where for<'a> M: B<'a> { /* ... */ }
impl A for M where for<'a> M: B<'a> { /* ... */ }

fn main() {}

Compiler output:

   Compiling playground v0.0.1 (file:///playground)
error[E0283]: type annotations required: cannot resolve `M: A`
 --> src/main.rs:8:6
  |
8 | impl A for M where for<'a> M: B<'a> {}
  |      ^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.

cc #48214 which will make this issue easier to come across.

@matthewjasper matthewjasper added the A-trait-system Area: Trait system label May 13, 2018
@XAMPPRocky XAMPPRocky added T-lang Relevant to the language team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Oct 2, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants
@XAMPPRocky @matthewjasper and others