-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #16588 - compiler-errors:async-and-const-bounds, r=Veykril
internal: Parse (nightly) `const` and `async` trait bounds Both of these bound modifiers were added recently: * `const` trait bounds: rust-lang/rust#119099 * `async` trait bounds: rust-lang/rust#120392 The latter will certainly will not do the right thing; namely, `async Fn` needs to be mapped to the `AsyncFn` trait. IDK how to do that, so advice would be appreciated, though perhaps we could land this first so the parser isn't complaining about these bounds?
- Loading branch information
Showing
7 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
crates/parser/test_data/parser/inline/ok/0211_async_trait_bound.rast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
SOURCE_FILE | ||
FN | ||
FN_KW "fn" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "async_foo" | ||
PARAM_LIST | ||
L_PAREN "(" | ||
PARAM | ||
WILDCARD_PAT | ||
UNDERSCORE "_" | ||
COLON ":" | ||
WHITESPACE " " | ||
IMPL_TRAIT_TYPE | ||
IMPL_KW "impl" | ||
WHITESPACE " " | ||
TYPE_BOUND_LIST | ||
TYPE_BOUND | ||
ASYNC_KW "async" | ||
WHITESPACE " " | ||
PATH_TYPE | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "Fn" | ||
PARAM_LIST | ||
L_PAREN "(" | ||
PARAM | ||
REF_TYPE | ||
AMP "&" | ||
PATH_TYPE | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "i32" | ||
R_PAREN ")" | ||
R_PAREN ")" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
R_CURLY "}" | ||
WHITESPACE "\n" |
1 change: 1 addition & 0 deletions
1
crates/parser/test_data/parser/inline/ok/0211_async_trait_bound.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn async_foo(_: impl async Fn(&i32)) {} |
34 changes: 34 additions & 0 deletions
34
crates/parser/test_data/parser/inline/ok/0212_const_trait_bound.rast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
SOURCE_FILE | ||
FN | ||
CONST_KW "const" | ||
WHITESPACE " " | ||
FN_KW "fn" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "foo" | ||
PARAM_LIST | ||
L_PAREN "(" | ||
PARAM | ||
WILDCARD_PAT | ||
UNDERSCORE "_" | ||
COLON ":" | ||
WHITESPACE " " | ||
IMPL_TRAIT_TYPE | ||
IMPL_KW "impl" | ||
WHITESPACE " " | ||
TYPE_BOUND_LIST | ||
TYPE_BOUND | ||
CONST_KW "const" | ||
WHITESPACE " " | ||
PATH_TYPE | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "Trait" | ||
R_PAREN ")" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
R_CURLY "}" | ||
WHITESPACE "\n" |
1 change: 1 addition & 0 deletions
1
crates/parser/test_data/parser/inline/ok/0212_const_trait_bound.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const fn foo(_: impl const Trait) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters