]>
Commit | Line | Data |
---|---|---|
223e47cc | 1 | fn main() { |
1a4d82fc | 2 | let mut x: Option<isize> = None; |
970d7e83 LB |
3 | match x { |
4 | None => { | |
5 | // Note: on this branch, no borrow has occurred. | |
6 | x = Some(0); | |
7 | } | |
223e47cc | 8 | Some(ref i) => { |
970d7e83 | 9 | // But on this branch, `i` is an outstanding borrow |
48663c56 | 10 | x = Some(*i+1); //~ ERROR cannot assign to `x` because it is borrowed |
83c7162d | 11 | drop(i); |
223e47cc LB |
12 | } |
13 | } | |
1a4d82fc | 14 | x.clone(); // just to prevent liveness warnings |
223e47cc | 15 | } |