-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
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.
ShikChen, jynnantonix, ChriFo, ISibboI, ChayimFriedman2 and 3 more
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.