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

Superfluous error message for a private pub use #32708

Closed
bfops opened this issue Apr 3, 2016 · 3 comments
Closed

Superfluous error message for a private pub use #32708

bfops opened this issue Apr 3, 2016 · 3 comments

Comments

@bfops
Copy link
Contributor

bfops commented Apr 3, 2016

This causes an error:

mod foo {}

mod bar {
  pub use foo; // error: `foo` is private, and cannot be reexported
}

Since foo is no more accessible than it was before, this doesn't seem like an actual instance of E0365.

@jonas-schievink
Copy link
Contributor

I think this is intentional, but a better error message (maybe an additional note or help) seems useful since this often confuses people

@cgaebel
Copy link
Contributor

cgaebel commented Apr 3, 2016

I want to use this to refer to f and g as mod1::f, mod1::g in my crate, but export them as mod2::f and mod2::g for external use.

Regardless of my intentions, no "decrease of privacy" or other morally objectionable things are happening here. It's just an error message triggering in a case it's not needed.

@petrochenkov
Copy link
Contributor

petrochenkov commented Apr 3, 2016

Long story short: 1) this works as intended, because reasons RFC 136 says so 2) wait for an implementation of RFC 1422 and write

mod foo {}

mod bar {
  pub(super) use foo;
}

Links:
rust-lang/rfcs#136
rust-lang/rfcs#200
https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2014-09-16.md#rfc-public-items
#28450
rust-lang/rfcs#1422

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants