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/ui/coroutine/polymorphize-args.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/ui/coroutine/polymorphize-args.rs') diff --git a/tests/ui/coroutine/polymorphize-args.rs b/tests/ui/coroutine/polymorphize-args.rs index 21aa3c7aafd..5123bf412b5 100644 --- a/tests/ui/coroutine/polymorphize-args.rs +++ b/tests/ui/coroutine/polymorphize-args.rs @@ -1,14 +1,15 @@ //@ compile-flags: -Zpolymorphize=on //@ build-pass -#![feature(coroutines, coroutine_trait)] +#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::ops::Coroutine; use std::pin::Pin; use std::thread; fn main() { - let mut foo = || yield; + let mut foo = #[coroutine] + || yield; thread::spawn(move || match Pin::new(&mut foo).resume(()) { s => panic!("bad state: {:?}", s), }) -- cgit 1.4.1-3-g733a5