Skip to content

Re-exporting items using a glob breaks if the module imports another module #4865

Closed
@z0w0

Description

@z0w0
priv mod say {
    pub fn hello() { io::println(~"hello"); }
}

pub mod hello {
    use say;

    pub fn hello() {
        say::hello();
    }
}

pub use hello::*; // doesn't work - `pub use hello::hello;` does

fn main() {
    hello();
}

Results in this error when compiling:

error: failed to resolve imports
a.rs:13:8: 13:17 error: unresolved import
a.rs:13 pub use hello::*; // doesn't work - `pub use hello::hello;` does
                ^~~~~~~~~
a.rs:6:5: 6:9 error: unresolved import
a.rs:6  use say;
            ^~~~

As mentioned in the code, explicitly re-exporting items works but is not a good alternative for when you have hundreds of items (including variants) in a module. Changing the say module to public doesn't fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyP-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions