Skip to content

Extra semicolon in use candidate suggestion #106954

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ehuss opened this issue Jan 16, 2023 · 0 comments · Fixed by #106962
Closed

Extra semicolon in use candidate suggestion #106954

ehuss opened this issue Jan 16, 2023 · 0 comments · Fixed by #106962
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ehuss
Copy link
Contributor

ehuss commented Jan 16, 2023

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.

@ehuss ehuss added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. labels Jan 16, 2023
@bors bors closed this as completed in e6e7c39 Jan 17, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant