Skip to content

Commit 9f9f7f6

Browse files
Ensure that MaybeLiveLocals works with simple sum-type assignments
1 parent 02c2a35 commit 9f9f7f6

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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() -> Option<i32> {
7+
let mut x = None;
8+
9+
// `x` is live here since it is used in the next statement...
10+
rustc_peek(x);
11+
12+
dbg!(x);
13+
14+
// But not here, since it is overwritten below
15+
rustc_peek(x); //~ ERROR rustc_peek: bit not set
16+
17+
x = Some(4);
18+
19+
x
20+
}
21+
22+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: rustc_peek: bit not set
2+
--> $DIR/liveness-enum.rs:15:5
3+
|
4+
LL | rustc_peek(x);
5+
| ^^^^^^^^^^^^^
6+
7+
error: stop_after_dataflow ended compilation
8+
9+
error: aborting due to 2 previous errors
10+

0 commit comments

Comments
 (0)