mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Add support for new where
clause location in associated types.
A recent Rust nightly changed it: https://github.com/rust-lang/rust/issues/89122 This allows both the old and new location.
This commit is contained in:
parent
356c507357
commit
49d1207775
5 changed files with 47 additions and 8 deletions
|
@ -290,12 +290,17 @@ fn type_alias(p: &mut Parser, m: Marker) {
|
|||
generic_params::bounds(p);
|
||||
}
|
||||
|
||||
// test type_item_where_clause
|
||||
// test type_item_where_clause_deprecated
|
||||
// type Foo where Foo: Copy = ();
|
||||
generic_params::opt_where_clause(p);
|
||||
if p.eat(T![=]) {
|
||||
types::type_(p);
|
||||
}
|
||||
|
||||
// test type_item_where_clause
|
||||
// type Foo = () where Foo: Copy;
|
||||
generic_params::opt_where_clause(p);
|
||||
|
||||
p.expect(T![;]);
|
||||
m.complete(p, TYPE_ALIAS);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,12 @@ SOURCE_FILE
|
|||
NAME
|
||||
IDENT "Foo"
|
||||
WHITESPACE " "
|
||||
EQ "="
|
||||
WHITESPACE " "
|
||||
TUPLE_TYPE
|
||||
L_PAREN "("
|
||||
R_PAREN ")"
|
||||
WHITESPACE " "
|
||||
WHERE_CLAUSE
|
||||
WHERE_KW "where"
|
||||
WHITESPACE " "
|
||||
|
@ -23,11 +29,5 @@ SOURCE_FILE
|
|||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "Copy"
|
||||
WHITESPACE " "
|
||||
EQ "="
|
||||
WHITESPACE " "
|
||||
TUPLE_TYPE
|
||||
L_PAREN "("
|
||||
R_PAREN ")"
|
||||
SEMICOLON ";"
|
||||
WHITESPACE "\n"
|
||||
|
|
|
@ -1 +1 @@
|
|||
type Foo where Foo: Copy = ();
|
||||
type Foo = () where Foo: Copy;
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
SOURCE_FILE
|
||||
TYPE_ALIAS
|
||||
TYPE_KW "type"
|
||||
WHITESPACE " "
|
||||
NAME
|
||||
IDENT "Foo"
|
||||
WHITESPACE " "
|
||||
WHERE_CLAUSE
|
||||
WHERE_KW "where"
|
||||
WHITESPACE " "
|
||||
WHERE_PRED
|
||||
PATH_TYPE
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "Foo"
|
||||
COLON ":"
|
||||
WHITESPACE " "
|
||||
TYPE_BOUND_LIST
|
||||
TYPE_BOUND
|
||||
PATH_TYPE
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "Copy"
|
||||
WHITESPACE " "
|
||||
EQ "="
|
||||
WHITESPACE " "
|
||||
TUPLE_TYPE
|
||||
L_PAREN "("
|
||||
R_PAREN ")"
|
||||
SEMICOLON ";"
|
||||
WHITESPACE "\n"
|
|
@ -0,0 +1 @@
|
|||
type Foo where Foo: Copy = ();
|
Loading…
Reference in a new issue