Skip to content

suggest declaring modules when file found but module not defined #142730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bend-n
Copy link
Contributor

@bend-n bend-n commented Jun 19, 2025

suggests declaring modules when a module is found but not defined, i.e

├── main.rs: `use thing::thang;`
└── thing.rs: `struct thang`

or

├── main.rs: `use thing::thang;`
└── thing
    └── mod.rs: `struct thang`

which currently is just

error[E0432]: unresolved import `yeah`
 --> src/main.rs:1:1
  |
1 | use thing::thang;
  |     ^^^^^ use of unresolved module or unlinked crate `thing`
  |

but now would have this nice help:

= help: you may have forgotten to declare the module `thing`. use `mod thing` in this file to declare this module.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 19, 2025
@bend-n
Copy link
Contributor Author

bend-n commented Jun 19, 2025

@rustbot label A-diagnostics

@rustbot rustbot added the A-diagnostics Area: Messages for errors, warnings, and lints label Jun 19, 2025
@rust-log-analyzer

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants