mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-25 11:56:46 +00:00
This adds an `iter!` macro that can be used to create movable generators. This also adds a yield_expr feature so the `yield` keyword can be used within iter! macro bodies. This was needed because several unstable features each need `yield` expressions, so this allows us to stabilize them separately from any individual feature. Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de> Co-authored-by: Jieyou Xu <jieyouxu@outlook.com> Co-authored-by: Travis Cross <tc@traviscross.com>
26 lines
837 B
Plaintext
26 lines
837 B
Plaintext
error[E0382]: use of moved value: `f`
|
|
--> $DIR/generator_capture_.rs:21:17
|
|
|
|
|
LL | let f = {
|
|
| - move occurs because `f` has type `{gen closure@$DIR/generator_capture_.rs:10:17: 10:24}`, which does not implement the `Copy` trait
|
|
...
|
|
LL | let mut i = f();
|
|
| --- `f` moved due to this call
|
|
...
|
|
LL | let mut i = f();
|
|
| ^ value used here after move
|
|
|
|
|
note: this value implements `FnOnce`, which causes it to be moved when called
|
|
--> $DIR/generator_capture_.rs:16:17
|
|
|
|
|
LL | let mut i = f();
|
|
| ^
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | let mut i = f.clone()();
|
|
| ++++++++
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|