]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/yield-while-iterating.nll.stderr
Auto merge of #54813 - petrochenkov:uilocale, r=alexcrichton
[rust.git] / src / test / ui / generator / yield-while-iterating.nll.stderr
1 error[E0626]: borrow may still be in use when generator yields
2   --> $DIR/yield-while-iterating.rs:22:18
3    |
4 LL |         for p in &x { //~ ERROR
5    |                  ^^
6 LL |             yield();
7    |             ------- possible yield occurs here
8
9 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
10   --> $DIR/yield-while-iterating.rs:67:20
11    |
12 LL |       let mut b = || {
13    |  _________________-
14 LL | |         for p in &mut x {
15 LL | |             yield p;
16 LL | |         }
17 LL | |     };
18    | |_____- mutable borrow occurs here
19 LL |       println!("{}", x[0]); //~ ERROR
20    |                      ^ immutable borrow occurs here
21 LL |       b.resume();
22    |       - mutable borrow later used here
23
24 error: aborting due to 2 previous errors
25
26 Some errors occurred: E0502, E0626.
27 For more information about an error, try `rustc --explain E0502`.