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.
Given:
The compiler says:
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 = 12changed 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 = 12in block comments to suggest them as the source of the problem.