Skip to content

Can't bring nested mod into scope with use foo::foo #5130

Closed
@ben0x539

Description

@ben0x539

The use foo::foo; line seems to do nothing at all, the reference to foo inside main still seems to resolve to the outer foo.

    mod foo {
        pub mod foo {
            pub fn f() {}
        }
    }

    use foo::foo;

    fn main() {
        foo::f();
    }
hw.rs:10:4: 10:10 error: unresolved name: foo::f
hw.rs:10     foo::f();
             ^~~~~~

Should the use item just be illegal if it collides with an existing name? This issue confused me for quite a while with the rust-sdl package's sdl crate that contains an sdl mod.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions