-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
resolve: fix the visibility of extern crates #31362
Conversation
eb4e401
to
794df1d
Compare
It doesn't necessarily have to be a hard error immediately, you can mark such reexports with |
9d5ef32
to
9f6dd8e
Compare
@petrochenkov Good point, I added another commit making it a warning. |
cce80e7
to
2168764
Compare
cc @rust-lang/lang |
if name_binding.is_extern_crate() { | ||
let msg = format!("extern crate `{}` is private, and cannot be reexported \ | ||
(error E0364), consider declaring with `pub`", | ||
source); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move the consider...
bit to a note please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wait, you can't it's a lint, nvm
The PR lgtm. I'll wait for a crater run and for the lang team to see this before giving r+ though. |
Seems to match our previous decision on this question, so LGTM as well. |
@@ -68,6 +68,7 @@ extern crate serialize as rustc_serialize; // used by deriving | |||
#[cfg(test)] | |||
extern crate test; | |||
|
|||
#[allow(private_in_public)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is pub extern crate
very buggy? I think it can be used here instead of suppressing the warning. It will report the "pub extern crate
does not work as expected" warning during stage0
, but that's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, for some reason I thought that the warnings weren't ok.
pub extern crate
works fine except that it is not visible to other crates (before this PR).
☔ The latest upstream changes (presumably #31386) made this pull request unmergeable. Please resolve the merge conflicts. |
73e8496
to
f722e31
Compare
This also closes #22146. |
f722e31
to
44d605c
Compare
☔ The latest upstream changes (presumably #31461) made this pull request unmergeable. Please resolve the merge conflicts. |
ea0b0d5
to
3acbd2f
Compare
☔ The latest upstream changes (presumably #31487) made this pull request unmergeable. Please resolve the merge conflicts. |
@brson or @alexcrichton could we get a crater run for this PR please? |
⌛ Testing commit 7ad7065 with merge f06ff1a... |
…ty, r=nikomatsakis This PR changes the visibility of extern crate declarations to match that of items (fixes rust-lang#26775). To avoid breakage, the PR makes it a `public_in_private` lint to reexport a private extern crate, and it adds the lint `inaccessible_extern_crate` for uses of an inaccessible extern crate. The lints can be avoided by making the appropriate `extern crate` declaration public.
⌛ Testing commit 7ad7065 with merge 4a01bac... |
💔 Test failed - auto-linux-64-nopt-t |
@bors: retry On Thu, Feb 25, 2016 at 12:28 AM, bors notifications@github.com wrote:
|
This PR changes the visibility of extern crate declarations to match that of items (fixes #26775).
To avoid breakage, the PR makes it a
public_in_private
lint to reexport a private extern crate, and it adds the lintinaccessible_extern_crate
for uses of an inaccessible extern crate.The lints can be avoided by making the appropriate
extern crate
declaration public.