Skip to content

Commit 6dc4bc5

Browse files
committed
test for troublesome case where preserve was freeing uninitialized memory
1 parent 862976c commit 6dc4bc5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// xfail-fast (compile-flags unsupported on windows)
2+
// compile-flags:--borrowck=err
3+
// exec-env:RUST_POISON_ON_FREE=1
4+
5+
fn switcher(x: option<@int>) {
6+
let mut x = x;
7+
alt x {
8+
some(@y) { copy y; x = none; }
9+
none { }
10+
}
11+
}
12+
13+
fn main() {
14+
switcher(none);
15+
switcher(some(@3));
16+
}

0 commit comments

Comments
 (0)