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

Can't pub use as a module defined in the current module #5950

Closed
brson opened this issue Apr 19, 2013 · 6 comments
Closed

Can't pub use as a module defined in the current module #5950

brson opened this issue Apr 19, 2013 · 6 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@brson
Copy link
Contributor

brson commented Apr 19, 2013

pub use local_alias = local;

mod local { }

fn main() {}
error: failed to resolve imports
test.rs:1:8: 1:14 error: unresolved import
test.rs:1 pub use local_alias = local;
                  ^~~~~~
error: aborting due to 2 previous errors
@brson
Copy link
Contributor Author

brson commented May 29, 2013

Nominating well defined.

@Blei
Copy link
Contributor

Blei commented Jul 9, 2013

This seems to be fixed.

@graydon
Copy link
Contributor

graydon commented Aug 22, 2013

Not quite:

r.rs:1:12: 1:32 error: unresolved import: found `local` in `???` but it is private
r.rs:1     pub use local_alias = local;
                   ^~~~~~~~~~~~~~~~~~~~
r.rs:1:12: 1:32 error: failed to resolve import `local`
r.rs:1     pub use local_alias = local;
                   ^~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous error

If you put pub on the inner module, it works. I think this is actually working as intended: the 'pub' on the item being re-exported is itself the indication of whether it can be seen from outside.

Curiously, you can't use it locally (with no pub anywhere in the file) either. This feels not entirely well defined? Or else I'm not well informed enough to address it. Leaving open until we have Patrick around for subsequent triage.

@nikomatsakis
Copy link
Contributor

My two cents:

  1. It makes sense that a pub use'd item must be pub, since that
    means you don't have to search for a pub use.
  2. It seems like use local_alias = local ought to work though.

@pnkfelix
Copy link
Member

accepted for well-defined milestone

@alexcrichton
Copy link
Member

This is working now. I think my extraction of privacy from resolve has fixed this.

Removing all tags and flagging as needstest.

alexcrichton added a commit that referenced this issue Dec 19, 2013
Closes #5806
Closes #5950
Closes #7178
Closes #8259
Closes #8578
Closes #8851
Closes #9129
Closes #10412
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 10, 2020
Add a lint to prevent `create_dir` from being used

This closes rust-lang#5950
changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

6 participants