2023-09-20 21:43:33 +00:00
|
|
|
// unit-test: GVN
|
2020-05-06 19:28:48 +02:00
|
|
|
|
2023-12-02 20:50:00 +00:00
|
|
|
// Verify that we do not propagate the contents of this mutable static.
|
2022-12-22 16:33:12 +01:00
|
|
|
static mut STATIC: u32 = 0x42424242;
|
2020-05-06 19:28:48 +02:00
|
|
|
|
2023-09-20 21:43:33 +00:00
|
|
|
// EMIT_MIR mutable_variable_no_prop.main.GVN.diff
|
2020-05-06 19:28:48 +02:00
|
|
|
fn main() {
|
2023-12-02 20:50:00 +00:00
|
|
|
// CHECK-LABEL: fn main(
|
|
|
|
// CHECK: debug x => [[x:_.*]];
|
|
|
|
// CHECK: debug y => [[y:_.*]];
|
|
|
|
// CHECK: [[x]] = const 42_u32;
|
|
|
|
// CHECK: [[tmp:_.*]] = (*{{_.*}});
|
|
|
|
// CHECK: [[x]] = move [[tmp]];
|
|
|
|
// CHECK: [[y]] = [[x]];
|
2020-05-06 19:28:48 +02:00
|
|
|
let mut x = 42;
|
|
|
|
unsafe {
|
|
|
|
x = STATIC;
|
|
|
|
}
|
|
|
|
let y = x;
|
|
|
|
}
|