2020-06-27 15:36:35 -05:00
|
|
|
// aux-crate:priv:priv_dep=priv_dep.rs
|
|
|
|
// aux-build:pub_dep.rs
|
2021-11-03 22:00:00 -05:00
|
|
|
// compile-flags: -Zunstable-options
|
2019-01-20 21:04:22 -06:00
|
|
|
#![deny(exported_private_dependencies)]
|
2019-01-13 17:50:24 -06:00
|
|
|
|
|
|
|
// This crate is a private dependency
|
|
|
|
extern crate priv_dep;
|
2019-12-05 18:26:21 -06:00
|
|
|
// This crate is a public dependency
|
2019-01-13 19:37:27 -06:00
|
|
|
extern crate pub_dep;
|
2019-01-13 17:50:24 -06:00
|
|
|
|
2020-06-27 15:36:35 -05:00
|
|
|
use priv_dep::{OtherTrait, OtherType};
|
2019-01-13 19:37:27 -06:00
|
|
|
use pub_dep::PubType;
|
2019-01-13 17:50:24 -06:00
|
|
|
|
|
|
|
// Type from private dependency used in private
|
|
|
|
// type - this is fine
|
|
|
|
struct PrivateType {
|
2020-06-27 15:36:35 -05:00
|
|
|
field: OtherType,
|
2019-01-13 17:50:24 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct PublicType {
|
|
|
|
pub field: OtherType,
|
2020-09-02 02:40:56 -05:00
|
|
|
//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
|
2020-06-27 15:36:35 -05:00
|
|
|
priv_field: OtherType, // Private field - this is fine
|
|
|
|
pub other_field: PubType, // Type from public dependency - this is fine
|
2019-01-13 17:50:24 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl PublicType {
|
|
|
|
pub fn pub_fn(param: OtherType) {}
|
2020-09-02 02:40:56 -05:00
|
|
|
//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface
|
2019-01-13 17:50:24 -06:00
|
|
|
|
|
|
|
fn priv_fn(param: OtherType) {}
|
|
|
|
}
|
|
|
|
|
2019-01-13 19:37:27 -06:00
|
|
|
pub trait MyPubTrait {
|
|
|
|
type Foo: OtherTrait;
|
|
|
|
}
|
2020-09-07 04:01:45 -05:00
|
|
|
//~^^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
|
2019-01-13 19:37:27 -06:00
|
|
|
|
2019-01-30 14:37:27 -06:00
|
|
|
pub struct AllowedPrivType {
|
|
|
|
#[allow(exported_private_dependencies)]
|
2020-06-27 15:36:35 -05:00
|
|
|
pub allowed: OtherType,
|
2019-01-30 14:37:27 -06:00
|
|
|
}
|
|
|
|
|
2019-01-13 17:50:24 -06:00
|
|
|
fn main() {}
|