-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
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-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-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.
Description
I tried this code:
#[derive(Debug)]
struct Foo {
bar: u32
}
impl Default for Foo {
fn default()-> Self {
Self {
..Default::default()
}
}
}
fn main() {
println!("{:?}",Foo::default());
}
I expected to see this happen: Default values for each field
Instead, this happened: Infinite recursion and stack overflow
Discussion
I know that what I was trying to do is not a supported syntax, but the overflow can be hard to debug and the warning is not super clear.
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-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-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.