@@ -32,6 +32,33 @@ pub struct PublicType {
32
32
pub other_field : PubType , // Type from public dependency - this is fine
33
33
}
34
34
35
+ pub struct PublicTuple (
36
+ pub OtherType ,
37
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface [exported_private_dependencies]
38
+ OtherType ,
39
+ PubType ,
40
+ ) ;
41
+
42
+ pub enum PublicEnum {
43
+ OtherType ,
44
+ ActualOtherType ( OtherType , PubType ) ,
45
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface [exported_private_dependencies]
46
+ ActualOtherTypeStruct {
47
+ field : OtherType ,
48
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface [exported_private_dependencies]
49
+ other_field : PubType ,
50
+ } ,
51
+ }
52
+
53
+ pub struct PublicGenericType < T , U > ( pub T , U ) ;
54
+ pub type ReexportedPublicGeneric = PublicGenericType < OtherType , ( ) > ;
55
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
56
+ pub type ReexportedPrivateGeneric = PublicGenericType < ( ) , OtherType > ;
57
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
58
+
59
+ pub struct PublicGenericBoundedType < T : OtherTrait > ( T ) ;
60
+ //~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
61
+
35
62
impl PublicType {
36
63
pub fn pub_fn_param ( param : OtherType ) { }
37
64
//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
@@ -44,8 +71,21 @@ impl PublicType {
44
71
45
72
pub trait MyPubTrait {
46
73
type Foo : OtherTrait ;
74
+ //~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
75
+
76
+ fn required_impl_trait ( ) -> impl OtherTrait ;
77
+ //~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
78
+
79
+ fn provided_impl_trait ( ) -> impl OtherTrait { OtherType }
80
+ //~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
81
+ //~| ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
82
+
83
+ fn required_concrete ( ) -> OtherType ;
84
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
85
+
86
+ fn provided_concrete ( ) -> OtherType { OtherType }
87
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
47
88
}
48
- //~^^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
49
89
50
90
pub trait WithSuperTrait : OtherTrait { }
51
91
//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
@@ -63,6 +103,12 @@ impl PubLocalTraitWithAssoc for PrivateAssoc {
63
103
pub fn in_bounds < T : OtherTrait > ( x : T ) { unimplemented ! ( ) }
64
104
//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
65
105
106
+ pub fn private_return_impl_trait ( ) -> impl OtherTrait { OtherType }
107
+ //~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
108
+
109
+ pub fn private_return ( ) -> OtherType { OtherType }
110
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
111
+
66
112
pub fn private_in_generic ( ) -> std:: num:: Saturating < OtherType > { unimplemented ! ( ) }
67
113
//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
68
114
@@ -75,6 +121,9 @@ pub const CONST: OtherType = OtherType;
75
121
pub type Alias = OtherType ;
76
122
//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
77
123
124
+ pub type AliasOfAlias = priv_dep:: PubPub ;
125
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
126
+
78
127
pub struct PublicWithPrivateImpl ;
79
128
80
129
impl OtherTrait for PublicWithPrivateImpl { }
@@ -86,6 +135,22 @@ impl PubTraitOnPrivate for OtherType {}
86
135
//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
87
136
//~| ERROR type `OtherType` from private dependency 'priv_dep' in public interface
88
137
138
+ pub struct PublicWithStdImpl ;
139
+
140
+ impl From < OtherType > for PublicWithStdImpl {
141
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
142
+ fn from ( val : OtherType ) -> Self { Self }
143
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
144
+ }
145
+
146
+ impl From < PublicWithStdImpl > for OtherType {
147
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
148
+ //~| ERROR type `OtherType` from private dependency 'priv_dep' in public interface
149
+ fn from ( val : PublicWithStdImpl ) -> Self { Self }
150
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
151
+ //~| ERROR type `OtherType` from private dependency 'priv_dep' in public interface
152
+ }
153
+
89
154
pub struct AllowedPrivType {
90
155
#[ allow( exported_private_dependencies) ]
91
156
pub allowed : OtherType ,
@@ -103,4 +168,13 @@ pub use pm::pm_attr;
103
168
pub use priv_dep:: E :: V1 ;
104
169
//~^ ERROR variant `V1` from private dependency 'priv_dep' is re-exported
105
170
171
+ pub use priv_dep:: Unit ;
172
+ //~^ ERROR type alias `Unit` from private dependency 'priv_dep' is re-exported
173
+ pub use priv_dep:: PubPub ;
174
+ //~^ ERROR type alias `PubPub` from private dependency 'priv_dep' is re-exported
175
+ pub use priv_dep:: PubPriv ;
176
+ //~^ ERROR type alias `PubPriv` from private dependency 'priv_dep' is re-exported
177
+ pub use priv_dep:: OtherType as Renamed ;
178
+ //~^ ERROR struct `Renamed` from private dependency 'priv_dep' is re-exported
179
+
106
180
fn main ( ) { }
0 commit comments