Closed
Description
use crate::foo::Bar;
mod foo {use crate::bar::Bar;}
pub mod bar {pub struct Bar;}
this kind of thing happens pretty often for me, where I try importing from the wrong module.
This gives me the following error:
error[E0603]: struct `Bar` is private
--> src/main.rs:3:17
|
3 | use crate::foo::Bar;
| ^^^
this is misleading because most Rust mental models don't consider use
statements to be private instances, they just work that way.
Ideally, this error would notice that it's a private use statement, and instead backtrack it to find the actual path that should be used.
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: An error or lint that needs small tweaks.Relevant to the compiler team, which will review and decide on the PR/issue.