2017-07-29 11:05:50 -05:00
|
|
|
error[E0626]: borrow may still be in use when generator yields
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/yield-while-iterating.rs:13:18
|
2017-07-15 05:52:49 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | for p in &x {
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | yield();
|
2017-07-15 05:52:49 -05:00
|
|
|
| ------- possible yield occurs here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
2018-10-04 13:49:38 -05:00
|
|
|
--> $DIR/yield-while-iterating.rs:58:20
|
2017-07-15 05:52:49 -05:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let mut b = || {
|
2017-07-15 05:52:49 -05:00
|
|
|
| -- mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | for p in &mut x {
|
2019-04-22 02:40:08 -05:00
|
|
|
| - first borrow occurs due to use of `x` in generator
|
2017-07-15 05:52:49 -05:00
|
|
|
...
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | println!("{}", x[0]);
|
2017-07-15 05:52:49 -05:00
|
|
|
| ^ immutable borrow occurs here
|
2020-01-25 13:03:10 -06:00
|
|
|
LL | Pin::new(&mut b).resume(());
|
2019-04-22 02:40:08 -05:00
|
|
|
| ------ mutable borrow later used here
|
2017-07-15 05:52:49 -05:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
2019-04-17 12:26:38 -05:00
|
|
|
Some errors have detailed explanations: E0502, E0626.
|
2018-03-03 08:59:40 -06:00
|
|
|
For more information about an error, try `rustc --explain E0502`.
|