Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/items.rs')
-rw-r--r--crates/parser/src/grammar/items.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index 262255b356..d8468ba3cb 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -112,11 +112,22 @@ pub(super) fn opt_item(p: &mut Parser<'_>, m: Marker) -> Result<(), Marker> {
// test_err async_without_semicolon
// fn foo() { let _ = async {} }
- if p.at(T![async]) && !matches!(p.nth(1), T!['{'] | T![move] | T![|]) {
+ if p.at(T![async])
+ && (!matches!(p.nth(1), T!['{'] | T![gen] | T![move] | T![|])
+ || matches!((p.nth(1), p.nth(2)), (T![gen], T![fn])))
+ {
p.eat(T![async]);
has_mods = true;
}
+ // test_err gen_fn
+ // gen fn gen_fn() {}
+ // async gen fn async_gen_fn() {}
+ if p.at(T![gen]) && p.nth(1) == T![fn] {
+ p.eat(T![gen]);
+ has_mods = true;
+ }
+
// test_err unsafe_block_in_mod
// fn foo(){} unsafe { } fn bar(){}
if p.at(T![unsafe]) && p.nth(1) != T!['{'] {