rust/src/test/run-pass/borrowck-preserve-box-sometimes-needed.rs

14 lines
223 B
Rust
Raw Normal View History

// exec-env:RUST_POISON_ON_FREE=1
2012-08-20 14:23:37 -05:00
fn switcher(x: Option<@int>) {
let mut x = x;
2012-08-06 14:34:08 -05:00
match x {
2012-08-20 14:23:37 -05:00
Some(@y) => { copy y; x = None; }
None => { }
}
}
fn main() {
2012-08-20 14:23:37 -05:00
switcher(None);
switcher(Some(@3));
}