diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2025-04-03 13:16:33 +0200 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2025-04-07 08:18:19 +0000 |
commit | 5ab8589e09ccaf7d36c9331425fba9413f40b26b (patch) | |
tree | 554fed3871f224590f8cf7c95af48538f32b6ecd /gcc/rust/parse/rust-parse.h | |
parent | a179c05f228cace7bcaba8c550e0550993ff5a46 (diff) | |
download | gcc-5ab8589e09ccaf7d36c9331425fba9413f40b26b.zip gcc-5ab8589e09ccaf7d36c9331425fba9413f40b26b.tar.gz gcc-5ab8589e09ccaf7d36c9331425fba9413f40b26b.tar.bz2 |
Change optional to expected for parse_loop_label
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_loop_label): Change function
return type to expected.
(Parser::parse_labelled_loop_expr): Adapt call location to new return
type.
* parse/rust-parse.h (enum class): Update function prototype.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/parse/rust-parse.h')
-rw-r--r-- | gcc/rust/parse/rust-parse.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 5373106..ff79879 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -33,6 +33,11 @@ class ParseLifetimeParamError class ParseLifetimeError { }; +enum class ParseLoopLabelError +{ + NOT_LOOP_LABEL, + MISSING_COLON, +}; enum ParseSelfError { SELF_PTR, @@ -620,7 +625,8 @@ private: std::unique_ptr<AST::Expr> parse_labelled_loop_expr (const_TokenPtr tok, AST::AttrVec outer_attrs = AST::AttrVec ()); - tl::optional<AST::LoopLabel> parse_loop_label (const_TokenPtr tok); + tl::expected<AST::LoopLabel, ParseLoopLabelError> + parse_loop_label (const_TokenPtr tok); std::unique_ptr<AST::AsyncBlockExpr> parse_async_block_expr (AST::AttrVec outer_attrs = AST::AttrVec ()); std::unique_ptr<AST::GroupedExpr> parse_grouped_expr (AST::AttrVec outer_attrs |