]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/yield-while-iterating.stderr
Auto merge of #44355 - Xaeroxe:optimize_drain_filter, r=alexcrichton
[rust.git] / src / test / ui / generator / yield-while-iterating.stderr
1 error[E0626]: borrow may still be in use when generator yields
2   --> $DIR/yield-while-iterating.rs:22:19
3    |
4 22 |         for p in &x { //~ ERROR
5    |                   ^
6 23 |             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 62 |     let mut b = || {
13    |                 -- mutable borrow occurs here
14 63 |         for p in &mut x {
15    |                       - previous borrow occurs due to use of `x` in closure
16 ...
17 67 |     println!("{}", x[0]); //~ ERROR
18    |                    ^ immutable borrow occurs here
19 68 |     b.resume();
20 69 | }
21    | - mutable borrow ends here
22
23 error: aborting due to 2 previous errors
24