Skip to content

Commit dea73b7

Browse files
committed
Auto merge of #123792 - oli-obk:coroutine_closures, r=compiler-errors
Require explicitly marking closures as coroutines instead of relying on patching up the closure to be a coroutine if it happens to contain a `yield` expression. I only do this in the 2024 edition, as the `gen` keyword is only available there.
2 parents b1ec083 + 83e2848 commit dea73b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/ide-db/src/generated/lints.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3869,7 +3869,7 @@ use std::ops::{Coroutine, CoroutineState};
38693869
use std::pin::Pin;
38703870
38713871
fn main() {
3872-
let mut coroutine = || {
3872+
let mut coroutine = #[coroutine] || {
38733873
yield 1;
38743874
return "foo"
38753875
};
@@ -3901,7 +3901,7 @@ use std::ops::Coroutine;
39013901
use std::pin::Pin;
39023902
39033903
fn main() {
3904-
let mut coroutine = || {
3904+
let mut coroutine = #[coroutine] || {
39053905
println!("2");
39063906
yield;
39073907
println!("4");
@@ -4007,7 +4007,7 @@ use std::pin::Pin;
40074007
40084008
fn main() {
40094009
let ret = "foo";
4010-
let mut coroutine = move || {
4010+
let mut coroutine = #[coroutine] move || {
40114011
yield 1;
40124012
return ret
40134013
};

0 commit comments

Comments
 (0)