Open
Description
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=ed9fb2f62239c9485d43d48e3e0d419b
struct Foo(u32);
impl std::cmp::PartialEq for Foo {
fn eq(&self, rhs: &Self) -> bool {
self == rhs
}
}
The current output is:
(no warnings)
Ideally the output should look like:
warning: function cannot return without recursing
--> src/lib.rs:4:5
|
4 | fn eq(&self, rhs: &Self) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
5 | self == rhs
| ----------- recursive call site
|
= note: `#[warn(unconditional_recursion)]` on by default
= help: a `loop` may express intention better if this is on purpose
Note how we do warn about this if you do self.eq(rhs)
. So I guess it's a matter of treating ==
as .eq
for the purposes of recursion checking? Not sure.
Happens on nightly/beta/stable.