aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-02-01 12:41:47 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2023-04-06 10:47:19 +0200
commit2af66ebd1d83f8b0706805fd650f18bd8c8effe7 (patch)
treefa264171bf7799bea5212c03fc1efb9532ab3d33 /gcc/rust
parent86f53e5853d2b058e76235624c6988362ef4151e (diff)
downloadgcc-2af66ebd1d83f8b0706805fd650f18bd8c8effe7.zip
gcc-2af66ebd1d83f8b0706805fd650f18bd8c8effe7.tar.gz
gcc-2af66ebd1d83f8b0706805fd650f18bd8c8effe7.tar.bz2
gccrs: parser: Improve parsing of complex generic arguments
The parser was missing code for handling complex type arguments such as type paths or nested generics. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_generic_arg): Handle type paths and nested generics properly. gcc/testsuite/ChangeLog: * rust/compile/parse_complex_generic_application.rs: New test. * rust/compile/parse_complex_generic_application2.rs: New test.
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 23b033f..3610790 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -6309,7 +6309,9 @@ Parser<ManagedTokenSource>::parse_generic_arg ()
// could either have a valid type or a macro (FIXME: anything else?). So
// we need one bit of lookahead to differentiate if this is really
auto next_tok = lexer.peek_token (1);
- if (next_tok->get_id () == EXCLAM)
+ if (next_tok->get_id () == LEFT_ANGLE
+ || next_tok->get_id () == SCOPE_RESOLUTION
+ || next_tok->get_id () == EXCLAM)
{
auto type = parse_type ();
if (type)