summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/box_expr.rs
blob: 780420bda9fcae682828b3dfc4c1b9887856aa0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

#![feature(rustc_attrs, stmt_expr_attributes)]

// 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!");
    }
}