]> git.proxmox.com Git - rustc.git/blame - src/test/ui/generator/yield-while-iterating.nll.stderr
New upstream version 1.34.2+dfsg1
[rustc.git] / src / test / ui / generator / yield-while-iterating.nll.stderr
CommitLineData
83c7162d 1error[E0626]: borrow may still be in use when generator yields
9fa01778 2 --> $DIR/yield-while-iterating.rs:13:18
83c7162d
XL
3 |
4LL | for p in &x { //~ ERROR
5 | ^^
6LL | yield();
7 | ------- possible yield occurs here
8
9error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
9fa01778 10 --> $DIR/yield-while-iterating.rs:58:20
83c7162d 11 |
0bf4aa26
XL
12LL | let mut b = || {
13 | -- mutable borrow occurs here
14LL | for p in &mut x {
15 | - first borrow occurs due to use of `x` in generator
16...
17LL | println!("{}", x[0]); //~ ERROR
18 | ^ immutable borrow occurs here
9fa01778
XL
19LL | Pin::new(&mut b).resume();
20 | ------ mutable borrow later used here
83c7162d
XL
21
22error: aborting due to 2 previous errors
23
24Some errors occurred: E0502, E0626.
25For more information about an error, try `rustc --explain E0502`.