diff options
| author | bors <bors@rust-lang.org> | 2015-12-18 18:54:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-12-18 18:54:52 +0000 |
| commit | ef91cdb140d7dffa4b04f42ab0bc02dc257940e3 (patch) | |
| tree | 440d7f10732b40ed272fbadef1b5c580b1320a2b /src/libsyntax | |
| parent | 29ea4eef9fa6e36f40bc1f31eb1e56bf5941ee72 (diff) | |
| parent | 785cbe02008985f98fee2a013f2d308207ca596f (diff) | |
| download | rust-ef91cdb140d7dffa4b04f42ab0bc02dc257940e3.tar.gz rust-ef91cdb140d7dffa4b04f42ab0bc02dc257940e3.zip | |
Auto merge of #29973 - petrochenkov:privinpub, r=nikomatsakis
Some notes: This patch enforces the rules from [RFC 136](https://github.com/rust-lang/rfcs/blob/master/text/0136-no-privates-in-public.md) and makes "private in public" a module-level concept and not crate-level. Only `pub` annotations are used by the new algorithm, crate-level exported node set produced by `EmbargoVisitor` is not used. The error messages are tweaked accordingly and don't use the word "exported" to avoid confusing people (https://github.com/rust-lang/rust/issues/29668). The old algorithm tried to be extra smart with impls, but it mostly led to unpredictable behavior and bugs like https://github.com/rust-lang/rust/issues/28325. The new algorithm tries to be as simple as possible - an impl is considered public iff its type is public and its trait is public (if presents). A type or trait is considered public if all its components are public, [complications](https://internals.rust-lang.org/t/limits-of-type-inference-smartness/2919) with private types leaking to other crates/modules through trait impls and type inference are deliberately ignored so far. The new algorithm is not recursive and uses the nice new facility `Crate::visit_all_items`! Obsolete pre-1.0 feature `visible_private_types` is removed. This is a [breaking-change]. The two main vectors of breakage are type aliases (https://github.com/rust-lang/rust/issues/28450) and impls (https://github.com/rust-lang/rust/issues/28325). I need some statistics from a crater run (cc @alexcrichton) to decide on the breakage mitigation strategy. UPDATE: All the new errors are reported as warnings controlled by a lint `private_in_public` and lint group `future_incompatible`, but the intent is to make them hard errors eventually. Closes https://github.com/rust-lang/rust/issues/28325 Closes https://github.com/rust-lang/rust/issues/28450 Closes https://github.com/rust-lang/rust/issues/29524 Closes https://github.com/rust-lang/rust/issues/29627 Closes https://github.com/rust-lang/rust/issues/29668 Closes https://github.com/rust-lang/rust/issues/30055 r? @nikomatsakis
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 89f318d0945..0d38411ac93 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -82,7 +82,7 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status ("advanced_slice_patterns", "1.0.0", Some(23121), Active), ("tuple_indexing", "1.0.0", None, Accepted), ("associated_types", "1.0.0", None, Accepted), - ("visible_private_types", "1.0.0", Some(29627), Active), + ("visible_private_types", "1.0.0", None, Removed), ("slicing_syntax", "1.0.0", None, Accepted), ("box_syntax", "1.0.0", Some(27779), Active), ("placement_in_syntax", "1.0.0", Some(27779), Active), @@ -514,7 +514,6 @@ pub enum AttributeGate { pub struct Features { pub unboxed_closures: bool, pub rustc_diagnostic_macros: bool, - pub visible_private_types: bool, pub allow_quote: bool, pub allow_asm: bool, pub allow_log_syntax: bool, @@ -551,7 +550,6 @@ impl Features { Features { unboxed_closures: false, rustc_diagnostic_macros: false, - visible_private_types: false, allow_quote: false, allow_asm: false, allow_log_syntax: false, @@ -1130,7 +1128,6 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &Handler, Features { unboxed_closures: cx.has_feature("unboxed_closures"), rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"), - visible_private_types: cx.has_feature("visible_private_types"), allow_quote: cx.has_feature("quote"), allow_asm: cx.has_feature("asm"), allow_log_syntax: cx.has_feature("log_syntax"), |
