1 // Private types and traits are not allowed in interfaces of associated types.
2 // This test also ensures that the checks are performed even inside private modules.
4 #![feature(associated_type_defaults)]
5 #![feature(type_alias_impl_trait)]
10 impl PrivTr for Priv {}
11 pub trait PubTrAux1<T> {}
15 impl<T> PubTrAux1<T> for u8 {}
16 impl PubTrAux2 for u8 {
18 //~^ ERROR private type `Priv` in public interface
21 // "Private-in-public in associated types is hard error" in RFC 2145
22 // applies only to the aliased types, not bounds.
25 //~^ WARN private trait `PrivTr` in public interface
26 //~| WARN this was previously accepted
27 type Alias2: PubTrAux1<Priv> = u8;
28 //~^ WARN private type `Priv` in public interface
29 //~| WARN this was previously accepted
30 type Alias3: PubTrAux2<A = Priv> = u8;
31 //~^ WARN private type `Priv` in public interface
32 //~| WARN this was previously accepted
35 //~^ ERROR private type `Priv` in public interface
38 fn infer_exist() -> Self::Exist;
42 //~^ ERROR private type `Priv` in public interface
44 type Exist = impl PrivTr;
45 //~^ ERROR private trait `PrivTr` in public interface
46 fn infer_exist() -> Self::Exist {