Open
Description
If a private type is reexported at some public location, the Rust compiler will report the private location when referring to the type. It'd be more helpful if the compiler reported the public alias for it.
This was reported by Coda Hale on Twitter.
Update by pnkfelix: here is a standalone bit of code illustrating the problem. (play):
mod a {
mod m { pub struct PrivateName; }
pub use m::PrivateName as PublicName;
}
fn main() {
// a::m::PrivateName; // would error, "module `m` is private"
a::PublicName;
a::PublicName.clone();
}
As of nightly 2019-06-17, this issues the diagnostic:
> error[E0599]: no method named `clone` found for type `a::m::PrivateName` [...]
^^^^^^^^^^^^^^^^^
|
(author of `fn main` wants to see `a::PublicName` here)
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Name/path resolution done by `rustc_resolve` specificallyCategory: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint; hard to understand for new users.Call for participation: Hard difficulty. Experience needed to fix: A lot.Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.