about summary refs log tree commit diff
path: root/compiler/rustc_ast/src
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2024-09-12 20:37:18 +1000
committerGitHub <noreply@github.com>2024-09-12 20:37:18 +1000
commita3d9d13d7aba7bd35e79ad3cd9cb6cca9264329c (patch)
tree6d73b7057d80e5a23241d5158b76302f6de3e8a6 /compiler/rustc_ast/src
parent57020e0f8c30feae31b321325a34d6ebe6679cce (diff)
parent8dc227866fe12879e6a6b518c7a2ad6dbe395ac9 (diff)
downloadrust-a3d9d13d7aba7bd35e79ad3cd9cb6cca9264329c.tar.gz
rust-a3d9d13d7aba7bd35e79ad3cd9cb6cca9264329c.zip
Rollup merge of #130252 - compiler-errors:const-gen, r=chenyukang
Properly report error on `const gen fn`

Fixes #130232

Also removes some (what I thought were unused) functions, and fixes a bug in clippy where we considered `gen fn` to be the same as `fn` because it was only built to consider asyncness.
Diffstat (limited to 'compiler/rustc_ast/src')
-rw-r--r--compiler/rustc_ast/src/ast.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index c5aa9f56733..9dfebfae5ed 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -2602,12 +2602,12 @@ impl CoroutineKind {
         }
     }
 
-    pub fn is_async(self) -> bool {
-        matches!(self, CoroutineKind::Async { .. })
-    }
-
-    pub fn is_gen(self) -> bool {
-        matches!(self, CoroutineKind::Gen { .. })
+    pub fn as_str(self) -> &'static str {
+        match self {
+            CoroutineKind::Async { .. } => "async",
+            CoroutineKind::Gen { .. } => "gen",
+            CoroutineKind::AsyncGen { .. } => "async gen",
+        }
     }
 
     pub fn closure_id(self) -> NodeId {