Open
Description
This issue is
I implemented a suggestion for typoed crate or module in #89347. However there are still some edge cases.
Given the following code:
The current output is:
error[E0433]: failed to resolve: use of undeclared crate or module `my_cor`
--> $DIR/extern-prelude-from-opaque-fail.rs:10:5
|
LL | my_cor::mem::drop(0);
| ^^^^^^ use of undeclared crate or module `my_cor`
|
help: there is a crate or module with a similar name
|
LL | my_core::mem::drop(0);
| ~~~~~~~
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.
However if you apply this suggestion, you get a compiler error like the following.
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
--> $DIR/extern-prelude-from-opaque-fail.rs:10:5
|
LL | my_core::mem::drop(0);
| ^^^^^^^ use of undeclared crate or module `my_core`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.
Ideally the output should look like:
The compiler shouldn't suggest a crate or module name which you can't use.
error[E0433]: failed to resolve: use of undeclared crate or module `my_cor`
--> $DIR/extern-prelude-from-opaque-fail.rs:10:5
|
LL | my_cor::mem::drop(0);
| ^^^^^^ use of undeclared crate or module `my_cor`
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.
#89347 (comment) might help you.
Other things to do: #89347 (comment)
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: A structured suggestion resulting in incorrect code.Diagnostics: An error or lint that needs small tweaks.Relevant to the compiler team, which will review and decide on the PR/issue.