Confusing error & warning message when importing a function and using it as if it were a module #81232
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
When importing a function and using it (accidentally!) as if it were a module, rustc says the name doesn't exist. This lead me to quite a bit of head-scratching. I would humbly suggest either clarifying the error message in such a case, or adding a 'note:' with such a clarification.
I tried this code (playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e9602022b26521481d93c47608503185):
I expected to see this happen:
Instead, this happened:
Meta
rustc --version --verbose
:(this also repros on the latest nightly in the playground, as of writing)
Not sure how difficult it would be to implement this, but if it's a reasonable 'beginner' issue, I'd be down to try to implement this.
The text was updated successfully, but these errors were encountered: