From 20e40d5efedebd13edcbf059441a1684029fc5e1 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 11 Apr 2024 13:15:34 +0000 Subject: [PATCH] Error on using `yield` without also using `#[coroutine]` on the closure And suggest adding the `#[coroutine]` to the closure --- tests/source/immovable_coroutines.rs | 3 ++- tests/target/immovable_coroutines.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/source/immovable_coroutines.rs b/tests/source/immovable_coroutines.rs index 3b94af0c96ce..539049577a00 100644 --- a/tests/source/immovable_coroutines.rs +++ b/tests/source/immovable_coroutines.rs @@ -1,7 +1,8 @@ #![feature(coroutines)] unsafe fn foo() { - let mut ga = static || { + let mut ga = #[coroutine] + static || { yield 1; }; } diff --git a/tests/target/immovable_coroutines.rs b/tests/target/immovable_coroutines.rs index f52cfa00f978..539049577a00 100644 --- a/tests/target/immovable_coroutines.rs +++ b/tests/target/immovable_coroutines.rs @@ -1,7 +1,8 @@ #![feature(coroutines)] unsafe fn foo() { - let mut ga = static || { + let mut ga = #[coroutine] + static || { yield 1; }; }