Description
This bug has already been identified but I wanted to open an issue for it.
The following code should print I've been dropped
first. (playground)
#![feature(let_else)]
#[derive(Default)]
struct Droppy { inner: u32 }
impl Drop for Droppy {
fn drop(&mut self) {
println!("I've been dropped");
}
}
fn main() {
let 0 = Droppy::default().inner else { return };
println!("Should have dropped 👆");
}
I believe there is an unanswered question: Should temporaries be dropped before the else
block?
let 1 = Droppy::default().inner else {
println!("Should have dropped?????");
return;
};
@nikomatsakis said this issue is being investigated at #93628 (comment).
This issue has been assigned to @dingxiangfei2009 via this comment.