aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse-impl.h
diff options
context:
space:
mode:
authormxlol233 <mxlol233@outlook.com>2023-01-04 21:21:59 +0800
committermxlol233 <mxlol233@outlook.com>2023-01-04 22:18:18 +0800
commit2f36f38054279e66b1af55995e41dd14e56beb25 (patch)
treef5caa54136169a942ef603b7a6dca571516432a9 /gcc/rust/parse/rust-parse-impl.h
parent0152926ab36ba52153f3f457f6f3bb02bb274073 (diff)
downloadgcc-2f36f38054279e66b1af55995e41dd14e56beb25.zip
gcc-2f36f38054279e66b1af55995e41dd14e56beb25.tar.gz
gcc-2f36f38054279e66b1af55995e41dd14e56beb25.tar.bz2
rust: add bound parsing in parse_generic_arg.
Signed-off-by: Xiao Ma <mxlol233@outlook.com>
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 864fb86..86124ee 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -6189,6 +6189,23 @@ Parser<ManagedTokenSource>::parse_generic_arg ()
else
return AST::GenericArg::create_error ();
}
+ else if (next_tok->get_id () == COLON)
+ {
+ lexer.skip_token (); // skip ident
+ lexer.skip_token (); // skip colon
+
+ auto tok = lexer.peek_token ();
+ std::vector<std::unique_ptr<AST::TypeParamBound>> bounds
+ = parse_type_param_bounds ();
+
+ auto type = std::unique_ptr<AST::TraitObjectType> (
+ new AST::TraitObjectType (std::move (bounds), tok->get_locus (),
+ false));
+ if (type)
+ return AST::GenericArg::create_type (std::move (type));
+ else
+ return AST::GenericArg::create_error ();
+ }
lexer.skip_token ();
return AST::GenericArg::create_ambiguous (tok->get_str (),
tok->get_locus ());