summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/boxes.rs
blob: 90a8e33e8236b8c4eb901f3e769c0115a37e9df9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// unit-test: ConstProp
// compile-flags: -O
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

#![feature(rustc_attrs, stmt_expr_attributes)]

// Note: this test verifies that we, in fact, do not const prop `#[rustc_box]`

// EMIT_MIR boxes.main.ConstProp.diff
fn main() {
    // CHECK-LABEL: fn main(
    // CHECK: debug x => [[x:_.*]];
    // CHECK: (*{{_.*}}) = const 42_i32;
    // CHECK: [[tmp:_.*]] = (*{{_.*}});
    // CHECK: [[x]] = Add(move [[tmp]], const 0_i32);
    let x = *(#[rustc_box]
    Box::new(42))
        + 0;
}