Skip to content

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

Closed
@m-ou-se

Description

@m-ou-se
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.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.D-papercutDiagnostics: An error or lint that needs small tweaks.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