Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.1 KiB
Rust
Raw Normal View History

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