about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/storage-live-dead-var.rs
blob: 83ab98d79d1a1ccd4cc28f574c90a58a0f669473 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![feature(core_intrinsics, custom_mir)]
use std::intrinsics::mir::*;

#[custom_mir(dialect = "runtime")]
fn main() {
    mir! {
        let val: i32;
        {
            val = 42; //~ERROR: accessing a dead local variable
            StorageLive(val); // too late... (but needs to be here to make `val` not implicitly live)
            Return()
        }
    }
}