Consolidate Rust path representation in GCC
GCC's Rust frontend replaces multiple vector types with a unified `UtilPath` for path segments, simplifying code and improving consistency.
The GCC Rust compiler refactors its name resolution components to use a single UtilPath type instead of various vector representations for path segments. This change streamlines the codebase by consolidating how paths, including those with scope information, are handled during compilation. It affects several header and source files within the resolve directory.
In Details
This commit introduces UtilPath to unify the representation of Rust paths across the name resolution stages. Previously, different components used distinct vector types to store path segments and associated scope information (like opening_scope_resolution). This consolidation, detailed in rust-util-path.h and applied in rust-forever-stack.h/hxx and rust-name-resolution-context.h/hxx, simplifies the handling of paths, particularly when dealing with extern prelude resolution.
- UtilPath
- A new utility class in gccrs designed to uniformly represent Rust paths, encompassing path segments and scope resolution information.
- path segments
- The individual components of a Rust path, separated by
::, which identify modules, types, or functions. - scope resolution
- The process by which the compiler determines the meaning and visibility of identifiers (like types and functions) within a given scope.
- extern prelude
- A set of modules and types that are implicitly imported into every Rust crate, providing common functionality.