Skip to content

Commit 4a91453

Browse files
committed
fix: move use parsing to outer match arm
1 parent e4941c0 commit 4a91453

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

crates/parser/src/grammar/generic_params.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ fn type_bound(p: &mut Parser<'_>) -> bool {
144144
match p.current() {
145145
LIFETIME_IDENT => lifetime(p),
146146
T![for] => types::for_type(p, false),
147+
// test precise_capturing
148+
// fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
149+
T![use] => {
150+
p.bump_any();
151+
generic_param_list(p)
152+
}
147153
T![?] if p.nth_at(1, T![for]) => {
148154
// test question_for_type_trait_bound
149155
// fn f<T>() where T: ?for<> Sized {}
@@ -167,12 +173,6 @@ fn type_bound(p: &mut Parser<'_>) -> bool {
167173
T![async] => {
168174
p.bump_any();
169175
}
170-
// test precise_capturing
171-
// fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
172-
T![use] => {
173-
p.bump_any();
174-
generic_param_list(p);
175-
}
176176
_ => (),
177177
}
178178
if paths::is_use_path_start(p) {

crates/parser/test_data/parser/inline/ok/precise_capturing.rast

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,19 @@ SOURCE_FILE
4848
WHITESPACE " "
4949
PLUS "+"
5050
WHITESPACE " "
51-
USE_KW "use"
52-
GENERIC_PARAM_LIST
53-
L_ANGLE "<"
54-
LIFETIME_PARAM
55-
LIFETIME
56-
LIFETIME_IDENT "'b"
57-
COMMA ","
58-
WHITESPACE " "
59-
TYPE_PARAM
60-
NAME
61-
IDENT "T"
62-
R_ANGLE ">"
51+
TYPE_BOUND
52+
USE_KW "use"
53+
GENERIC_PARAM_LIST
54+
L_ANGLE "<"
55+
LIFETIME_PARAM
56+
LIFETIME
57+
LIFETIME_IDENT "'b"
58+
COMMA ","
59+
WHITESPACE " "
60+
TYPE_PARAM
61+
NAME
62+
IDENT "T"
63+
R_ANGLE ">"
6364
WHITESPACE " "
6465
BLOCK_EXPR
6566
STMT_LIST

0 commit comments

Comments
 (0)