about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2023-11-29 16:59:06 -0800
committerEric Holk <ericholk@microsoft.com>2023-12-04 11:23:07 -0800
commitf29b36d03ecf9986ac6c47385ff9390c9a2390e6 (patch)
tree14399bdb64fe1e28548bf66b8013df46a6bb191c /compiler/rustc_parse/src/parser
parent7c43784cb07a2e9006acc6f230df27dd28d88dab (diff)
downloadrust-f29b36d03ecf9986ac6c47385ff9390c9a2390e6.tar.gz
rust-f29b36d03ecf9986ac6c47385ff9390c9a2390e6.zip
Make async gen fn an error
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index 766ec50e75b..c6d1ea882e9 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -2414,6 +2414,12 @@ impl<'a> Parser<'a> {
             self.sess.gated_spans.gate(sym::gen_blocks, span);
         }
 
+        if let (Async::Yes { span: async_span, .. }, Gen::Yes { span: gen_span, .. }) =
+            (asyncness, genness)
+        {
+            self.sess.emit_err(errors::AsyncGenFn { span: async_span.to(gen_span) });
+        }
+
         if !self.eat_keyword_case(kw::Fn, case) {
             // It is possible for `expect_one_of` to recover given the contents of
             // `self.expected_tokens`, therefore, do not use `self.unexpected()` which doesn't