Closed
Description
Code
I tried this code which causes a stack overflow due to a recursive call of Default::default()
I mistakenly added.
struct S {
x: i32,
y: i32,
}
fn f() -> i32 {
42
}
impl Default for S {
fn default() -> S {
S {
x: f(),
..Default::default() // cause stack overflow
}
}
}
fn main() {
let _ = S::default();
}
I expected to see the unconditional_recursion
warning. However, the compiler didn't complain it.
Version it worked on
It most recently worked on: 1.43.0 showed the warning. (ref. the compiler explorer)
Version with regression
The warning isn't shown on 1.44.0 or later, including the current stable 1.47.0.