diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-06-24 15:14:50 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-06-24 15:14:50 +0200 |
commit | 7f5ea92bbbcd92aab3ea0692d12527eb7cac30db (patch) | |
tree | 12c90d48caae5a7f907448e50316cf22ce88701b /gcc/rust/parse/rust-parse-impl.h | |
parent | af7f140f2f17b5290ec09266329bd719a7d49d99 (diff) | |
download | gcc-7f5ea92bbbcd92aab3ea0692d12527eb7cac30db.zip gcc-7f5ea92bbbcd92aab3ea0692d12527eb7cac30db.tar.gz gcc-7f5ea92bbbcd92aab3ea0692d12527eb7cac30db.tar.bz2 |
parser: Disambiguate default expressions for const generics
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 708140a..a36107b 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> ( |