1 An incompatible cast was attempted.
3 Erroneous code example:
6 let x = &0u8; // Here, `x` is a `&u8`.
7 let y: u32 = x as u32; // error: casting `&u8` as `u32` is invalid
10 When casting, keep in mind that only primitive types can be cast into each
15 let y: u32 = *x as u32; // We dereference it first and then cast it.
18 For more information about casts, take a look at the Type cast section in
19 [The Reference Book][1].
21 [1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions