diff options
| author | Michael Goulet <michael@errs.io> | 2024-09-11 18:22:37 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-09-11 18:39:06 -0400 |
| commit | 594de02cbacccd3a220c69971e085bfd76a84eac (patch) | |
| tree | 2cb1e063a08428e7a3a563b68d703814c989e602 /compiler/rustc_ast/src | |
| parent | 8d6b88b168e45ee1624699c19443c49665322a91 (diff) | |
| download | rust-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.rs | 8 |
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 { .. }) } |
