Skip to content

Conversation

@P-E-P
Copy link
Member

@P-E-P P-E-P commented Dec 10, 2025

No description provided.

A parser error header with Parse::Error namespace has recently been
introduced. Move some old parser error classes to this namespace.

gcc/rust/ChangeLog:

	* parse/rust-parse.h (class ParseLifetimeParamError): Move error from
	here ...
	(class ParseLifetimeError): Likewise.
	(enum class): Likewise.
	* parse/rust-parse-error.h (class LifetimeParam): ... to here.
	here.
	(class Lifetime): Likewise.
	(enum class): Likewise.
	(struct LoopLabel): Likewise and make it a full struct with ctors.
	(struct Self): Likewise.
	* parse/rust-parse-impl-expr.hxx: Make error point to new namespace.
	* parse/rust-parse-impl.hxx: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
Errors in the parser needs to be collected instead of emitted directly.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.hxx: Collect errors instead of emitting them.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* parse/rust-parse-error.h (struct BlockExpr): Add BlockExpr error type
	* parse/rust-parse-impl-expr.hxx: Update return types.
	* parse/rust-parse-impl.hxx: Likewise.
	* parse/rust-parse.h: Update function prototypes.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
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):
	* expand/rust-macro-builtins-helpers.cc (parse_single_string_literal):
	* expand/rust-macro-expand.cc (MacroExpander::match_fragment):
	* parse/rust-cfg-parser.cc (parse_cfg_option):
	* parse/rust-parse-error.h (struct SimplePath):
	(struct DelimTokenTree):
	(struct Token):
	(struct TokenTree):
	(class LifetimeParam):
	(struct LifetimeParam):
	(class Lifetime):
	(enum class):
	(struct BlockExpr):
	* parse/rust-parse-impl-expr.hxx:
	* parse/rust-parse-impl-path.hxx:
	* parse/rust-parse-impl-ttree.hxx:
	* parse/rust-parse-impl.hxx:
	* parse/rust-parse.h:

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
@P-E-P P-E-P force-pushed the improved_parser_errors branch from 6af4be8 to adf8940 Compare December 12, 2025 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant