mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 20:31:59 +00:00
Parse new const trait syntax
This commit is contained in:
parent
db07723fe9
commit
5924b38e3d
6 changed files with 19 additions and 9 deletions
|
|
@ -122,7 +122,7 @@ fn lifetime_bounds(p: &mut Parser<'_>) {
|
|||
}
|
||||
|
||||
// test type_param_bounds
|
||||
// struct S<T: 'a + ?Sized + (Copy) + ~const Drop>;
|
||||
// struct S<T: 'a + ?Sized + (Copy) + [const] Drop>;
|
||||
pub(super) fn bounds(p: &mut Parser<'_>) {
|
||||
p.expect(T![:]);
|
||||
bounds_without_colon(p);
|
||||
|
|
@ -187,6 +187,11 @@ fn type_bound(p: &mut Parser<'_>) -> bool {
|
|||
p.bump_any();
|
||||
p.expect(T![const]);
|
||||
}
|
||||
T!['['] => {
|
||||
p.bump_any();
|
||||
p.expect(T![const]);
|
||||
p.expect(T![']']);
|
||||
}
|
||||
// test const_trait_bound
|
||||
// const fn foo(_: impl const Trait) {}
|
||||
T![const] => {
|
||||
|
|
|
|||
|
|
@ -40,8 +40,9 @@ SOURCE_FILE
|
|||
PLUS "+"
|
||||
WHITESPACE " "
|
||||
TYPE_BOUND
|
||||
TILDE "~"
|
||||
L_BRACK "["
|
||||
CONST_KW "const"
|
||||
R_BRACK "]"
|
||||
WHITESPACE " "
|
||||
PATH_TYPE
|
||||
PATH
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
struct S<T: 'a + ?Sized + (Copy) + ~const Drop>;
|
||||
struct S<T: 'a + ?Sized + (Copy) + [const] Drop>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue