privacy: Move private-in-public diagnostics for type aliases to the public interface location

This commit is contained in:
petrochenkov
2016-07-08 11:44:43 +03:00
committed by Vadim Petrochenkov
parent 08f0f7c54a
commit d43b9cb487
2 changed files with 2 additions and 5 deletions
+2 -3
View File
@@ -877,9 +877,8 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> {
// public, even if the type alias itself is private. So, something
// like `type A = u8; pub fn f() -> A {...}` doesn't cause an error.
if let hir::ItemTy(ref ty, ref generics) = item.node {
let mut check = SearchInterfaceForPrivateItemsVisitor {
min_visibility: ty::Visibility::Public, ..*self
};
let mut check = SearchInterfaceForPrivateItemsVisitor::new(self.tcx,
self.old_error_set);
check.visit_ty(ty);
// If a private type alias with default type parameters is used in public
// interface we must ensure, that the defaults are public if they are actually used.
@@ -245,8 +245,6 @@ mod aliases_priv {
use self::Priv1 as PrivUseAlias;
use self::PrivTr1 as PrivUseAliasTr;
type PrivAlias = Priv2;
//~^ WARN private type in public interface
//~| WARNING hard error
trait PrivTr {
type AssocAlias;
}