about summary refs log tree commit diff
path: root/compiler/rustc_ast/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-11 18:22:37 -0400
committerMichael Goulet <michael@errs.io>2024-09-11 18:39:06 -0400
commit594de02cbacccd3a220c69971e085bfd76a84eac (patch)
tree2cb1e063a08428e7a3a563b68d703814c989e602 /compiler/rustc_ast/src
parent8d6b88b168e45ee1624699c19443c49665322a91 (diff)
downloadrust-594de02cbacccd3a220c69971e085bfd76a84eac.tar.gz
rust-594de02cbacccd3a220c69971e085bfd76a84eac.zip
Properly deny const gen/async gen fns
Diffstat (limited to 'compiler/rustc_ast/src')
-rw-r--r--compiler/rustc_ast/src/ast.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index 42741bdca22..1fb85abcbfa 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -2602,6 +2602,14 @@ impl CoroutineKind {
         }
     }
 
+    pub fn as_str(self) -> &'static str {
+        match self {
+            CoroutineKind::Async { .. } => "async",
+            CoroutineKind::Gen { .. } => "gen",
+            CoroutineKind::AsyncGen { .. } => "async gen",
+        }
+    }
+
     pub fn is_async(self) -> bool {
         matches!(self, CoroutineKind::Async { .. })
     }