Skip to content
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

Cannot glob import the crate root. #31484

Closed
retep998 opened this issue Feb 8, 2016 · 2 comments
Closed

Cannot glob import the crate root. #31484

retep998 opened this issue Feb 8, 2016 · 2 comments
Labels
T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@retep998
Copy link
Member

retep998 commented Feb 8, 2016

The following does not compile.

mod foo {
    use *;
    pub fn meow(){bar()}
}
pub fn bar(){}
fn main(){foo::meow()}

Also tried use ::*; use {*}; and use ::{*};.

I'm not sure why we don't support this case. Maybe nobody felt anyone would ever use it? It sure would be nice to have in winapi.

@eddyb eddyb added the A-lang label Feb 8, 2016
@keeperofdakeys
Copy link
Contributor

If I understand correctly, you should be able to do use super::*;. http://is.gd/xipavD

@retep998
Copy link
Member Author

retep998 commented Feb 9, 2016

Yes that is a workaround but not a solution. It's rather unfriendly to arbitrarily nested modules as you'd end up with things like use super::super::super::*;. We allow importing items directly from the crate root, and we allow glob imports in other paths that are relative to the crate root, so missing the simple case of glob importing the crate root itself seems like an oversight.

Manishearth added a commit to Manishearth/rust that referenced this issue Oct 26, 2016
bors added a commit that referenced this issue Oct 28, 2016
Support `use *;` and `use ::*;`.

Fixes #31484.
r? @nrc
@steveklabnik steveklabnik added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Mar 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants