fix: correctly parse use in generic parameters

This commit is contained in:
SabrinaJewson 2024-10-01 22:09:31 +01:00
parent e1a76671af
commit e735906839
No known key found for this signature in database
GPG key ID: 3D5438FFA5F05564
3 changed files with 29 additions and 1 deletions

View file

@ -145,7 +145,7 @@ fn type_bound(p: &mut Parser<'_>) -> bool {
T![for] => types::for_type(p, false),
// test precise_capturing
// fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
T![use] => {
T![use] if p.nth_at(1, T![<]) => {
p.bump_any();
generic_param_list(p)
}

View file

@ -0,0 +1,26 @@
SOURCE_FILE
IMPL
IMPL_KW "impl"
GENERIC_PARAM_LIST
L_ANGLE "<"
TYPE_PARAM
NAME
IDENT "T"
COLON ":"
WHITESPACE "\n"
TYPE_BOUND_LIST
ERROR
USE_KW "use"
WHITESPACE " "
MACRO_CALL
PATH
PATH_SEGMENT
NAME_REF
IDENT "std"
SEMICOLON ";"
WHITESPACE "\n"
error 8: expected R_ANGLE
error 8: expected type
error 11: expected `{`
error 15: expected BANG
error 15: expected `{`, `[`, `(`

View file

@ -0,0 +1,2 @@
impl<T:
use std;