Skip to content

Extra semicolon in use candidate suggestion #106954

Closed
@ehuss

Description

@ehuss

The span for the new use suggestion (added in #102876) does not include the semicolon, but the suggestion includes a semicolon.

Example:

use std::sync::AtomicU32;

Suggests:

error[E0432]: unresolved import `std::sync::AtomicU32`
 --> src/lib.rs:1:5
  |
1 | use std::sync::AtomicU32;
  |     ^^^^^^^^^^^^^^^^^^^^ no `AtomicU32` in `sync`
  |
help: consider importing this struct instead
  |
1 | use std::sync::atomic::AtomicU32;
  |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

which if applied results in:

use std::sync::atomic::AtomicU32;
;

which won't compile due to the extra semicolon.

I'm not sure if the span needs to be extended, or if the suggestion should just avoid adding the semicolon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions