Open
Description
I tried this code:
use foo::bbb;
fn main() {
let bar = bbb(); // cannot specify any type signature for `bar`
}
mod foo {
use bar::Bar;
pub fn bbb() -> Bar {
Bar
}
mod bar {
pub struct Bar;
}
}
I expected to see this happen: Rust complain about the leaking of private structs.
Instead, this happened: It compiles, this has caused it to creep into some crates. For instance, this is in tonic 0.4.3
Fixing this would likely be a harsh breaking change (as I mentioned, it's already in at least 1 crate, possibly many more). So it would probably have to live across an edition change. It's possibly too late to get a fix in for Rust 2021.
For now, I've suggested it as a possible lint in clippy