Skip to content

Glob imports don't work inside a mod #21993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mdinger opened this issue Feb 6, 2015 · 2 comments
Closed

Glob imports don't work inside a mod #21993

mdinger opened this issue Feb 6, 2015 · 2 comments
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically

Comments

@mdinger
Copy link
Contributor

mdinger commented Feb 6, 2015

Move it outside and it works fine. Perhaps similar to #18083 and #21831

mod my_mod {
    use Enum::*;

    enum Enum {
        A,
        B,
    }
}

fn main() {}
<anon>:2:9: 2:13 error: unresolved import `Enum::*`. Maybe a missing `extern crate Enum`?
<anon>:2     use Enum::*;
                 ^~~~
error: aborting due to previous error
playpen: application terminated with error code 101
@steveklabnik steveklabnik added the A-resolve Area: Name/path resolution done by `rustc_resolve` specifically label Feb 6, 2015
@alexcrichton
Copy link
Member

This is actually because use always takes global paths instead of relative. In this case the code needs to be changed to:

mod my_mod {
    use my_mod::Enum::*;

    enum Enum {
        A,
        B,
    }
}

fn main() {}

@mdinger
Copy link
Contributor Author

mdinger commented Feb 6, 2015

Oh. It used to work. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically
Projects
None yet
Development

No branches or pull requests

3 participants