]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/yield-while-iterating.stderr
Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
[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:13:18
3    |
4 LL |         for p in &x {
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:58:20
11    |
12 LL |     let mut b = || {
13    |                 -- mutable borrow occurs here
14 LL |         for p in &mut x {
15    |                       - first borrow occurs due to use of `x` in generator
16 ...
17 LL |     println!("{}", x[0]);
18    |                    ^ immutable borrow occurs here
19 LL |     Pin::new(&mut b).resume(());
20    |              ------ mutable borrow later used here
21
22 error: aborting due to 2 previous errors
23
24 Some errors have detailed explanations: E0502, E0626.
25 For more information about an error, try `rustc --explain E0502`.