Content-Length: 24524 | pFad | https://doc.rust-lang.org/std/iter/../clone/../../../std/../error_codes/./E0607.html

E0607 - 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 E0607

A cast between a thin and a wide pointer was attempted.

Erroneous code example:

#![allow(unused)]
fn main() {
let v = core::ptr::null::<u8>();
v as *const [u8];
}

First: what are thin and wide pointers?

Thin pointers are “simple” pointers: they are purely a reference to a memory address.

Wide pointers are pointers referencing Dynamically Sized Types (also called DSTs). DSTs don’t have a statically known size, therefore they can only exist behind some kind of pointer that contains additional information. For example, slices and trait objects are DSTs. In the case of slices, the additional information the wide pointer holds is their size.

To fix this error, don’t try to cast directly between thin and wide pointers.

For more information about type casts, take a look at the section of the The Rust Reference on type cast expressions.









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/std/iter/../clone/../../../std/../error_codes/./E0607.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy