2023-10-16 12:36:39 -05:00
|
|
|
// skip-filecheck
|
2023-06-08 02:18:34 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2024-04-20 06:19:34 -05:00
|
|
|
//@ test-mir-pass: CopyProp
|
2023-01-31 11:16:16 -06:00
|
|
|
|
|
|
|
// EMIT_MIR issue_107511.main.CopyProp.diff
|
|
|
|
fn main() {
|
|
|
|
let mut sum = 0;
|
|
|
|
let a = [0, 10, 20, 30];
|
|
|
|
|
|
|
|
// `i` is assigned in a loop. Only removing its `StorageDead` would mean that
|
|
|
|
// execution sees repeated `StorageLive`. This would be UB.
|
|
|
|
for i in 0..a.len() {
|
|
|
|
sum += a[i];
|
|
|
|
}
|
|
|
|
}
|