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

gccrs: Resolve 2015 use paths from the crate root

Fixes Rust-GCC's incorrect resolution of 'use' paths in the 2015 edition.

This commit corrects how Rust-GCC resolves import paths for the 2015 edition. Previously, paths were resolved from the current module instead of the crate root, causing use foo::bar in submodules to fail. The change introduces logic to determine the correct resolution mode for each import path, ensuring they are resolved from the crate root as per the 2015 edition specification.

In Details

The gccrs frontend now correctly distinguishes between module-relative and crate-root-relative 'use' paths, as required by the Rust 2015 edition. This is handled by Early::import_resolution_mode and Early::resolve_path_in_all_ns, ensuring imports like use std::collections; within inner modules are resolved against the crate root, not their parent module.

Filed Under: gccrsrustcompilerresolution