Clarify extern prelude origin in GCC Rust builtin macros
GCC's Rust compiler now correctly attributes extern prelude paths when generating builtin macros, fixing incorrect scope resolution.
The GCC Rust compiler has been updated to correctly identify and emit the extern prelude origin for core paths when generating builtin macros. Previously, the compiler would emit the core path but fail to specify its extern prelude source, always defaulting to using opening scope resolution. This change ensures more accurate generation of builtin macros by properly handling scope context.
In Details
This commit modifies several rust-ast-builder.cc, rust-ast-builder.h, and various rust-derive-*.cc files to properly propagate the opening_scope_resolution flag when building AST nodes for builtin macros. Specifically, calls like Builder::discriminant_value and Builder::qualified_call now correctly handle the context, ensuring that paths originating from the extern prelude are distinguished from those resolved via opening scope, thus fixing incorrect macro expansion.
- extern prelude
- A set of modules and types that are implicitly imported into every Rust crate, providing common functionality.
- builtin macros
- Macros that are automatically available in Rust code, often used for code generation or language features.
- scope resolution
- The process by which the compiler determines the meaning and visibility of identifiers (like types and functions) within a given scope.
- AST
- Abstract Syntax Tree. A tree representation of the abstract syntactic structure of source code.