-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Diagnostic forgets about transitive trait bounds when there are multiple candidate impls. #90665
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-specializationArea: Trait impl specializationArea: Trait impl specializationA-trait-systemArea: Trait systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.F-rustc_attrsInternal rustc attributes gated on the `#[rustc_attrs]` feature gate.Internal rustc attributes gated on the `#[rustc_attrs]` feature gate.F-specialization`#![feature(specialization)]``#![feature(specialization)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-specializationArea: Trait impl specializationArea: Trait impl specializationA-trait-systemArea: Trait systemArea: Trait systemD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.F-rustc_attrsInternal rustc attributes gated on the `#[rustc_attrs]` feature gate.Internal rustc attributes gated on the `#[rustc_attrs]` feature gate.F-specialization`#![feature(specialization)]``#![feature(specialization)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Type
Fields
Give feedbackNo fields configured for issues without a type.
EDIT this was originally reported as a problem specific to auto-traits, but I don't think it actually is. See the comment below.
EDIT 2: It's actually not specific to specialization either. See this comment
This is spun off from #90601.
Given the following code (playground):
The current (good) output is:
But if you add a specialized impl of
Foo(playground):Then the error message loses all of the information regarding the unimplemented auto trait:
So there is something about the presence of a specialized impl that causes trait selection to not know that there's an unimplemented auto trait obligation. I have confirmed this by exploring the debug logging of rustc a little bit:
If you take a look at Example 4 in #90601, you can see that this can result in detrimentally unhelpful error messages in more complex cases.
cc #13231 #31844 #68970
@rustbot label +A-specialization +A-traits +D-confusing +D-terse +F-auto_traits +F-specialization