]> git.lizzy.rs Git - rust.git/commitdiff
privacy: Move private-in-public diagnostics for type aliases to the public interface...
authorpetrochenkov <vadim.petrochenkov@gmail.com>
Fri, 8 Jul 2016 08:44:43 +0000 (11:44 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Wed, 10 Aug 2016 21:32:07 +0000 (00:32 +0300)
src/librustc_privacy/lib.rs
src/test/compile-fail/private-in-public-warn.rs

index 876c578aa486abf66aa185674e0d056314919c2b..7f5f09aa6b6a97fab7eac8883efa261def1ee756 100644 (file)
@@ -877,9 +877,8 @@ fn substituted_alias_visibility(&self, item: &hir::Item, path: &hir::Path)
         // 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.
index b0cace1164894b16694ea209a71cf68bd1167ae9..6a756bfc7e3a607a4de23f716e66b6306b047b69 100644 (file)
@@ -245,8 +245,6 @@ trait PrivTr1<T = u8> {
     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;
     }