mirror of
https://github.com/openharmony/third_party_rust_rust.git
synced 2026-07-20 22:57:39 -04:00
privacy: Move private-in-public diagnostics for type aliases to the public interface location
This commit is contained in:
committed by
Vadim Petrochenkov
parent
08f0f7c54a
commit
d43b9cb487
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user