]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-lend-flow-match.rs
Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
[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() {}