Skip to content

Commit d43b9cb

Browse files
committed
privacy: Move private-in-public diagnostics for type aliases to the public interface location
1 parent 08f0f7c commit d43b9cb

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/librustc_privacy/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -877,9 +877,8 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> {
877877
// public, even if the type alias itself is private. So, something
878878
// like `type A = u8; pub fn f() -> A {...}` doesn't cause an error.
879879
if let hir::ItemTy(ref ty, ref generics) = item.node {
880-
let mut check = SearchInterfaceForPrivateItemsVisitor {
881-
min_visibility: ty::Visibility::Public, ..*self
882-
};
880+
let mut check = SearchInterfaceForPrivateItemsVisitor::new(self.tcx,
881+
self.old_error_set);
883882
check.visit_ty(ty);
884883
// If a private type alias with default type parameters is used in public
885884
// interface we must ensure, that the defaults are public if they are actually used.

src/test/compile-fail/private-in-public-warn.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,6 @@ mod aliases_priv {
245245
use self::Priv1 as PrivUseAlias;
246246
use self::PrivTr1 as PrivUseAliasTr;
247247
type PrivAlias = Priv2;
248-
//~^ WARN private type in public interface
249-
//~| WARNING hard error
250248
trait PrivTr {
251249
type AssocAlias;
252250
}

0 commit comments

Comments
 (0)