mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-14 08:57:34 +00:00
Auto merge of #12444 - XFFXFF:fix_12442, r=Veykril
fix: parsing of `?` opt-out trait bounds fixes #12442
This commit is contained in:
commit
88024c7ec2
3 changed files with 54 additions and 0 deletions
|
@ -133,6 +133,12 @@ fn type_bound(p: &mut Parser) -> bool {
|
|||
match p.current() {
|
||||
LIFETIME_IDENT => lifetime(p),
|
||||
T![for] => types::for_type(p, false),
|
||||
T![?] if p.nth_at(1, T![for]) => {
|
||||
// test question_for_type_trait_bound
|
||||
// fn f<T>() where T: ?for<> Sized {}
|
||||
p.bump_any();
|
||||
types::for_type(p, false)
|
||||
}
|
||||
current => {
|
||||
match current {
|
||||
T![?] => p.bump_any(),
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
SOURCE_FILE
|
||||
FN
|
||||
FN_KW "fn"
|
||||
WHITESPACE " "
|
||||
NAME
|
||||
IDENT "f"
|
||||
GENERIC_PARAM_LIST
|
||||
L_ANGLE "<"
|
||||
TYPE_PARAM
|
||||
NAME
|
||||
IDENT "T"
|
||||
R_ANGLE ">"
|
||||
PARAM_LIST
|
||||
L_PAREN "("
|
||||
R_PAREN ")"
|
||||
WHITESPACE " "
|
||||
WHERE_CLAUSE
|
||||
WHERE_KW "where"
|
||||
WHITESPACE " "
|
||||
WHERE_PRED
|
||||
PATH_TYPE
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "T"
|
||||
COLON ":"
|
||||
WHITESPACE " "
|
||||
TYPE_BOUND_LIST
|
||||
TYPE_BOUND
|
||||
QUESTION "?"
|
||||
FOR_TYPE
|
||||
FOR_KW "for"
|
||||
GENERIC_PARAM_LIST
|
||||
L_ANGLE "<"
|
||||
R_ANGLE ">"
|
||||
WHITESPACE " "
|
||||
PATH_TYPE
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "Sized"
|
||||
WHITESPACE " "
|
||||
BLOCK_EXPR
|
||||
STMT_LIST
|
||||
L_CURLY "{"
|
||||
R_CURLY "}"
|
||||
WHITESPACE "\n"
|
|
@ -0,0 +1 @@
|
|||
fn f<T>() where T: ?for<> Sized {}
|
Loading…
Reference in a new issue