]> git.proxmox.com Git - rustc.git/blame - src/librustc_error_codes/error_codes/E0604.md
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0604.md
CommitLineData
60c5eb7d
XL
1A cast to `char` was attempted on a type other than `u8`.
2
3Erroneous code example:
4
5```compile_fail,E0604
60u32 as char; // error: only `u8` can be cast as `char`, not `u32`
7```
8
9As the error message indicates, only `u8` can be cast into `char`. Example:
10
11```
12let c = 86u8 as char; // ok!
13assert_eq!(c, 'V');
14```
15
16For more information about casts, take a look at the Type cast section in
17[The Reference Book][1].
18
19[1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions