]> git.lizzy.rs Git - rust.git/commit
auto merge of #10583 : alexcrichton/rust/privacy-reexport, r=pcwalton
authorbors <bors@rust-lang.org>
Fri, 22 Nov 2013 18:06:35 +0000 (10:06 -0800)
committerbors <bors@rust-lang.org>
Fri, 22 Nov 2013 18:06:35 +0000 (10:06 -0800)
commitcd9069ca734fe89fe446c16dc821e54b973506f5
treea9790b0cbc22fd1dd535bd6105a8e7913e93ee9a
parentd3cb24b1fe3fd0e31cccf8ca3c53470f747bae0c
parent93a0dec2029f5c0658478187984eddf3afcc84b3
auto merge of #10583 : alexcrichton/rust/privacy-reexport, r=pcwalton

I added a test case which does not compile today, and required changes on
privacy's side of things to get right. Additionally, this moves a good bit of
logic which did not belong in reachability into privacy.

All of reachability should solely be responsible for determining what the
reachable surface area of a crate is given the exported surface area (where the
exported surface area is that which is usable by external crates).

Privacy will now correctly figure out what's exported by deeply looking
through reexports. Previously if a module were reexported under another name,
nothing in the module would actually get exported in the executable. I also
consolidated the phases of privacy to be clearer about what's an input to what.
The privacy checking pass no longer uses the notion of an "all public" path, and
the embargo visitor is no longer an input to the checking pass.

Currently the embargo visitor is built as a saturating analysis because it's
unknown what portions of the AST are going to get re-exported.

This also cracks down on exported methods from impl blocks and trait blocks. If you implement a private trait, none of the symbols are exported, and if you have an impl for a private type none of the symbols are exported either. On the other hand, if you implement a public trait for a private type, the symbols are still exported. I'm unclear on whether this last part is correct, but librustc will fail to link unless it's in place.