Closed
Description
Playground: https://play.rust-lang.org/?gist=d9e9fe07b83f07a3f9b908c0c7405a99&version=nightly
#![deny(unreachable_pub)]
mod one {
mod two {
pub struct S;
}
pub use self::two::S;
}
pub use self::one::S;
error: unreachable `pub` item
--> src/lib.rs:7:5
|
7 | pub use self::two::S;
| ---^^^^^^^^^^^^^^^^^^
| |
| help: consider restricting its visibility: `pub(crate)`
|
note: lint level defined here
--> src/lib.rs:1:32
|
1 | #![crate_type = "lib"] #![deny(unreachable_pub)]
| ^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
#![deny(unreachable_pub)]
mod one {
mod two {
pub struct S;
}
pub(crate) use self::two::S;
}
pub use self::one::S;
error[E0364]: `S` is private, and cannot be reexported
--> src/lib.rs:9:9
|
9 | pub use self::one::S;
| ^^^^^^^^^^^^
|
note: consider marking `S` as `pub` in the imported module
--> src/lib.rs:9:9
|
9 | pub use self::one::S;
| ^^^^^^^^^^^^
A single level of re-export works:
#![deny(unreachable_pub)]
mod one {
pub struct S;
}
pub use self::one::S;
Finished dev [unoptimized + debuginfo] target(s) in 0.27 secs