Error on using yield without also using #[coroutine] on the closure
And suggest adding the `#[coroutine]` to the closure
This commit is contained in:
parent
a589632dad
commit
aef0f4024a
279 changed files with 1290 additions and 886 deletions
|
|
@ -3869,7 +3869,7 @@ use std::ops::{Coroutine, CoroutineState};
|
|||
use std::pin::Pin;
|
||||
|
||||
fn main() {
|
||||
let mut coroutine = || {
|
||||
let mut coroutine = #[coroutine] || {
|
||||
yield 1;
|
||||
return "foo"
|
||||
};
|
||||
|
|
@ -3901,7 +3901,7 @@ use std::ops::Coroutine;
|
|||
use std::pin::Pin;
|
||||
|
||||
fn main() {
|
||||
let mut coroutine = || {
|
||||
let mut coroutine = #[coroutine] || {
|
||||
println!("2");
|
||||
yield;
|
||||
println!("4");
|
||||
|
|
@ -4007,7 +4007,7 @@ use std::pin::Pin;
|
|||
|
||||
fn main() {
|
||||
let ret = "foo";
|
||||
let mut coroutine = move || {
|
||||
let mut coroutine = #[coroutine] move || {
|
||||
yield 1;
|
||||
return ret
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue