@@ -35,6 +35,7 @@ mod types {
3535
3636mod traits {
3737 trait PrivTr { }
38+ impl PrivTr for ( ) { }
3839 pub struct Pub < T > ( T ) ;
3940 pub trait PubTr { }
4041
@@ -45,7 +46,13 @@ mod traits {
4546 pub trait Tr3 {
4647 type Alias : PrivTr ;
4748 //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::Alias`
48- fn f < T : PrivTr > ( arg : T ) { } //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
49+ fn f < T : PrivTr > ( arg : T ) { }
50+ //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
51+ fn g ( ) -> impl PrivTr ;
52+ //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}`
53+ fn h ( ) -> impl PrivTr { }
54+ //~^ ERROR private trait `traits::PrivTr` in public interface
55+ //~| ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
4956 }
5057 impl < T : PrivTr > Pub < T > { } //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
5158 impl < T : PrivTr > PubTr for Pub < T > { } // OK, trait impl predicates
@@ -75,12 +82,24 @@ mod generics {
7582 pub struct Pub < T = u8 > ( T ) ;
7683 trait PrivTr < T > { }
7784 pub trait PubTr < T > { }
85+ impl PrivTr < Priv < ( ) > > for ( ) { }
7886
7987 pub trait Tr1 : PrivTr < Pub > { }
8088 //~^ ERROR trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
8189 pub trait Tr2 : PubTr < Priv > { } //~ ERROR type `generics::Priv` is more private than the item `generics::Tr2`
8290 pub trait Tr3 : PubTr < [ Priv ; 1 ] > { } //~ ERROR type `generics::Priv` is more private than the item `generics::Tr3`
8391 pub trait Tr4 : PubTr < Pub < Priv > > { } //~ ERROR type `generics::Priv` is more private than the item `Tr4`
92+
93+ pub trait Tr5 {
94+ fn required ( ) -> impl PrivTr < Priv < ( ) > > ;
95+ //~^ ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}`
96+ //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}`
97+ fn provided ( ) -> impl PrivTr < Priv < ( ) > > { }
98+ //~^ ERROR private trait `generics::PrivTr<generics::Priv<()>>` in public interface
99+ //~| ERROR private type `generics::Priv<()>` in public interface
100+ //~| ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
101+ //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
102+ }
84103}
85104
86105mod impls {
0 commit comments