GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gccrs

gccrs: Report errors for empty path expressions

Ensures gccrs reports diagnostics for empty path expressions, preventing downstream ICEs.

This commit improves error reporting in gccrs by ensuring that empty path expressions, such as those starting with ::, trigger a diagnostic. Previously, the parser might silently return an error node, leading to internal compiler errors (ICEs) later in the process. The redundant guard in parse_stmt_or_expr was also removed. New test cases empty_path2.rs and empty_path3.rs are added.

In Details

The parser in rust-parse-impl-path.hxx for Parser::parse_path_in_expression previously handled initial scoped path parsing errors by returning an error node without emitting a diagnostic. This could cascade into an ICE. This patch modifies the function to explicitly report a diagnostic for such cases. Additionally, a redundant guard in Parser::parse_stmt_or_expr was removed as it duplicated error reporting already handled downstream for undefined metavariables.

For Context
path expression
In Rust, a path expression is used to refer to items (like modules, functions, or types) within a scope. Examples include std::collections::HashMap or my_module::my_function.
ICE
Internal Compiler Error. A fatal error condition within the compiler itself, indicating a bug in the compiler's logic rather than in the user's code.
diagnostic
A message generated by the compiler to inform the user about potential issues, warnings, or errors in their code. This includes user-facing error messages.
metavariable
A placeholder in a macro definition that can be replaced by a code fragment supplied by the user when the macro is invoked. In Rust, these are part of declarative macros.
Filed Under: gccrsrustparsererror handlingcompiler bugs