-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.
Description
Here is some code:
#![crate_type="lib"]
pub mod hello {
pub use self::inner::foo;
mod inner {
pub fn foo() -> Bar { Bar }
pub struct Bar;
}
}when I try to compile it, I get:
% rustc /tmp/p.rsb_
/tmp/p.rs:7:25: 7:28 warning: private type in exported type signature, #[warn(visible_private_types)] on by default
/tmp/p.rs:7 pub fn foo() -> Bar { Bar }
^~~
Now, maybe in the above code the problem is obvious, but in the original context where this arose, the inner was in a separate file from hello, and I did a lot of head scratching, saying "but I said pub struct Bar..."
I think that if the lint is complaining about a type that is itself declared public, then the lint should have a note indicating at least one module along the chain that is private. And maybe a note saying "you can fix this by either doing pub use self::inner::Bar or by making the mod inner public."
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.