Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler/rustc_resolve/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
)
}
ModuleOrUniformRoot::OpenModule(sym) => {
if ident.name == kw::SelfLower && ns == TypeNS {
let res = Res::OpenMod(sym);
return Ok(self.arenas.new_pub_def_decl(res, ident.span, LocalExpnId::ROOT));
}

let open_ns_name = format!("{}::{}", sym.as_str(), ident.name);
let ns_ident = IdentKey::with_root_ctxt(Symbol::intern(&open_ns_name));
match self.extern_prelude_get_flag(ns_ident, ident.span, finalize.is_some()) {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/resolve/auxiliary/namespaced_crate_utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub fn f() {}
9 changes: 9 additions & 0 deletions tests/ui/resolve/namespaced-crate-self-import.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ compile-flags: -Znamespaced-crates
//@ edition: 2024
//@ check-pass
//@ aux-crate:my_api::utils=namespaced_crate_utils.rs

use alias::utils;
use my_api as alias;

@mu001999 mu001999 Aug 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test should contain trailing self.

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and it would also be good to have test cases for my_api::super and my_api::crate.


fn main() {}
Loading