rust/tests/mir-opt/const_prop/boxes.rs

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

20 lines
487 B
Rust
Raw Normal View History

2023-09-20 16:43:33 -05:00
//@ unit-test: GVN
2019-09-15 11:03:52 -05:00
//@ compile-flags: -O
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2019-09-15 11:03:52 -05:00
#![feature(rustc_attrs, stmt_expr_attributes)]
2019-09-15 11:03:52 -05:00
// Note: this test verifies that we, in fact, do not const prop `#[rustc_box]`
2019-09-15 11:03:52 -05:00
2023-09-20 16:43:33 -05:00
// EMIT_MIR boxes.main.GVN.diff
2019-09-15 11:03:52 -05:00
fn main() {
2023-12-02 14:18:21 -06:00
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
// CHECK: (*{{_.*}}) = const 42_i32;
// CHECK: [[tmp:_.*]] = (*{{_.*}});
2023-03-20 16:37:36 -05:00
// CHECK: [[x]] = [[tmp]];
let x = *(#[rustc_box]
Box::new(42))
+ 0;
2019-09-15 11:03:52 -05:00
}