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.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index 8e551b0b96..c609f9383e 100644
--- a/crates/parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
@@ -424,6 +424,14 @@ fn fn_(p: &mut Parser<'_>, m: Marker) {
// fn bar() -> () {}
opt_ret_type(p);
+ // test_err fn_ret_recovery
+ // fn foo() -> A>]) { let x = 1; }
+ // fn foo() -> A>]) where T: Copy { let x = 1; }
+ while p.at(T![')']) | p.at(T![']']) | p.at(T![>]) {
+ // recover from unbalanced return type brackets
+ p.err_and_bump("expected a curly brace");
+ }
+
// test function_where_clause
// fn foo<T>() where T: Copy {}
generic_params::opt_where_clause(p);