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> {}
12 pub trait PubTrAux2 { type A; }
14 // "Private-in-public in associated types is hard error" in RFC 2145
15 // applies only to the aliased types, not bounds.
17 //~^ WARN private trait `m::PrivTr` in public interface
18 //~| WARN this was previously accepted
19 //~| WARN private type `m::Priv` in public interface
20 //~| WARN this was previously accepted
22 type Alias2: PubTrAux1<Priv> = u8;
23 type Alias3: PubTrAux2<A = Priv> = u8;
26 //~^ ERROR private type `m::Priv` in public interface
29 fn infer_exist() -> Self::Exist;
33 //~^ ERROR private type `m::Priv` in public interface
35 type Exist = impl PrivTr;
36 //~^ ERROR private trait `m::PrivTr` in public interface
37 fn infer_exist() -> Self::Exist { Priv }