Open
Description
STR
struct NoisyDrop;
impl Drop for NoisyDrop {
fn drop(&mut self) {
println!("dropping a NoisyDrop");
}
}
impl NoisyDrop {
fn new() -> Self {
println!("creating a NoisyDrop");
NoisyDrop
}
}
struct PanickyDrop;
impl Drop for PanickyDrop {
fn drop(&mut self) {
panic!()
}
}
fn foo() -> NoisyDrop {
let p = PanickyDrop;
NoisyDrop::new()
}
fn main() {
foo();
}
Expected Result
"creating a NoisyDrop" and "dropping a NoisyDrop" should appear the same number of times
Actual Result
creating a NoisyDrop
thread 'main' panicked at 'explicit panic', src/main.rs:18:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
The destructor is ignored.
Metadata
Metadata
Assignees
Labels
Area: Destructors (`Drop`, …)Category: An issue proposing an enhancement or a PR with one.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.Relevant to the language team, which will review and decide on the PR/issue.