diff options
| -rw-r--r-- | src/librustc/lint/builtin.rs | 4 | ||||
| -rw-r--r-- | src/librustc/session/config.rs | 2 | ||||
| -rw-r--r-- | src/librustc_lint/builtin.rs | 2 | ||||
| -rw-r--r-- | src/librustc_lint/lib.rs | 2 | ||||
| -rw-r--r-- | src/librustc_privacy/lib.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/auxiliary/pub_dep.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-public_private_dependencies.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/privacy/pub-priv-dep/pub-priv1.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr | 4 |
9 files changed, 32 insertions, 13 deletions
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 1651175525e..473214a04c8 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -126,7 +126,7 @@ declare_lint! { } declare_lint! { - pub LEAKED_PRIVATE_DEPENDENCY, + pub EXTERNAL_PRIVATE_DEPENDENCY, Warn, "public interface leaks type from a private dependency" } @@ -411,7 +411,7 @@ impl LintPass for HardwiredLints { TRIVIAL_CASTS, TRIVIAL_NUMERIC_CASTS, PRIVATE_IN_PUBLIC, - LEAKED_PRIVATE_DEPENDENCY, + EXTERNAL_PRIVATE_DEPENDENCY, PUB_USE_OF_PRIVATE_EXTERN_CRATE, INVALID_TYPE_PARAM_DEFAULT, CONST_ERR, diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 16d3d332e40..635ac6dcc48 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1928,7 +1928,7 @@ pub fn build_session_options_and_crate_config( let mut extern_public: FxHashSet<String> = matches.opt_strs("extern-public"). iter().cloned().collect(); - // TODO - come up with a better way of handling this + // FIXME - come up with a better way of handling this extern_public.insert("core".to_string()); extern_public.insert("std".to_string()); diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index b0846822b24..46e784c4099 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1883,5 +1883,3 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements { } } - - diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index e2e63b418c7..66e6368e83d 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -230,7 +230,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { edition: None, }, FutureIncompatibleInfo { - id: LintId::of(LEAKED_PRIVATE_DEPENDENCY), + id: LintId::of(EXTERNAL_PRIVATE_DEPENDENCY), reference: "issue #44663 <https://github.com/rust-lang/rust/issues/44663>", edition: None, }, diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index f37d0ce4260..7b5b06257ce 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1496,7 +1496,7 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { if self.leaks_private_dep(def_id) { - self.tcx.lint_node(lint::builtin::LEAKED_PRIVATE_DEPENDENCY, + self.tcx.lint_node(lint::builtin::EXTERNAL_PRIVATE_DEPENDENCY, self.item_id, self.span, &format!("{} `{}` from private dependency '{}' in public \ diff --git a/src/test/ui/feature-gates/auxiliary/pub_dep.rs b/src/test/ui/feature-gates/auxiliary/pub_dep.rs new file mode 100644 index 00000000000..3ebafd953ad --- /dev/null +++ b/src/test/ui/feature-gates/auxiliary/pub_dep.rs @@ -0,0 +1 @@ +pub struct PubType; diff --git a/src/test/ui/feature-gates/feature-gate-public_private_dependencies.rs b/src/test/ui/feature-gates/feature-gate-public_private_dependencies.rs new file mode 100644 index 00000000000..bd27c844fc6 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-public_private_dependencies.rs @@ -0,0 +1,20 @@ +// This test is different from other feature gate tests. +// Instead of checking that an error occurs without the feature gate, +// it checks that *no* errors/warnings occurs without the feature gate. +// This is due to the fact that 'public_private_dependencies' just enables +// a lint, so disabling it shouldn't cause any code to stop compiling. + +// run-pass +// aux-build:pub_dep.rs + +// Without ![feature(public_private_dependencies)], +// this should do nothing/ +#![deny(external_private_dependency)] + +extern crate pub_dep; + +pub struct Foo { + pub field: pub_dep::PubType +} + +fn main() {} diff --git a/src/test/ui/privacy/pub-priv-dep/pub-priv1.rs b/src/test/ui/privacy/pub-priv-dep/pub-priv1.rs index f82c1ad1c93..16a59dff878 100644 --- a/src/test/ui/privacy/pub-priv-dep/pub-priv1.rs +++ b/src/test/ui/privacy/pub-priv-dep/pub-priv1.rs @@ -2,7 +2,7 @@ // aux-build:pub_dep.rs // compile-flags: --extern-public=pub_dep #![feature(public_private_dependencies)] -#![deny(leaked_private_dependency)] +#![deny(external_private_dependency)] // This crate is a private dependency extern crate priv_dep; @@ -20,7 +20,7 @@ struct PrivateType { pub struct PublicType { pub field: OtherType, - //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface [leaked_private_dependency] + //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface //~| WARNING this was previously accepted priv_field: OtherType, // Private field - this is fine pub other_field: PubType // Type from public dependency - this is fine @@ -28,7 +28,7 @@ pub struct PublicType { impl PublicType { pub fn pub_fn(param: OtherType) {} - //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface [leaked_private_dependency] + //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface //~| WARNING this was previously accepted fn priv_fn(param: OtherType) {} @@ -37,7 +37,7 @@ impl PublicType { pub trait MyPubTrait { type Foo: OtherTrait; } -//~^^^ ERROR trait `priv_dep::OtherTrait` from private dependency 'priv_dep' in public interface [leaked_private_dependency] +//~^^^ ERROR trait `priv_dep::OtherTrait` from private dependency 'priv_dep' in public interface //~| WARNING this was previously accepted diff --git a/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr b/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr index fa74eb2265d..9e5bffa6eea 100644 --- a/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr +++ b/src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr @@ -7,8 +7,8 @@ LL | pub field: OtherType, note: lint level defined here --> $DIR/pub-priv1.rs:5:9 | -LL | #![deny(leaked_private_dependency)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![deny(external_private_dependency)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #44663 <https://github.com/rust-lang/rust/issues/44663> |
