rust/tests/mir-opt/box_expr.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
355 B
Rust
Raw Normal View History

// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(rustc_attrs, stmt_expr_attributes)]
2020-07-27 19:22:43 +00:00
// EMIT_MIR box_expr.main.ElaborateDrops.before.mir
fn main() {
let x = #[rustc_box]
Box::new(S::new());
drop(x);
}
struct S;
impl S {
fn new() -> Self {
S
}
}
impl Drop for S {
fn drop(&mut self) {
println!("splat!");
}
}