On 10/23/12 4:17 AM, Henri Sivonen wrote:
That would work for match but doesn’t work for using char literals for
initializing u8 arrays and the like. Absent the ability to use char
literals the same way unsuffixed integer literals work, I guess the
easiest path forward is for me to generate hex integer literals
instead of char literals. :-(

Note that casts are considered const exprs, so "'x' as u8" does work in a constant position.

But yes, I've wanted a shorter syntax for char-literals-as-bytes as well. Something like 'x'u8 perhaps? Or I guess we could just infer it, but that adds a fair amount of complexity to the typechecker.

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to