]> git.proxmox.com Git - rustc.git/blame - src/test/ui/privacy/pub-priv-dep/pub-priv1.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / privacy / pub-priv-dep / pub-priv1.rs
CommitLineData
29967ef6
XL
1// aux-crate:priv:priv_dep=priv_dep.rs
2// aux-build:pub_dep.rs
3c0e092e 3// compile-flags: -Zunstable-options
9fa01778
XL
4#![deny(exported_private_dependencies)]
5
6// This crate is a private dependency
7extern crate priv_dep;
60c5eb7d 8// This crate is a public dependency
9fa01778
XL
9extern crate pub_dep;
10
29967ef6 11use priv_dep::{OtherTrait, OtherType};
9fa01778
XL
12use pub_dep::PubType;
13
14// Type from private dependency used in private
15// type - this is fine
16struct PrivateType {
29967ef6 17 field: OtherType,
9fa01778
XL
18}
19
20pub struct PublicType {
21 pub field: OtherType,
1b1a35ee 22 //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
29967ef6
XL
23 priv_field: OtherType, // Private field - this is fine
24 pub other_field: PubType, // Type from public dependency - this is fine
9fa01778
XL
25}
26
27impl PublicType {
28 pub fn pub_fn(param: OtherType) {}
1b1a35ee 29 //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
9fa01778
XL
30
31 fn priv_fn(param: OtherType) {}
32}
33
34pub trait MyPubTrait {
35 type Foo: OtherTrait;
36}
29967ef6 37//~^^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
9fa01778
XL
38
39pub struct AllowedPrivType {
40 #[allow(exported_private_dependencies)]
29967ef6 41 pub allowed: OtherType,
9fa01778
XL
42}
43
9fa01778 44fn main() {}