diff options
Diffstat (limited to 'tests/ui/privacy/where-priv-type.rs')
-rw-r--r-- | tests/ui/privacy/where-priv-type.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/privacy/where-priv-type.rs b/tests/ui/privacy/where-priv-type.rs index 66ee9c4bb..2e0a6b3e7 100644 --- a/tests/ui/privacy/where-priv-type.rs +++ b/tests/ui/privacy/where-priv-type.rs @@ -3,8 +3,14 @@ #![crate_type = "lib"] #![feature(generic_const_exprs)] +#![feature(type_privacy_lints)] #![allow(incomplete_features)] +#![warn(private_bounds)] +#![warn(private_interfaces)] +// In this test both old and new private-in-public diagnostic were emitted. +// Old diagnostic will be deleted soon. +// See https://rust-lang.github.io/rfcs/2145-type-privacy.html. struct PrivTy; trait PrivTr {} @@ -19,6 +25,7 @@ impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; } pub struct S //~^ WARNING private type `PrivTy` in public interface //~| WARNING hard error +//~| WARNING type `PrivTy` is more private than the item `S` where PrivTy: {} @@ -27,6 +34,7 @@ where pub enum E //~^ WARNING private type `PrivTy` in public interface //~| WARNING hard error +//~| WARNING type `PrivTy` is more private than the item `E` where PrivTy: {} @@ -35,6 +43,7 @@ where pub fn f() //~^ WARNING private type `PrivTy` in public interface //~| WARNING hard error +//~| WARNING type `PrivTy` is more private than the item `f` where PrivTy: {} @@ -42,12 +51,14 @@ where impl S //~^ ERROR private type `PrivTy` in public interface +//~| WARNING type `PrivTy` is more private than the item `S` where PrivTy: { pub fn f() //~^ WARNING private type `PrivTy` in public interface //~| WARNING hard error + //~| WARNING type `PrivTy` is more private than the item `S::f` where PrivTy: {} @@ -79,6 +90,7 @@ where { type AssocTy = Const<{ my_const_fn(U) }>; //~^ ERROR private type + //~| WARNING type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy` fn assoc_fn() -> Self::AssocTy { Const } |