struct Foo(bool);
impl Drop for Foo {
fn drop(&mut self) {
if self.0 {
return;
}
panic!("dead");
}
}
pub fn foo() {
let a = Foo(true);
unsafe {unknown(9);}
}
extern "Rust" {
fn unknown(x: i32) -> bool;
}
https://rust.godbolt.org/z/zzoee9z1W
Removing either the drop panic or the unknown call enables full optimizations, the but their combination does not.
https://rust.godbolt.org/z/zzoee9z1W
Removing either the drop panic or the unknown call enables full optimizations, the but their combination does not.