Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed Jan 25, 2024
1 parent 42d13f8 commit 87a6300
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/ui/unconditional_recursion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,30 @@ mod issue12154 {
*other == *self
}
}

// Issue #12181 but also fixed by the same PR
struct Foo;

impl Foo {
fn as_str(&self) -> &str {
"Foo"
}
}

impl PartialEq for Foo {
fn eq(&self, other: &Self) -> bool {
self.as_str().eq(other.as_str())
}
}

impl<T> PartialEq<T> for Foo
where
for<'a> &'a str: PartialEq<T>,
{
fn eq(&self, other: &T) -> bool {
(&self.as_str()).eq(other)
}
}
}

fn main() {}

0 comments on commit 87a6300

Please sign in to comment.