1 // aux-build:priv_dep.rs
2 // aux-build:pub_dep.rs
3 // extern-private:priv_dep
4 #![deny(exported_private_dependencies)]
6 // This crate is a private dependency
8 // This crate is a public dependenct
11 use priv_dep::{OtherType, OtherTrait};
14 // Type from private dependency used in private
15 // type - this is fine
20 pub struct PublicType {
22 //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
23 priv_field: OtherType, // Private field - this is fine
24 pub other_field: PubType // Type from public dependency - this is fine
28 pub fn pub_fn(param: OtherType) {}
29 //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
31 fn priv_fn(param: OtherType) {}
34 pub trait MyPubTrait {
37 //~^^^ ERROR trait `priv_dep::OtherTrait` from private dependency 'priv_dep' in public interface
39 pub struct AllowedPrivType {
40 #[allow(exported_private_dependencies)]
41 pub allowed: OtherType