Skip to content

Improve illegal crate name importation error message #52569

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

Closed
csmoe opened this issue Jul 20, 2018 · 1 comment
Closed

Improve illegal crate name importation error message #52569

csmoe opened this issue Jul 20, 2018 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@csmoe
Copy link
Member

csmoe commented Jul 20, 2018

error: expected one of `;` or `as`, found `-`
 --> src/main.rs:1:17
  |
1 | extern crate foo-bar;
  |                 ^ expected one of `;` or `as` here

error: aborting due to previous error

error: Could not compile `hello`.

To learn more, run the command again with --verbose.

it'll be better to suggest using snake name here:

error: found illegal crate name
 --> src/main.rs:1:17
  |
1 | extern crate foo-bar;
  |              ^^^^^^^ consider changing this to: `foo_bar`

error: aborting due to previous error

error: Could not compile `hello`.

To learn more, run the command again with --verbose.
@csmoe csmoe added the A-diagnostics Area: Messages for errors, warnings, and lints label Jul 20, 2018
@estebank
Copy link
Contributor

Duplicate of #48437. We should not only provide the suggestion, the compiler should continue compiling and if the rest of the code is correct, no other errors should be emitted.

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
Projects
None yet
Development

No branches or pull requests

2 participants