Skip to content
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

Suggestion for missing match arm includes a copy of a comment. #100272

Closed
m-ou-se opened this issue Aug 8, 2022 · 0 comments · Fixed by #100305
Closed

Suggestion for missing match arm includes a copy of a comment. #100272

m-ou-se opened this issue Aug 8, 2022 · 0 comments · Fixed by #100305
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-bug Category: This is a bug. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@m-ou-se
Copy link
Member

m-ou-se commented Aug 8, 2022

fn main() {
    match Some(1) {
        Some(1) => {}
        // hello
        Some(_) => {}
    }
}

This produces the following help suggestion:

help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
5   ~         Some(_) => {}
6   +         // hello
7   +         None => todo!()
    |

The suggestion includes a copy of the // hello comment, which seems wrong.

@m-ou-se m-ou-se 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. C-bug Category: This is a bug. A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` D-papercut Diagnostics: An error or lint that needs small tweaks. labels Aug 8, 2022
@TaKO8Ki TaKO8Ki self-assigned this Aug 8, 2022
@bors bors closed this as completed in 467e7aa Aug 9, 2022
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 A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-bug Category: This is a bug. D-papercut Diagnostics: An error or lint that needs small tweaks. 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.

2 participants