]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-lend-flow-match.rs
Merge commit '2b2190cb5667cdd276a24ef8b9f3692209c54a89' into clippyup
[rust.git] / src / test / ui / borrowck / borrowck-lend-flow-match.rs
1 fn separate_arms() {
2     // Here both arms perform assignments, but only one is illegal.
3
4     let mut x = None;
5     match x {
6         None => {
7             // It is ok to reassign x here, because there is in
8             // fact no outstanding loan of x!
9             x = Some(0);
10         }
11         Some(ref r) => {
12             x = Some(1); //~ ERROR cannot assign to `x` because it is borrowed
13             drop(r);
14         }
15     }
16 }
17
18 fn main() {}