rust/tests/ui/borrowck/borrowck-ref-mut-of-imm.rs
2023-01-11 09:32:08 +00:00

11 lines
193 B
Rust

fn destructure(x: Option<isize>) -> isize {
match x {
None => 0,
Some(ref mut v) => *v //~ ERROR cannot borrow
}
}
fn main() {
assert_eq!(destructure(Some(22)), 22);
}