E0091
Escape that is not a Unicode scalar value
Error\u{...} names a Unicode scalar value: a code point from 0 to 10FFFF, except the surrogates D800 to DFFF. Any other value is an error, reported over the escape.
Why
A surrogate is half of a pair in UTF-16 and is not a character. A value above 10FFFF is outside Unicode. Neither can be encoded as UTF-8, which text always is.
Broken
fn main() {
let c = '\u{D800}'
print(c)
}
What sisu says
error[E0091]: `\u{D800}` is not a Unicode scalar value --> E0091.sisu:2:14 | 2 | let c = '\u{D800}' | ^^^^^^^^ | = help: scalar values run from 0 to 10FFFF, without D800 to DFFF sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0091
Fixed
fn main() {
let c = '\u{E4}'
print(c)
}
Sisu