Skip to content

Commit

Permalink
privacy: Move private-in-public diagnostics for type aliases to the p…
Browse files Browse the repository at this point in the history
…ublic interface location
  • Loading branch information
petrochenkov committed Aug 10, 2016
1 parent 08f0f7c commit d43b9cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/librustc_privacy/lib.rs
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/private-in-public-warn.rs
Expand Up @@ -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;
}
Expand Down

0 comments on commit d43b9cb

Please sign in to comment.