Files
rust/tests/ui/privacy/pub-priv-dep/shared_indirect.rs
Trevor Gross aca5b5dd52 If the parent dependency is private, treat dependents as private
Currently, marking a dependency private does not automatically make all
its child dependencies private. Resolve this by making its children
private by default as well.

This also resolves some FIXMEs for tests that are intended to fail but
previously passed.

[1]: https://github.com/rust-lang/rust/pull/135501#issuecomment-2620242419
2025-02-21 17:37:03 +00:00

29 lines
713 B
Rust

//@ aux-crate:priv:shared=shared.rs
//@ aux-crate:priv:indirect1=indirect1.rs
//@ compile-flags: -Zunstable-options
// A shared dependency, where it is only indirectly public.
//
// shared_indirect
// /\
// (PRIVATE) / | (PRIVATE)
// / |
// indirect1 | |
// (PRIVATE) | |
// indirect2 | |
// \ |
// (public) \ /
// \/
// shared
#![crate_type = "lib"]
#![deny(exported_private_dependencies)]
extern crate shared;
extern crate indirect1;
pub fn leaks_priv() -> shared::Shared {
//~^ ERROR type `Shared` from private dependency 'shared' in public interface
shared::Shared
}