[unconditional_recursion
]: compare by types instead of DefId
s
This commit is contained in:
parent
66c29b973b
commit
42d13f8eb0
2 changed files with 82 additions and 39 deletions
|
@ -288,4 +288,39 @@ impl PartialEq for S15<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
mod issue12154 {
|
||||
struct MyBox<T>(T);
|
||||
|
||||
impl<T> std::ops::Deref for MyBox<T> {
|
||||
type Target = T;
|
||||
fn deref(&self) -> &T {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PartialEq> PartialEq for MyBox<T> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
(**self).eq(&**other)
|
||||
}
|
||||
}
|
||||
|
||||
// Not necessarily related to the issue but another FP from the http crate that was fixed with it:
|
||||
// https://docs.rs/http/latest/src/http/header/name.rs.html#1424
|
||||
// We used to simply peel refs from the LHS and RHS, so we couldn't differentiate
|
||||
// between `PartialEq<T> for &T` and `PartialEq<&T> for T` impls.
|
||||
#[derive(PartialEq)]
|
||||
struct HeaderName;
|
||||
impl<'a> PartialEq<&'a HeaderName> for HeaderName {
|
||||
fn eq(&self, other: &&'a HeaderName) -> bool {
|
||||
*self == **other
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> PartialEq<HeaderName> for &'a HeaderName {
|
||||
fn eq(&self, other: &HeaderName) -> bool {
|
||||
*other == *self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue