]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mir-dataflow/liveness-ptr.rs
Sync portable-simd to rust-lang/portable-simd@72df4c45056a8bc0d1b3f06fdc828722177f0763
[rust.git] / src / test / ui / mir-dataflow / liveness-ptr.rs
1 #![feature(core_intrinsics, rustc_attrs)]
2
3 use std::intrinsics::rustc_peek;
4
5 #[rustc_mir(rustc_peek_liveness, stop_after_dataflow)]
6 fn foo() -> i32 {
7     let mut x: i32;
8     let mut p: *const i32;
9
10     x = 0;
11
12     // `x` is live here since it is used in the next statement...
13     rustc_peek(x);
14
15     p = &x;
16
17     // ... but not here, even while it can be accessed through `p`.
18     rustc_peek(x); //~ ERROR rustc_peek: bit not set
19     let tmp = unsafe { *p };
20
21     x = tmp + 1;
22
23     rustc_peek(x);
24
25     x
26 }
27
28 fn main() {}