Sisu
E0095

} in a string

ErrorSafe fix

Built from the repository at commit a8614dc.

In the text of a string literal a { opens an interpolation, and the } that matches it closes it. Any other } is an error, reported at the }. Write \} for a literal }, as \{ writes a literal {.

Why

A stray } most often means a { is missing, and the compiler cannot tell where the interpolation should have started. Escaping both braces keeps the two symmetric. The fix writes \}, which is safe: it leaves the text as written.

Broken

fn main() {
    print("a}b")
}

What sisu says

error[E0095]: a `}` in a string must be escaped
 --> E0095.sisu:2:13
  |
2 |     print("a}b")
  |             ^
  |
help: write `\}`
  |
2 |     print("a\}b")
  |             +

sisu: 1 error
sisu: for more on a code, run `sisu explain <code>`: E0095

Fixed

fn main() {
    print("a\}b")
}