Closed
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.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Trait systemCategory: This is a bug.Diagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: Too much output caused by a single piece of incorrect code.Relevant to the compiler team, which will review and decide on the PR/issue.