GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gccrs

gccrs: Report an error when pub is not followed by an item

Fixes Rust-GCC to report an error for invalid 'pub' usage.

This commit addresses an issue in Rust-GCC where the parser would silently drop input following an incomplete pub declaration, such as pub <. Previously, this could lead to unexpected compilation behavior. The fix ensures that the parser now emits an “expected item” error in such cases, improving compiler robustness.

In Details

The rust-parse-impl.hxx parser in gccrs now correctly handles cases where pub is not followed by a valid item. Parser::parse_item is updated to emit an error if parse_vis_item fails without recording one, preventing silent dropping of malformed visibility declarations.

Filed Under: gccrsrustcompilerparsererror handling