2019-01-13 17:50:24 -06:00
|
|
|
// aux-build:priv_dep.rs
|
2019-01-13 19:37:27 -06:00
|
|
|
// aux-build:pub_dep.rs
|
2019-01-30 14:33:50 -06:00
|
|
|
// compile-flags: --extern-private priv_dep
|
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-01-13 19:37:27 -06:00
|
|
|
// This crate is a public dependenct
|
|
|
|
extern crate pub_dep;
|
2019-01-13 17:50:24 -06:00
|
|
|
|
2019-01-13 19:37:27 -06:00
|
|
|
use priv_dep::{OtherType, OtherTrait};
|
|
|
|
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 {
|
|
|
|
field: OtherType
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct PublicType {
|
|
|
|
pub field: OtherType,
|
2019-01-13 21:29:52 -06:00
|
|
|
//~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
|
2019-01-13 17:50:24 -06:00
|
|
|
//~| WARNING this was previously accepted
|
2019-01-13 19:37:27 -06: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) {}
|
2019-01-13 21:29:52 -06:00
|
|
|
//~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
|
2019-01-13 17:50:24 -06:00
|
|
|
//~| WARNING this was previously accepted
|
|
|
|
|
|
|
|
fn priv_fn(param: OtherType) {}
|
|
|
|
}
|
|
|
|
|
2019-01-13 19:37:27 -06:00
|
|
|
pub trait MyPubTrait {
|
|
|
|
type Foo: OtherTrait;
|
|
|
|
}
|
2019-01-13 21:29:52 -06:00
|
|
|
//~^^^ ERROR trait `priv_dep::OtherTrait` from private dependency 'priv_dep' in public interface
|
2019-01-13 19:37:27 -06:00
|
|
|
//~| WARNING this was previously accepted
|
|
|
|
|
|
|
|
|
2019-01-13 17:50:24 -06:00
|
|
|
fn main() {}
|