Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/generic_args.rs')
| -rw-r--r-- | crates/parser/src/grammar/generic_args.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/parser/src/grammar/generic_args.rs b/crates/parser/src/grammar/generic_args.rs index 919d9b91eb..55794954a8 100644 --- a/crates/parser/src/grammar/generic_args.rs +++ b/crates/parser/src/grammar/generic_args.rs @@ -76,6 +76,7 @@ fn generic_arg(p: &mut Parser<'_>) -> bool { } } } + IDENT if p.nth(1) == T!['('] && p.nth_at(2, T![..]) => return_type_arg(p), _ if p.at_ts(types::TYPE_FIRST) => type_arg(p), _ => return false, } @@ -139,3 +140,20 @@ fn type_arg(p: &mut Parser<'_>) { types::type_(p); m.complete(p, TYPE_ARG); } + +// test return_type_arg +// type T = S<foo(..): Send>; +pub(super) fn return_type_arg(p: &mut Parser<'_>) { + let m = p.start(); + p.expect(IDENT); + p.expect(T!['(']); + p.expect(T![..]); + p.expect(T![')']); + if !p.at(T![:]) { + p.error("expected :"); + m.abandon(p); + return; + } + generic_params::bounds(p); + m.complete(p, RETURN_TYPE_ARG); +} |