This discussion in the user forum highlighted an unexpected situation, in which a library exports a fn returning a private struct.
A simple test case is the following:
mod parent {
mod private {
pub fn test() -> Test {
Test
}
#[derive(Debug)]
pub struct Test;
}
pub use self::private::test;
}
use self::parent::test;
fn main() {
println!("{:?}", test());
// The following does not compile
println!("{:?}", self::parent::private::Test);
}
@vitalyd said that it is not the first time this problem occurs, and that maybe there is an issue around.
I see this as a problem, even if minor, of the module infrastructure. Using the 2018 edition does not change the behaviour.
Do you think that this can be considered a bug as well? Should be fixed before Rust 2018? In the end, even if the current behaviour is wrong, fixing it is a breaking change.
EDIT: @vitalyd found the issue in tokio