-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.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.
Description
The following code:
trait Foo {
fn my_method() where Self: Clone;
}
fn main() {
<bool as Foo>::my_method();
}
produces the following output:
error[E0277]: the trait bound `bool: Foo` is not satisfied
--> src/main.rs:6:5
|
2 | fn my_method() where Self: Clone;
| ----- required by this bound in `Foo::my_method`
...
6 | <bool as Foo>::my_method();
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `bool`
error: aborting due to previous error
The root cause of the error is the fact that bool
does not implement Foo
, so the Self: Clone
bound isn't relevant. If the where
clause is split over multiple lines, then this can obscure the actual cause of the error.
Poopooracoocoo, estebank and osa1
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.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.