about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-07-07 01:32:13 +0000
committerbors <bors@rust-lang.org>2017-07-07 01:32:13 +0000
commitb80b659d674fa19b2b48142e4f7974544bc8d5f6 (patch)
tree69ad9cba4eb4766925363fd617b58fcf5587a13c /src/rustllvm/PassWrapper.cpp
parentd2ebb12a1d6f6599f9171a65a2160e523b53ccdf (diff)
parenta27f8cf8a36f3d69267ed25602504144fab1d896 (diff)
downloadrust-b80b659d674fa19b2b48142e4f7974544bc8d5f6.tar.gz
rust-b80b659d674fa19b2b48142e4f7974544bc8d5f6.zip
Auto merge of #42125 - petrochenkov:privty, r=nikomatsakis
Check types for privacy

This PR implements late post factum checking of type privacy, as opposed to early preventive "private-in-public" checking.
This will allow to turn private-in-public checks into a lint and make them more heuristic-based, and more aligned with what people may expect (e.g. reachability-based behavior).

Types are privacy-checked if they are written explicitly, and also if they are inferred as expression or pattern types.
This PR checks "semantic" types and does it unhygienically, this significantly restricts what macros 2.0 (as implemented in https://github.com/rust-lang/rust/pull/40847) can do (sorry @jseyfried) - they still can use private *names*, but can't use private *types*.
This is the most conservative solution, but hopefully it's temporary and can be relaxed in the future, probably using macro contexts of expression/pattern spans.

Traits are also checked in preparation for [trait aliases](https://github.com/rust-lang/rust/issues/41517), which will be able to leak private traits, and macros 2.0 which will be able to leak pretty much anything.

This is a [breaking-change], but the code that is not contrived and can be broken by this patch should be guarded by `private_in_public` lint. [Previous crater run](https://github.com/rust-lang/rust/issues/34537#issuecomment-262865768) discovered a few abandoned crates that weren't updated since `private_in_public` has been introduced in 2015.

cc https://github.com/rust-lang/rust/issues/34537 https://internals.rust-lang.org/t/lang-team-minutes-private-in-public-rules/4504
Fixes https://github.com/rust-lang/rust/issues/30476
Fixes https://github.com/rust-lang/rust/issues/33479

cc @nikomatsakis
r? @eddyb
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions