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

Erroneous code example:

let v = core::ptr::null::<u8>();
v as *const [u8];

First: what are thin and fat pointers?

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

Fat pointers are pointers referencing Dynamically Sized Types (also called DST). DST don't have a statically known size, therefore they can only exist behind some kind of pointers that contain additional information. Slices and trait objects are DSTs. In the case of slices, the additional information the fat pointer holds is their size.

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

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