Skip to content

Improve illegal crate name importation error message #52569

Closed
@csmoe

Description

@csmoe
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions