diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-09-19 12:30:07 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-09-22 20:05:45 -0700 |
| commit | e9ad12c0cae5c43ada6641c7dc840a0fbe5010a2 (patch) | |
| tree | 21b3e62d447bda4ccda606894edb66ca965bccee /src/libsyntax | |
| parent | 43fd619819b334b8548dca98797bd4c8078636cb (diff) | |
| download | rust-e9ad12c0cae5c43ada6641c7dc840a0fbe5010a2.tar.gz rust-e9ad12c0cae5c43ada6641c7dc840a0fbe5010a2.zip | |
librustc: Forbid private types in public APIs.
This breaks code like:
struct Foo {
...
}
pub fn make_foo() -> Foo {
...
}
Change this code to:
pub struct Foo { // note `pub`
...
}
pub fn make_foo() -> Foo {
...
}
The `visible_private_types` lint has been removed, since it is now an
error to attempt to expose a private type in a public API. In its place
a `#[feature(visible_private_types)]` gate has been added.
Closes #16463.
RFC #48.
[breaking-change]
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 5203ed0a073..cd0fa184a09 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -69,6 +69,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("advanced_slice_patterns", Active), ("tuple_indexing", Active), ("associated_types", Active), + ("visible_private_types", Active), // if you change this list without updating src/doc/rust.md, cmr will be sad @@ -100,6 +101,7 @@ pub struct Features { pub overloaded_calls: bool, pub rustc_diagnostic_macros: bool, pub import_shadowing: bool, + pub visible_private_types: bool, } impl Features { @@ -109,6 +111,7 @@ impl Features { overloaded_calls: false, rustc_diagnostic_macros: false, import_shadowing: false, + visible_private_types: false, } } } @@ -479,6 +482,7 @@ pub fn check_crate(span_handler: &SpanHandler, krate: &ast::Crate) -> (Features, overloaded_calls: cx.has_feature("overloaded_calls"), rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"), import_shadowing: cx.has_feature("import_shadowing"), + visible_private_types: cx.has_feature("visible_private_types"), }, unknown_features) } |
