-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
suggest declaring modules when file found but module not defined #142730
Conversation
@rustbot label A-diagnostics |
This comment has been minimized.
This comment has been minimized.
rustbot has assigned @petrochenkov. Use |
This comment has been minimized.
This comment has been minimized.
7174cb4
to
397c51b
Compare
c1a4a41
to
18ca511
Compare
18ca511
to
184ef96
Compare
Could you also add a new test exercising the various naming schemes (like |
184ef96
to
2f55dce
Compare
2f55dce
to
3583423
Compare
im not sure how to make a test with a normal directory structure? everything seems to use #[path = auxiliary/]... |
Well, |
@rustbot ready |
tests/ui/modules/module_suggestion_when_module_not_found/success.rs
Outdated
Show resolved
Hide resolved
tests/ui/modules/module_suggestion_when_module_not_found/suggestion.rs
Outdated
Show resolved
Hide resolved
tests/ui/modules/module_suggestion_when_module_not_found/submodule/compiletest-ignore-dir
Outdated
Show resolved
Hide resolved
f2c196e
to
62c2fa3
Compare
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
62c2fa3
to
8fef7b9
Compare
r=me with #142730 (comment) addressed. |
Reminder, once the PR becomes ready for a review, use |
8fef7b9
to
57cb419
Compare
@bors r=petrochenkov |
@bend-n: 🔑 Insufficient privileges: Not in reviewers |
@bors r+ |
Rollup of 9 pull requests Successful merges: - #139858 (New const traits syntax) - #140809 (Reduce special casing for the panic runtime) - #142730 (suggest declaring modules when file found but module not defined) - #142806 (Normalize before computing ConstArgHasType goal in new solver) - #143046 (const validation: properly ignore zero-sized UnsafeCell) - #143092 (const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology) - #143096 (tag_for_variant: properly pass TypingEnv) - #143104 (hir_analysis: prohibit `dyn PointeeSized`) - #143106 (gce: don't ICE on non-local const) Failed merges: - #143036 (Remove support for `dyn*` from the compiler) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #142730 - bend-n:suggest_declaring_modules_when_file_found_but_module_not_defined, r=petrochenkov suggest declaring modules when file found but module not defined 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 ```rust 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: ```text = help: you may have forgotten to declare the module `thing`. use `mod thing` in this file to declare this module. ```
Rollup of 9 pull requests Successful merges: - rust-lang/rust#139858 (New const traits syntax) - rust-lang/rust#140809 (Reduce special casing for the panic runtime) - rust-lang/rust#142730 (suggest declaring modules when file found but module not defined) - rust-lang/rust#142806 (Normalize before computing ConstArgHasType goal in new solver) - rust-lang/rust#143046 (const validation: properly ignore zero-sized UnsafeCell) - rust-lang/rust#143092 (const checks for lifetime-extended temporaries: avoid 'top-level scope' terminology) - rust-lang/rust#143096 (tag_for_variant: properly pass TypingEnv) - rust-lang/rust#143104 (hir_analysis: prohibit `dyn PointeeSized`) - rust-lang/rust#143106 (gce: don't ICE on non-local const) Failed merges: - rust-lang/rust#143036 (Remove support for `dyn*` from the compiler) r? `@ghost` `@rustbot` modify labels: rollup
suggests declaring modules when a module is found but not defined, i.e
or
which currently is just
but now would have this nice help: