blob: 5a9c779919790f6b1f03c2f8418dfaba27ca3586 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
error[E0515]: cannot yield value referencing local variable `s`
--> $DIR/issue-55850.rs:28:9
|
LL | yield &s[..]
| ^^^^^^^-^^^^
| | |
| | `s` is borrowed here
| yields a value referencing data owned by the current function
error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/issue-55850.rs:28:16
|
LL | GenIter(#[coroutine] move || {
| ------- within this coroutine
LL | let mut s = String::new();
LL | yield &s[..]
| -------^---- possible yield occurs here
|
help: add `static` to mark this coroutine as unmovable
|
LL | GenIter(#[coroutine] static move || {
| ++++++
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0515, E0626.
For more information about an error, try `rustc --explain E0515`.
|