about summary refs log tree commit diff
path: root/tests/debuginfo
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/debuginfo
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/debuginfo')
-rw-r--r--tests/debuginfo/coroutine-locals.rs9
-rw-r--r--tests/debuginfo/coroutine-objects.rs5
-rw-r--r--tests/debuginfo/function-names.rs5
-rw-r--r--tests/debuginfo/issue-57822.rs8
4 files changed, 17 insertions, 10 deletions
diff --git a/tests/debuginfo/coroutine-locals.rs b/tests/debuginfo/coroutine-locals.rs
index 54b5cd577c8..c019998040b 100644
--- a/tests/debuginfo/coroutine-locals.rs
+++ b/tests/debuginfo/coroutine-locals.rs
@@ -46,7 +46,7 @@
 // lldb-command:v c
 // lldb-check:(int) c = 6
 
-#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)]
+#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)]
 #![omit_gdb_pretty_printer_section]
 
 use std::ops::Coroutine;
@@ -54,7 +54,8 @@ use std::pin::Pin;
 
 fn main() {
     let mut a = 5;
-    let mut b = || {
+    let mut b = #[coroutine]
+    || {
         let c = 6; // Live across multiple yield points
 
         let d = 7; // Live across only one yield point
@@ -76,4 +77,6 @@ fn main() {
     _zzz(); // #break
 }
 
-fn _zzz() {()}
+fn _zzz() {
+    ()
+}
diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs
index 9e1bd5d62e7..e13f20455a8 100644
--- a/tests/debuginfo/coroutine-objects.rs
+++ b/tests/debuginfo/coroutine-objects.rs
@@ -63,7 +63,7 @@
 // cdb-check: b                : Returned [Type: enum2$<coroutine_objects::main::coroutine_env$0>]
 // cdb-check:    [+0x[...]] _ref__a          : 0x[...] : 6 [Type: int *]
 
-#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)]
+#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)]
 #![omit_gdb_pretty_printer_section]
 
 use std::ops::Coroutine;
@@ -71,7 +71,8 @@ use std::pin::Pin;
 
 fn main() {
     let mut a = 5;
-    let mut b = || {
+    let mut b = #[coroutine]
+    || {
         let mut c = 6;
         let mut d = 7;
 
diff --git a/tests/debuginfo/function-names.rs b/tests/debuginfo/function-names.rs
index 1e4be432445..2b0c2593676 100644
--- a/tests/debuginfo/function-names.rs
+++ b/tests/debuginfo/function-names.rs
@@ -83,7 +83,7 @@
 #![allow(unused_variables)]
 #![feature(omit_gdb_pretty_printer_section)]
 #![omit_gdb_pretty_printer_section]
-#![feature(adt_const_params, coroutines, coroutine_trait)]
+#![feature(adt_const_params, coroutines, coroutine_trait, stmt_expr_attributes)]
 #![allow(incomplete_features)]
 
 use std::ops::Coroutine;
@@ -111,7 +111,8 @@ fn main() {
     closure();
 
     // Coroutine
-    let mut coroutine = || {
+    let mut coroutine = #[coroutine]
+    || {
         yield;
         return;
     };
diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs
index 93e1a2558f6..995779a6a9c 100644
--- a/tests/debuginfo/issue-57822.rs
+++ b/tests/debuginfo/issue-57822.rs
@@ -26,7 +26,7 @@
 // lldb-command:v b
 // lldbg-check:(issue_57822::main::{coroutine_env#3}) b =
 
-#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)]
+#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)]
 #![omit_gdb_pretty_printer_section]
 
 use std::ops::Coroutine;
@@ -38,11 +38,13 @@ fn main() {
     let g = move || f();
 
     let mut y = 2;
-    let mut a = move || {
+    let mut a = #[coroutine]
+    move || {
         y += 1;
         yield;
     };
-    let mut b = move || {
+    let mut b = #[coroutine]
+    move || {
         Pin::new(&mut a).resume(());
         yield;
     };