rust/tests/ui/borrowck/borrowck-ref-mut-of-imm.rs

11 lines
193 B
Rust
Raw Normal View History

fn destructure(x: Option<isize>) -> isize {
match x {
2012-08-20 14:23:37 -05:00
None => 0,
2013-03-15 14:24:24 -05:00
Some(ref mut v) => *v //~ ERROR cannot borrow
}
}
fn main() {
assert_eq!(destructure(Some(22)), 22);
}