-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
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
elichai
Metadata
Metadata
Assignees
Labels
A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team