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

gccrs: Add ASTMapping to regroup all AST items mappings

Introduces ASTMapping to consolidate AST item mappings, improving organization in gccrs.

The gccrs compiler has introduced a new class, ASTMapping, to better organize mappings related to Abstract Syntax Tree (AST) items. This change aims to streamline the codebase by regrouping certain AST item mappings that were previously spread across the Rust HIR map. This consolidation is expected to make the HIR map more manageable and improve the overall structure of the compiler’s internal data handling.

In Details

The gccrs compiler's Rust HIR map has grown large. This commit refactors it by introducing ASTMapping to group AST-related mappings, specifically visibility mappings, and ASTMappings as a specialized collection. This improves organization within rust-hir-map.cc/.h, separating AST-specific concerns from other HIR data structures, which aids maintainability for developers working on the Rust frontend.

For Context
AST
Abstract Syntax Tree. A tree representation of the abstract syntactic structure of source code, used internally by compilers to process and analyze code.
HIR
High-Level Intermediate Representation. A representation of the code between the AST and the lower-level intermediate representations used by the compiler backend. In gccrs, it captures semantic information.
gccrs
The Rust frontend for the GCC compiler, aiming to provide a robust and compliant Rust compilation experience within the GCC ecosystem.
Filed Under: gccrsrefactorcompiler internals