]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-mut-borrow-linear-errors.rs
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / borrowck / borrowck-mut-borrow-linear-errors.rs
1 // Test to ensure we only report an error for the first issued loan that
2 // conflicts with a new loan, as opposed to every issued loan.  This keeps us
3 // down to O(n) errors (for n problem lines), instead of O(n^2) errors.
4
5 fn main() {
6     let mut x = 1;
7     let mut addr = vec![];
8     loop {
9         match 1 {
10             1 => { addr.push(&mut x); } //~ ERROR [E0499]
11             2 => { addr.push(&mut x); } //~ ERROR [E0499]
12             _ => { addr.push(&mut x); } //~ ERROR [E0499]
13         }
14     }
15 }