Content-Length: 13013 | pFad | https://doc.rust-lang.org/reference/../../std/../error_codes/./E0606.html

E0606 - Error codes index

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error code E0606

An incompatible cast was attempted.

Erroneous code example:

#![allow(unused)]
fn main() {
let x = &0u8; // Here, `x` is a `&u8`.
let y: u32 = x as u32; // error: casting `&u8` as `u32` is invalid
}

When casting, keep in mind that only primitive types can be cast into each other. Example:

#![allow(unused)]
fn main() {
let x = &0u8;
let y: u32 = *x as u32; // We dereference it first and then cast it.
}

For more information about casts, take a look at the Type cast section in The Reference Book.









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://doc.rust-lang.org/reference/../../std/../error_codes/./E0606.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy