rust/tests/ui/coroutine/yield-while-iterating.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
907 B
Plaintext
Raw Normal View History

2023-10-19 21:46:28 +00:00
error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/yield-while-iterating.rs:13:18
|
2019-03-09 12:03:44 +00:00
LL | for p in &x {
| ^^
2018-02-23 00:42:32 +00:00
LL | yield();
| ------- possible yield occurs here
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
2018-10-04 18:49:38 +00:00
--> $DIR/yield-while-iterating.rs:58:20
|
2018-02-23 00:42:32 +00:00
LL | let mut b = || {
| -- mutable borrow occurs here
2018-02-23 00:42:32 +00:00
LL | for p in &mut x {
2023-10-19 21:46:28 +00:00
| - first borrow occurs due to use of `x` in coroutine
...
2019-03-09 12:03:44 +00:00
LL | println!("{}", x[0]);
| ^ immutable borrow occurs here
LL | Pin::new(&mut b).resume(());
| ------ mutable borrow later used here
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0502, E0626.
2018-03-03 14:59:40 +00:00
For more information about an error, try `rustc --explain E0502`.