about summary refs log tree commit diff
path: root/tests/ui/coroutine/drop-and-replace.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-04-11 13:15:34 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-04-24 08:05:29 +0000
commitaef0f4024aec24fd7e53dbc51883457e44fe17ce (patch)
tree25a26930a8cc3441951ba159f1a632092df41655 /tests/ui/coroutine/drop-and-replace.rs
parenta589632dad58c2669b7984019efb59917a16ac67 (diff)
downloadrust-aef0f4024aec24fd7e53dbc51883457e44fe17ce.tar.gz
rust-aef0f4024aec24fd7e53dbc51883457e44fe17ce.zip
Error on using `yield` without also using `#[coroutine]` on the closure
And suggest adding the `#[coroutine]` to the closure
Diffstat (limited to 'tests/ui/coroutine/drop-and-replace.rs')
-rw-r--r--tests/ui/coroutine/drop-and-replace.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/ui/coroutine/drop-and-replace.rs b/tests/ui/coroutine/drop-and-replace.rs
index 6e30d76512b..d3d7e000020 100644
--- a/tests/ui/coroutine/drop-and-replace.rs
+++ b/tests/ui/coroutine/drop-and-replace.rs
@@ -4,7 +4,7 @@
 // #60187, this produced incorrect code for coroutines when a saved local was
 // re-assigned.
 
-#![feature(coroutines, coroutine_trait)]
+#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
 
 use std::ops::{Coroutine, CoroutineState};
 use std::pin::Pin;
@@ -17,7 +17,8 @@ impl Drop for Foo {
 }
 
 fn main() {
-    let mut a = || {
+    let mut a = #[coroutine]
+    || {
         let mut x = Foo(4);
         yield;
         assert_eq!(x.0, 4);