GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gccrs

gccrs: Fix ignored self in grouped glob imports

Resolves an issue where `self` imports were ignored in grouped glob imports in gccrs.

This patch corrects an issue in gccrs where grouped imports combining self with a glob pattern (e.g., use path::module::{self, *};) failed to import the base module itself. The fix ensures that self imports are assigned unique NodeIds, preventing them from being inadvertently dropped during the name resolution process. This resolves a bug where inner items were imported via the glob, but the module itself was not.

In Details

The Early::resolve_rebind_import function in gccrs's early name resolver previously used the parent's NodeId for self imports within grouped globs. This conflicted with the NodeId used by the glob (*), leading to the self import being ignored. This commit modifies the resolver to use the final segment's NodeId for self imports, ensuring it has a distinct identifier and is correctly resolved alongside globbed items.

For Context
grouped import
In Rust, a syntax for importing multiple items from a module within a single use statement, often using curly braces, e.g., use std::collections::{HashMap, HashSet};.
glob import
A Rust import that brings all public items from a module into scope using a wildcard, e.g., use std::collections::*;.
self import
In Rust, self within a module path in a use statement refers to the module itself, allowing it to be brought into scope along with other items.
NodeId
An internal unique identifier used by the gccrs compiler to represent various entities in the Abstract Syntax Tree (AST) and other intermediate representations, such as modules, functions, and variables.
name resolution
The compiler phase responsible for determining which identifier (like a variable or function name) refers to which declaration in the source code, considering scope and imports.
Filed Under: gccrsrustimportname resolution