`self` keyword after wildcard import

Let's say I have the following main.rs and lib.rs files. Why after doing the wildcard import self refers to testing::nested and not the main binary module anymore?

Could somebody point me to documentation where they explain this? I haven't been able to find it. Thanks!

// main.rs
use testing::nested::*;

fn main() {

// lib.rs (testing module)
pub mod nested {
    pub hello() {
        println!("hello from nested::hello");

It's not that self refers to the nested module, it's that the use statement creates a second binding for the function hello in the top-level module, so that function can now be referred to by two different paths.

Use declarations

A use declaration creates one or more local name bindings synonymous with some other path.

Another example:

fn main() {

mod aaa {
    pub use crate::bbb::hello; 

mod bbb {
    pub fn hello() {

Of course! I don't know how I missed that, but I'm so glad you clarified it for me. Thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.