Skip to content

Commit

Permalink
Rename external_private_dependency to exported_private_dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Feb 1, 2019
1 parent dfd2669 commit 3fa3647
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/librustc/lint/builtin.rs
Expand Up @@ -126,7 +126,7 @@ declare_lint! {
}

declare_lint! {
pub EXTERNAL_PRIVATE_DEPENDENCY,
pub EXPORTED_PRIVATE_DEPENDENCIES,
Warn,
"public interface leaks type from a private dependency"
}
Expand Down Expand Up @@ -411,7 +411,7 @@ impl LintPass for HardwiredLints {
TRIVIAL_CASTS,
TRIVIAL_NUMERIC_CASTS,
PRIVATE_IN_PUBLIC,
EXTERNAL_PRIVATE_DEPENDENCY,
EXPORTED_PRIVATE_DEPENDENCIES,
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
INVALID_TYPE_PARAM_DEFAULT,
CONST_ERR,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/lib.rs
Expand Up @@ -230,7 +230,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
edition: None,
},
FutureIncompatibleInfo {
id: LintId::of(EXTERNAL_PRIVATE_DEPENDENCY),
id: LintId::of(EXPORTED_PRIVATE_DEPENDENCIES),
reference: "issue #44663 <https://github.com/rust-lang/rust/issues/44663>",
edition: None,
},
Expand Down
10 changes: 6 additions & 4 deletions src/librustc_privacy/lib.rs
Expand Up @@ -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::EXTERNAL_PRIVATE_DEPENDENCY,
self.tcx.lint_node(lint::builtin::EXPORTED_PRIVATE_DEPENDENCIES,
self.item_id,
self.span,
&format!("{} `{}` from private dependency '{}' in public \
Expand Down Expand Up @@ -1726,9 +1726,6 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Lrc<AccessLevels> {
fn check_mod_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
let empty_tables = ty::TypeckTables::empty(None);

let public_crates: FxHashSet<CrateNum> = tcx.sess.opts.extern_public.iter().flat_map(|c| {
tcx.crates().iter().find(|&&krate| &tcx.crate_name(krate) == c).cloned()
}).collect();

// Check privacy of names not checked in previous compilation stages.
let mut visitor = NamePrivacyVisitor {
Expand Down Expand Up @@ -1765,6 +1762,11 @@ fn privacy_access_levels<'tcx>(
queries::check_mod_privacy::ensure(tcx, tcx.hir().local_def_id(module));
}

let public_crates: FxHashSet<CrateNum> = tcx.sess.opts.extern_public.iter().flat_map(|c| {
tcx.crates().iter().find(|&&krate| &tcx.crate_name(krate) == c).cloned()
}).collect();


// Build up a set of all exported items in the AST. This is a set of all
// items which are reachable from external crates based on visibility.
let mut visitor = EmbargoVisitor {
Expand Down
Expand Up @@ -9,7 +9,7 @@

// Without ![feature(public_private_dependencies)],
// this should do nothing/
#![deny(external_private_dependency)]
#![deny(exported_private_dependencies)]

extern crate pub_dep;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/privacy/pub-priv-dep/pub-priv1.rs
Expand Up @@ -2,7 +2,7 @@
// aux-build:pub_dep.rs
// compile-flags: --extern-public=pub_dep
#![feature(public_private_dependencies)]
#![deny(external_private_dependency)]
#![deny(exported_private_dependencies)]

// This crate is a private dependency
extern crate priv_dep;
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/privacy/pub-priv-dep/pub-priv1.stderr
Expand Up @@ -7,8 +7,8 @@ LL | pub field: OtherType,
note: lint level defined here
--> $DIR/pub-priv1.rs:5:9
|
LL | #![deny(external_private_dependency)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #![deny(exported_private_dependencies)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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>

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/privacy/pub-priv-dep/std-pub.rs
Expand Up @@ -4,7 +4,7 @@
// run-pass

#![feature(public_private_dependencies)]
#![deny(external_private_dependency)]
#![deny(exported_private_dependencies)]

pub struct PublicType {
pub field: Option<u8>
Expand Down

0 comments on commit 3fa3647

Please sign in to comment.