rust has this:
fn thing(x: i32) -> i32 {
return thing(x) + thing(x);
}
fn main() {
thing(0);
}
warning: function cannot return without recurring
--> test.rs:1:1
|
1 | / fn thing(x: i32) -> i32 {
2 | | return thing(x) + thing(x);
3 | | }
| |_^
|
= note: #[warn(unconditional_recursion)] on by default
note: recursive call site
--> test.rs:2:12
|
2 | return thing(x) + thing(x);
| ^^^^^^^^
= help: a `loop` may express intention better if this is on purpose
It's a pretty nice compiler error. We should have it too.
rust has this:
It's a pretty nice compiler error. We should have it too.