On 12-10-23 8:10 AM, Patrick Walton wrote:

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.

Does it? I thought it'd just involve shifting char into the set of types subject to integer-literal type inference.

Maybe the default (not enough information to infer) would have to change from int to char, for 'x', but otherwise I'd be surprised if it would be a deep change.

Lindsey can probably enlighten us more here..

-Graydon

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to