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

Fixes #30089 #30133

Merged
merged 2 commits into from
Dec 2, 2015
Merged

Fixes #30089 #30133

merged 2 commits into from
Dec 2, 2015

Conversation

jseyfried
Copy link
Contributor

@jseyfried
Copy link
Contributor Author

This fixes regression #30089 created by PR #29530, which caused intra-crate extern crate declarations to be treated like public items, as described in #26775.

In fact, in stable Rust an intra-crate extern crate declaration is treated like a public item during privacy checking (i.e. it is not privacy checked) and when resolving non-glob imports, but not when resolving glob imports. That is, one can always non-glob import an extern crate but one may never glob import an extern crate.

For example, this is legal:

mod foo { extern crate core; }
pub use foo::core;
fn main() {
    use core;
}

but not this:

mod foo { extern crate core; }
pub use foo::*;
fn main() {
    use core;
}

@jseyfried
Copy link
Contributor Author

This behavior used to be caused by this function, which had been used exclusively to create bindings for the Modules corresponding to intra-crate extern crates. The function created private bindings for these modules, which are public; everywhere else, we respect the module's visibility when creating bindings.

When I refactored the function away, bindings for extern crates became public, allowing them to be glob imported. I just checked that the only other time the visibility of an extern crate binding matters is when computing LastPrivate data for the privacy checker, which currently does not check extern crates.

@alexcrichton
Copy link
Member

@bors: r+ 15b1f56

Thanks!

@bors
Copy link
Contributor

bors commented Dec 2, 2015

⌛ Testing commit 15b1f56 with merge d5321f2...

@bors bors merged commit 15b1f56 into rust-lang:master Dec 2, 2015
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

Successfully merging this pull request may close these issues.

3 participants