Closed
Description
I tried this code:
#[derive(Default)]
pub struct Run {
pub a: bool,
pub b: bool,
pub c: Option<String>,
}
impl Run {
pub fn run(&mut self) {
if !self.a && !self.b {
self.run();
}
}
}
pub fn foo() -> Run {
let mut run = Run::default();
run.a = false;
run.b = false;
run.run();
run
}
I expected to see this happen: foo
runs infinitely
Instead, this happened: foo
return directly
The opt-level
is set to z
: https://rust.godbolt.org/z/n1v471j6E
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Category: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessHigh priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.