-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given:
fn main ()
{
/*
//bland
//weconwec'iwe
//wec'oinwec'oinwec
//wec
//wecponjwec
//wecponwec
//let foo: &u32 = panic!();
//*foo = 12
//help out
//more stuff
*/
}
The compiler says:
error[[E0758]](https://doc.rust-lang.org/stable/error-index.html#E0758): unterminated block comment
[--> src/main.rs:3:5
](https://play.rust-lang.org/#) |
3 | / /*
4 | | //bland
5 | | //weconwec'iwe
6 | |
... |
18 | | */
19 | | }
| |_^
For more information about this error, try `rustc --explain E0758`.
error: could not compile `playground` due to previous error
This initially confused me quite a bit because I couldn't figure out why Rust wasn't seeing block comment terminator. Eventually, I realized that the line //*foo = 12
changed from being a commented out line, to starting a nested block comment. Since block comments nest in Rust, I'm used to commenting out blocks without worrying about what's inside of them which made this behaviour surprising.
I'm not sure how practical it is, but it would be cool if we could check for comments like //*foo = 12
in block comments to suggest them as the source of the problem.
zohnannor
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.