E0097
Comment inside an interpolation
ErrorA // comment cannot appear inside an interpolation. The error is reported at the //. Write the comment on a line of its own, or after the string.
Why
A comment runs to the end of its line, so it would take the closing } and the rest of the string with it. The compiler offers no fix, since it cannot tell where the comment should go.
Broken
fn main() {
let total = 3
print("{total // the sum}")
}
What sisu says
error[E0097]: a comment cannot appear inside an interpolation --> E0097.sisu:3:19 | 3 | print("{total // the sum}") | ^^ sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0097
Fixed
fn main() {
let total = 3
// the sum
print("{total}")
}
Sisu