Skip to content

exhustiveness checking in commented code suggests duplicating comments #101762

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

Closed
pro465 opened this issue Sep 13, 2022 · 2 comments
Closed

exhustiveness checking in commented code suggests duplicating comments #101762

pro465 opened this issue Sep 13, 2022 · 2 comments
Labels
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.

Comments

@pro465
Copy link
Contributor

pro465 commented Sep 13, 2022

Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=enum%20S%20%7B%0A%20%20%20%20O%2C%0A%20%20%20%20P%2C%0A%20%20%20%20Q%2C%0A%7D%0A%0Afn%20main()%20%7B%0A%20%20%20%20match%20S%3A%3AO%20%7B%0A%20%20%20%20%20%20%20%20S%3A%3AO%20%3D%3E%20%7B%7D%0A%20%20%20%20%20%20%20%20%2F*%0A%20%20%20%20%20%20%20%20%20*%20stuff%2C%20stuff%2C%0A%20%20%20%20%20%20%20%20%20*%20siherfhhsf%0A%20%20%20%20%20%20%20%20%20*%20syrrehhgsdiiey%0A%20%20%20%20%20%20%20%20%20*%2F%0A%20%20%20%20%20%20%20%20S%3A%3AP%20%3D%3E%20%7B%7D%0A%20%20%20%20%7D%0A%7D

The current output is:

Compiling playground v0.0.1 (/playground)
error[[E0004]](https://doc.rust-lang.org/stable/error-index.html#E0004): non-exhaustive patterns: `Q` not covered
 --> src/main.rs:8:11
  |
8 |     match S::O {
  |           ^^^^ pattern `Q` not covered
  |
note: `S` defined here
 --> src/main.rs:4:5
  |
1 | enum S {
  |      -
...
4 |     Q,
  |     ^ not covered
  = note: the matched value is of type `S`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
  |
15~         S::P => {}
16+         /*
17+          * stuff, stuff,
18+          * siherfhhsf
19+          * syrrehhgsdiiey
20+          */
21+         Q => todo!()
  |

Ideally the output should look like:

<proposed output>
@pro465 pro465 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. labels Sep 13, 2022
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Sep 13, 2022

I think this has already been fixed in #100305.

@pro465
Copy link
Contributor Author

pro465 commented Sep 14, 2022

@TaKO8Ki oh yeah it does seem to be fixed in nightly, thanks for notifying!

@pro465 pro465 closed this as completed Sep 14, 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 T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants