File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 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+ unsafe { rustc_peek ( x) ; }
14+
15+ p = & x;
16+
17+ // ... but not here, even while it can be accessed through `p`.
18+ unsafe { rustc_peek ( x) ; } //~ ERROR rustc_peek: bit not set
19+ let tmp = unsafe { * p } ;
20+
21+ x = tmp + 1 ;
22+
23+ unsafe { rustc_peek ( x) ; }
24+
25+ x
26+ }
27+
28+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: rustc_peek: bit not set
2+ --> $DIR/liveness-ptr.rs:18:14
3+ |
4+ LL | unsafe { rustc_peek(x); }
5+ | ^^^^^^^^^^^^^
6+
7+ error: stop_after_dataflow ended compilation
8+
9+ error: aborting due to 2 previous errors
10+
You can’t perform that action at this time.
0 commit comments