]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-lend-flow-match.rs
Auto merge of #101969 - reez12g:issue-101306, r=reez12g
[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() {}