Closed
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.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsDiagnostics: Confusing error or lint that should be reworked.Diagnostics: An error or lint that needs small tweaks.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Relevant to the compiler team, which will review and decide on the PR/issue.