Introduce UtilPath for scope resolution in GCC Rust
GCC's Rust compiler adopts `UtilPath` to bundle path segments and scope information, improving how extern prelude paths are handled.
The GCC Rust frontend introduces a new UtilPath class to consolidate path segments and scope resolution information, particularly for extern prelude paths. Previously, this information was managed separately, leading to inconsistencies. This change simplifies the resolution process by grouping related data, impacting several files including AST and name resolution components.
In Details
This commit introduces util/rust-util-path.h and integrates it into name resolution functions across rust-early-name-resolver-2.0.cc/.h, rust-late-name-resolver-2.0.cc, and rust-forever-stack.h. The UtilPath class now carries both path segments and an opening_scope_resolution flag, standardizing how extern prelude references are identified and processed, replacing ad-hoc segment vectors.
- UtilPath
- A new utility class in gccrs that combines path segments with scope resolution information, particularly for handling extern prelude paths.
- 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.
- path segments
- The individual components of a Rust path, separated by
::, which identify modules, types, or functions. - AST
- Abstract Syntax Tree. A tree representation of the abstract syntactic structure of source code.