]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Use error wrapper when required instead of nullptr
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Fri, 26 Dec 2025 03:38:52 +0000 (04:38 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 16 Jan 2026 16:32:05 +0000 (17:32 +0100)
commit5ebb482c253ca0dd95378f5d53f20d20f4fe4ff8
treeb5241e571255a2defa9b530bf18f2270c6b3cf6b
parentaa578d7344fe88be9f02bcdb6dca2789f1eb3151
gccrs: Use error wrapper when required instead of nullptr

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::visit): Update function
name.
* ast/rust-ast-pointer-visitor.cc (PointerVisitor::visit): Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast.cc (BreakExpr::as_string): Use getter function.
(AttributeParser::parse_path_meta_item): Convert to expected type.
(ReturnExpr::as_string): Change access to returned expr.
* ast/rust-desugar-for-loops.cc (DesugarForLoops::DesugarCtx::make_break_arm):
Likewise.
* ast/rust-expr.h (class BreakExpr): Make expr in break optional.
(class ReturnExpr): Make returned expr explicitely optional. Change the
getters and introduce a  const getter.
* expand/rust-cfg-strip.cc (CfgStrip::visit): Convert to expected type.
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Update
constructor call to new expected types.
(parse_reg_operand_out): Likewise.
(parse_reg_operand_inout): Likewise.
(parse_llvm_operands): Likewise.
* expand/rust-macro-builtins-format-args.cc (format_args_parse_expr):
Likewise.
(format_args_parse_arguments): Likewise.
* expand/rust-macro-builtins-helpers.cc (try_expand_many_expr): Update
value for tl::expected.
* expand/rust-macro-builtins-include.cc (MacroBuiltin::include_handler):
Likewise.
* expand/rust-macro-expand.cc (transcribe_expression): Update
constructor call with expected value.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* parse/rust-parse-error.h (enum class): Add new error types for Expr
and StructExprField.
* parse/rust-parse-impl-expr.hxx: Explicitely handle return expr
parsing failure. Update to fit new expected types.
* parse/rust-parse-impl.hxx: Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Adapt to
tl::expected.
* ast/rust-desugar-while-let.cc (DesugarWhileLet::DesugarCtx::make_break_arm):
Use optional for break expressions when missing instead of nullptr.
* parse/rust-parse.h: Change function return type with expected. Remove
error state from ExprOrStmt.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
19 files changed:
gcc/rust/ast/rust-ast-collector.cc
gcc/rust/ast/rust-ast-pointer-visitor.cc
gcc/rust/ast/rust-ast-visitor.cc
gcc/rust/ast/rust-ast.cc
gcc/rust/ast/rust-desugar-for-loops.cc
gcc/rust/ast/rust-desugar-while-let.cc
gcc/rust/ast/rust-expr.h
gcc/rust/expand/rust-cfg-strip.cc
gcc/rust/expand/rust-macro-builtins-asm.cc
gcc/rust/expand/rust-macro-builtins-format-args.cc
gcc/rust/expand/rust-macro-builtins-helpers.cc
gcc/rust/expand/rust-macro-builtins-include.cc
gcc/rust/expand/rust-macro-expand.cc
gcc/rust/hir/rust-ast-lower-expr.cc
gcc/rust/parse/rust-parse-error.h
gcc/rust/parse/rust-parse-impl-expr.hxx
gcc/rust/parse/rust-parse-impl.hxx
gcc/rust/parse/rust-parse.h
gcc/rust/resolve/rust-late-name-resolver-2.0.cc