public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] parser: Disambiguate default expressions for const generics
@ 2022-06-25 9:33 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-25 9:33 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7f5ea92bbbcd92aab3ea0692d12527eb7cac30db
commit 7f5ea92bbbcd92aab3ea0692d12527eb7cac30db
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date: Fri Jun 24 15:14:50 2022 +0200
parser: Disambiguate default expressions for const generics
Diff:
---
gcc/rust/parse/rust-parse-impl.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 708140af93d..a36107b2319 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -2892,9 +2892,11 @@ Parser<ManagedTokenSource>::parse_generic_param (EndTokenPred is_end_token)
"%<identifier%> or %<literal%>, got %qs",
token_id_to_str (tok->get_id ()));
- // TODO: At this point, we *know* that we are parsing a const
- // expression. We should figure out how to disambiguate the default
- // expr in the case of `const N: usize = M`
+ // At this point, we *know* that we are parsing a const
+ // expression
+ if (default_expr.get_kind ()
+ == AST::ConstGenericArg::Kind::Ambiguous)
+ default_expr = default_expr.disambiguate_to_const ();
}
param = std::unique_ptr<AST::ConstGenericParam> (
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-25 9:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-25 9:33 [gcc/devel/rust/master] parser: Disambiguate default expressions for const generics Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).