@@ -35,6 +35,7 @@ mod types {
35
35
36
36
mod traits {
37
37
trait PrivTr { }
38
+ impl PrivTr for ( ) { }
38
39
pub struct Pub < T > ( T ) ;
39
40
pub trait PubTr { }
40
41
@@ -45,7 +46,13 @@ mod traits {
45
46
pub trait Tr3 {
46
47
type Alias : PrivTr ;
47
48
//~^ 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}`
49
56
}
50
57
impl < T : PrivTr > Pub < T > { } //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
51
58
impl < T : PrivTr > PubTr for Pub < T > { } // OK, trait impl predicates
@@ -75,12 +82,24 @@ mod generics {
75
82
pub struct Pub < T = u8 > ( T ) ;
76
83
trait PrivTr < T > { }
77
84
pub trait PubTr < T > { }
85
+ impl PrivTr < Priv < ( ) > > for ( ) { }
78
86
79
87
pub trait Tr1 : PrivTr < Pub > { }
80
88
//~^ ERROR trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
81
89
pub trait Tr2 : PubTr < Priv > { } //~ ERROR type `generics::Priv` is more private than the item `generics::Tr2`
82
90
pub trait Tr3 : PubTr < [ Priv ; 1 ] > { } //~ ERROR type `generics::Priv` is more private than the item `generics::Tr3`
83
91
pub trait Tr4 : PubTr < Pub < Priv > > { } //~ ERROR type `generics::Priv` is more private than the item `Tr4`
92
+ pub trait Tr5 {
93
+ fn required ( ) -> impl PrivTr < Priv < ( ) > > ;
94
+ //~^ ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}`
95
+ //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}`
96
+ fn provided ( ) -> impl PrivTr < Priv < ( ) > > { }
97
+ //~^ ERROR private trait `generics::PrivTr<generics::Priv<()>>` in public interface
98
+ //~| ERROR private type `generics::Priv<()>` in public interface
99
+ //~| ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
100
+ //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
101
+ }
102
+
84
103
}
85
104
86
105
mod impls {
0 commit comments