]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Remove redundant error types
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Fri, 12 Dec 2025 12:17:22 +0000 (13:17 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 16 Jan 2026 16:32:05 +0000 (17:32 +0100)
commitaa578d7344fe88be9f02bcdb6dca2789f1eb3151
treee932944f80c845b7cc2e6e90cb0f969185bfa8d5
parent27c25346259d0f58c1dff2f417f3c2bd39475154
gccrs: Remove redundant error types

Some error types in the parser had the exact same meaning and could be
grouped under one same type.

gcc/rust/ChangeLog:

* ast/rust-ast.cc (AttributeParser::parse_meta_item_lit): Use
tl::expected
* expand/rust-macro-builtins-helpers.cc (parse_single_string_literal):
Likewise.
* expand/rust-macro-expand.cc (MacroExpander::match_fragment):
Likewise.
* parse/rust-cfg-parser.cc (parse_cfg_option): Likewise.
* parse/rust-parse-error.h (struct SimplePath): Remove error type.
(struct DelimTokenTree): Likewise.
(struct Token): Likewise.
(struct TokenTree): Likewise.
(class LifetimeParam): Move from here ...
(struct LifetimeParam): ... to here. Add ctor.
(class Lifetime): Add error type.
(enum class): Remove AnonConst.
(struct BlockExpr): Change BlockExpr to generic node error.
* parse/rust-parse-impl-expr.hxx: Use tl::expected for errors.
* parse/rust-parse-impl-path.hxx: Likewise.
* parse/rust-parse-impl-ttree.hxx: Likewise.
* parse/rust-parse-impl.hxx: Likewise.
* parse/rust-parse.h: Update function return types with tl::expected
to propagate errors.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ast/rust-ast.cc
gcc/rust/expand/rust-macro-builtins-helpers.cc
gcc/rust/expand/rust-macro-expand.cc
gcc/rust/parse/rust-cfg-parser.cc
gcc/rust/parse/rust-parse-error.h
gcc/rust/parse/rust-parse-impl-expr.hxx
gcc/rust/parse/rust-parse-impl-path.hxx
gcc/rust/parse/rust-parse-impl-ttree.hxx
gcc/rust/parse/rust-parse-impl.hxx
gcc/rust/parse/rust-parse.h