File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
src/test/ui/privacy/pub-priv-dep Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ pub struct OtherType ;
Original file line number Diff line number Diff line change
1
+ // aux-build:priv_dep.rs
2
+ #![ feature( public_private_dependencies) ]
3
+ #![ deny( leaked_private_dependency) ]
4
+
5
+ // This crate is a private dependency
6
+ extern crate priv_dep;
7
+
8
+ use priv_dep:: OtherType ;
9
+
10
+ // Type from private dependency used in private
11
+ // type - this is fine
12
+ struct PrivateType {
13
+ field : OtherType
14
+ }
15
+
16
+ pub struct PublicType {
17
+ pub field : OtherType ,
18
+ //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface [leaked_private_dependency]
19
+ //~| WARNING this was previously accepted
20
+ priv_field : OtherType ,
21
+ }
22
+
23
+ impl PublicType {
24
+ pub fn pub_fn ( param : OtherType ) { }
25
+ //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface [leaked_private_dependency]
26
+ //~| WARNING this was previously accepted
27
+
28
+ fn priv_fn ( param : OtherType ) { }
29
+ }
30
+
31
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
2
+ --> $DIR/pub-priv1.rs:17:5
3
+ |
4
+ LL | pub field: OtherType,
5
+ | ^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ note: lint level defined here
8
+ --> $DIR/pub-priv1.rs:3:9
9
+ |
10
+ LL | #![deny(leaked_private_dependency)]
11
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
12
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
13
+ = note: for more information, see issue #44663 <https://github.com/rust-lang/rust/issues/44663>
14
+
15
+ error: type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
16
+ --> $DIR/pub-priv1.rs:24:5
17
+ |
18
+ LL | pub fn pub_fn(param: OtherType) {}
19
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20
+ |
21
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22
+ = note: for more information, see issue #44663 <https://github.com/rust-lang/rust/issues/44663>
23
+
24
+ error: aborting due to 2 previous errors
25
+
You can’t perform that action at this time.
0 commit comments