From aef0f4024aec24fd7e53dbc51883457e44fe17ce Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 11 Apr 2024 13:15:34 +0000 Subject: Error on using `yield` without also using `#[coroutine]` on the closure And suggest adding the `#[coroutine]` to the closure --- tests/coverage/coroutine.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/coverage/coroutine.rs') diff --git a/tests/coverage/coroutine.rs b/tests/coverage/coroutine.rs index 2aa689466fc..7f72e0d8bd4 100644 --- a/tests/coverage/coroutine.rs +++ b/tests/coverage/coroutine.rs @@ -1,4 +1,4 @@ -#![feature(coroutines, coroutine_trait)] +#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; @@ -18,7 +18,7 @@ fn get_u32(val: bool) -> Result { fn main() { let is_true = std::env::args().len() == 1; - let mut coroutine = || { + let mut coroutine = #[coroutine] || { yield get_u32(is_true); return "foo"; }; -- cgit 1.4.1-3-g733a5