Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDefine and Document what visibility really means #9735
Conversation
alexcrichton
reviewed
Oct 6, 2013
|
|
||
| // XXX: these probably shouldn't be public... | ||
| #[doc(hidden)] | ||
| pub mod shouldnt_be_public { |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Oct 6, 2013
Author
Member
@brson, this is alarming. Modules like std::task::spawn and std::select were accessing std::rt internals, so now they're all accessing the internals through this module instead. I'm not sure if the deprecation plans of the old apis would render this issue moot, but at least in its current state it's pretty obvious you shouldn't be using this module unless you know what you're doing.
This comment has been minimized.
This comment has been minimized.
|
Hmm, I also just remembered that this program is accepted when it shouldn't be, so this isn't quite ready for an r+ yet. use foo::i::A;
pub mod foo {
pub use foo = self::i::A;
mod i {
pub struct A;
}
}
fn main() {} |
This comment has been minimized.
This comment has been minimized.
|
Test case should now be fixed, re-ready again for review. |
alexcrichton
added some commits
Oct 5, 2013
This comment has been minimized.
This comment has been minimized.
|
This looks great to me. |
This comment has been minimized.
This comment has been minimized.
|
r=cmr,pcwalton |
This comment has been minimized.
This comment has been minimized.
|
saw approval from cmr |
This comment has been minimized.
This comment has been minimized.
|
merging alexcrichton/rust/privacy = 7cd6692 into auto |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
fast-forwarding master to auto = 6ddd011 |
bors
added a commit
that referenced
this pull request
Oct 8, 2013
bors
closed this
Oct 8, 2013
bors
merged commit 7cd6692
into
rust-lang:master
Oct 8, 2013
1 check passed
alexcrichton
referenced this pull request
Oct 11, 2013
Closed
No compile-time error when referencing non-public module #8505
SimonSapin
reviewed
Oct 14, 2013
| * A crate needs a global available "helper module" to itself, but it doesn't | ||
| want to expose the helper module as a public API. To accomplish this, the root | ||
| of the crate's hierarchy would have a private module which then internally has | ||
| a "public api". Because the entire crate is an ancestor of the root, then the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
alexcrichton
Oct 14, 2013
Author
Member
Ah yes, good catch! I'll roll this in with a pull coming up soon.
SimonSapin
reviewed
Oct 14, 2013
| current module and its descendants, but the exact meaning of accessing an item | ||
| depends on what the item is. Accessing a module, for example, would mean looking | ||
| inside of it (to import more items). On the other hand, accessing a function | ||
| would mean that it is invoked. |
This comment has been minimized.
This comment has been minimized.
SimonSapin
Oct 14, 2013
Contributor
Doesn’t useing (re-exporting) a function or assigning it to something of type &fn… count as accessing?
This comment has been minimized.
This comment has been minimized.
alexcrichton
Oct 14, 2013
Author
Member
Hm, I believe that you are correct, I'll write up a little extra about re-exportations as well.
alexcrichton commentedOct 6, 2013
This is the culmination and attempted resolution of #8215. The commits have many more details about implementation details and the consequences of this refinement.
I'll point out specific locations which may be possible causes for alarm. In general, I have been very happy with how things have turned out. I'm a little sad that I couldn't remove privacy from resolve as much as I did, but I blame glob imports (although in theory even some of this can be mitigated as well).