1
1
//@ aux-crate:priv:priv_dep=priv_dep.rs
2
2
//@ aux-build:pub_dep.rs
3
+ //@ aux-crate:priv:pm=pm.rs
3
4
//@ compile-flags: -Zunstable-options
5
+
6
+ // Basic behavior check of exported_private_dependencies from either a public
7
+ // dependency or a private one.
8
+
4
9
#![ deny( exported_private_dependencies) ]
5
10
6
11
// This crate is a private dependency
7
- extern crate priv_dep;
12
+ // FIXME: This should trigger.
13
+ pub extern crate priv_dep;
8
14
// This crate is a public dependency
9
15
extern crate pub_dep;
16
+ // This crate is a private dependency
17
+ extern crate pm;
10
18
11
19
use priv_dep:: { OtherTrait , OtherType } ;
12
20
use pub_dep:: PubType ;
@@ -25,7 +33,10 @@ pub struct PublicType {
25
33
}
26
34
27
35
impl PublicType {
28
- pub fn pub_fn ( param : OtherType ) { }
36
+ pub fn pub_fn_param ( param : OtherType ) { }
37
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
38
+
39
+ pub fn pub_fn_return ( ) -> OtherType { OtherType }
29
40
//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
30
41
31
42
fn priv_fn ( param : OtherType ) { }
@@ -36,9 +47,61 @@ pub trait MyPubTrait {
36
47
}
37
48
//~^^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
38
49
50
+ pub trait WithSuperTrait : OtherTrait { }
51
+ //~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
52
+
53
+ pub trait PubLocalTraitWithAssoc {
54
+ type X ;
55
+ }
56
+
57
+ pub struct PrivateAssoc ;
58
+ impl PubLocalTraitWithAssoc for PrivateAssoc {
59
+ type X = OtherType ;
60
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
61
+ }
62
+
63
+ pub fn in_bounds < T : OtherTrait > ( x : T ) { unimplemented ! ( ) }
64
+ //~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
65
+
66
+ pub fn private_in_generic ( ) -> std:: num:: Saturating < OtherType > { unimplemented ! ( ) }
67
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
68
+
69
+ pub static STATIC : OtherType = OtherType ;
70
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
71
+
72
+ pub const CONST : OtherType = OtherType ;
73
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
74
+
75
+ pub type Alias = OtherType ;
76
+ //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
77
+
78
+ pub struct PublicWithPrivateImpl ;
79
+
80
+ // FIXME: This should trigger.
81
+ // See https://github.com/rust-lang/rust/issues/71043
82
+ impl OtherTrait for PublicWithPrivateImpl { }
83
+
84
+ pub trait PubTraitOnPrivate { }
85
+
86
+ // FIXME: This should trigger.
87
+ // See https://github.com/rust-lang/rust/issues/71043
88
+ impl PubTraitOnPrivate for OtherType { }
89
+
39
90
pub struct AllowedPrivType {
40
91
#[ allow( exported_private_dependencies) ]
41
92
pub allowed : OtherType ,
42
93
}
43
94
95
+ // FIXME: This should trigger.
96
+ pub use priv_dep:: m;
97
+ // FIXME: This should trigger.
98
+ pub use pm:: fn_like;
99
+ // FIXME: This should trigger.
100
+ pub use pm:: PmDerive ;
101
+ // FIXME: This should trigger.
102
+ pub use pm:: pm_attr;
103
+
104
+ // FIXME: This should trigger.
105
+ pub use priv_dep:: E :: V1 ;
106
+
44
107
fn main ( ) { }
0 commit comments