Skip to content

Commit abbe85e

Browse files
committed
Recover from missing associated item binding
1 parent 45d4ebc commit abbe85e

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

crates/parser/src/grammar/generic_args.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ fn generic_arg(p: &mut Parser<'_>) -> bool {
5555
// test assoc_type_eq
5656
// type T = StreamingIterator<Item<'a> = &'a T>;
5757
types::type_(p);
58+
} else if p.at(T![>]) || p.at(T![,]) {
59+
// test_err recover_from_missing_assoc_item_binding
60+
// fn f() -> impl Iterator<Item = , Item = > {}
61+
p.error("missing associated item binding");
5862
} else {
5963
// test assoc_const_eq
6064
// fn foo<F: Foo<N=3>>() {}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
SOURCE_FILE
2+
FN
3+
FN_KW "fn"
4+
WHITESPACE " "
5+
NAME
6+
IDENT "f"
7+
PARAM_LIST
8+
L_PAREN "("
9+
R_PAREN ")"
10+
WHITESPACE " "
11+
RET_TYPE
12+
THIN_ARROW "->"
13+
WHITESPACE " "
14+
IMPL_TRAIT_TYPE
15+
IMPL_KW "impl"
16+
WHITESPACE " "
17+
TYPE_BOUND_LIST
18+
TYPE_BOUND
19+
PATH_TYPE
20+
PATH
21+
PATH_SEGMENT
22+
NAME_REF
23+
IDENT "Iterator"
24+
GENERIC_ARG_LIST
25+
L_ANGLE "<"
26+
ASSOC_TYPE_ARG
27+
NAME_REF
28+
IDENT "Item"
29+
WHITESPACE " "
30+
EQ "="
31+
WHITESPACE " "
32+
COMMA ","
33+
WHITESPACE " "
34+
ASSOC_TYPE_ARG
35+
NAME_REF
36+
IDENT "Item"
37+
WHITESPACE " "
38+
EQ "="
39+
WHITESPACE " "
40+
R_ANGLE ">"
41+
WHITESPACE " "
42+
BLOCK_EXPR
43+
STMT_LIST
44+
L_CURLY "{"
45+
R_CURLY "}"
46+
WHITESPACE "\n"
47+
error 30: missing associated item binding
48+
error 39: missing associated item binding
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn f() -> impl Iterator<Item = , Item = > {}

0 commit comments

Comments
 (0)