-
Notifications
You must be signed in to change notification settings - Fork 13k
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
E0583: Improve error message to help with use vs mod confusion #69492
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
jonas-schievink
added
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Feb 26, 2020
I couldn't find a way to get path to the current module, or names of already parsed modules. It seems that this info isn't explicitly tracked at such an early stage in the parsing, and I'm not sure if it's OK to add it. |
I'm unambiguously in favor of 1 and tepidly positive about 2. The implementation of 2 might be difficult that early on. |
kornelski
added a commit
to kornelski/rust
that referenced
this issue
Mar 1, 2020
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this issue
Mar 5, 2020
Make error message clearer about creating new module This is a partial improvement for rust-lang#69492
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this issue
Mar 5, 2020
Make error message clearer about creating new module This is a partial improvement for rust-lang#69492
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Mar 16, 2020
Make error message clearer about creating new module This is a partial improvement for rust-lang#69492
Current output:
|
estebank
added a commit
to estebank/rust
that referenced
this issue
Oct 20, 2023
Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix rust-lang#69492.
@kornelski resurrected your change under #116992 |
estebank
added a commit
to estebank/rust
that referenced
this issue
Oct 20, 2023
Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix rust-lang#69492.
estebank
added a commit
to estebank/rust
that referenced
this issue
Oct 20, 2023
Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix rust-lang#69492.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 20, 2023
Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix rust-lang#69492.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 21, 2023
Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix rust-lang#69492.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 21, 2023
Rollup merge of rust-lang#116992 - estebank:issue-69492, r=oli-obk Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix rust-lang#69492.
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
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Feedback from a user forum thread. This code:
currently suggests:
This is awkwardly worded. It doesn't clearly explain that this syntax creates a new module. It doesn't guess that the user may have meant
use crate::foo
.I suggest:
Improve wording of the message. "To create a new module
crate::bar::foo
, create "src/bar/foo.rs" file" (to keep it simple, without also suggesting 2015-edition path).If there already is a module with that name, suggest
use
instead.The text was updated successfully, but these errors were encountered: