Closed
Description
trait DynEq {}
impl<'a> PartialEq for &'a (dyn DynEq + 'static) {
fn eq(&self, _other: &Self) -> bool {
true
}
}
impl Eq for &dyn DynEq {}
Causes the following error:
error[E0308]: mismatched types
--> src/lib.rs:9:6
|
9 | impl Eq for &dyn DynEq {}
| ^^ lifetime mismatch
|
= note: expected type `std::cmp::PartialEq`
found type `std::cmp::PartialEq`
note: the lifetime `'_` as defined on the impl at 9:13...
--> src/lib.rs:9:13
|
9 | impl Eq for &dyn DynEq {}
| ^
= note: ...does not necessarily outlive the static lifetime
This is somewhat confusing, especially since std::cmp::PartialEq
is not a type.
This issue has been assigned to @ayrtonm via this comment.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: This is a bug.Diagnostics: A diagnostic that is giving misleading or incorrect information.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Relevant to the compiler team, which will review and decide on the PR/issue.