]> git.lizzy.rs Git - rust.git/blob - src/test/ui/privacy/pub-priv-dep/pub-priv1.rs
Rename external_private_dependency to exported_private_dependencies
[rust.git] / src / test / ui / privacy / pub-priv-dep / pub-priv1.rs
1  // aux-build:priv_dep.rs
2  // aux-build:pub_dep.rs
3  // compile-flags: --extern-public=pub_dep
4 #![feature(public_private_dependencies)]
5 #![deny(exported_private_dependencies)]
6
7 // This crate is a private dependency
8 extern crate priv_dep;
9 // This crate is a public dependenct
10 extern crate pub_dep;
11
12 use priv_dep::{OtherType, OtherTrait};
13 use pub_dep::PubType;
14
15 // Type from private dependency used in private
16 // type - this is fine
17 struct PrivateType {
18     field: OtherType
19 }
20
21 pub struct PublicType {
22     pub field: OtherType,
23     //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
24     //~| WARNING this was previously accepted
25     priv_field: OtherType, // Private field - this is fine
26     pub other_field: PubType // Type from public dependency - this is fine
27 }
28
29 impl PublicType {
30     pub fn pub_fn(param: OtherType) {}
31     //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
32     //~| WARNING this was previously accepted
33
34     fn priv_fn(param: OtherType) {}
35 }
36
37 pub trait MyPubTrait {
38     type Foo: OtherTrait;
39 }
40 //~^^^ ERROR trait `priv_dep::OtherTrait` from private dependency 'priv_dep' in public interface
41 //~| WARNING this was previously accepted
42
43
44 fn main() {}