Given the following code: link
The current output is:
only `u8` can be cast as `char`, not `i32`
This is not very clear. There are two pieces of background information the user needs here:
chars are Unicode scalar values, which are any integer value from 0 to 0xD7FF and 0xE000 to 0x10FFFF. Only u8 can be statically guaranteed to meet this requirement so only u8 can be cast to char.
- char::from_u32 is probably what the user wants, if they are interested in non-ASCII values.
The user is directed to further information available at rustc --explain E0604 and https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions, neither of which explains either of those two points.
Given the following code: link
The current output is:
This is not very clear. There are two pieces of background information the user needs here:
chars are Unicode scalar values, which are any integer value from 0 to 0xD7FF and 0xE000 to 0x10FFFF. Only u8 can be statically guaranteed to meet this requirement so only u8 can be cast to char.The user is directed to further information available at
rustc --explain E0604and https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions, neither of which explains either of those two points.