Can someone explain to me how `Box::from_raw` and `Box::into_raw` are able to work with unsized types? Aren't we 100% for sure loosing the size/vtable? /cc @Gankro
So you're saying `mem::size_of::<*const [u8]>` is double width, right? Shouldn't the compiler be disallowing a cast from a fat raw pointer to a thin raw pointer? If `Box::<[u8]>::into_raw` goes through C, that will cause big problems right?
-
-
Not being able to cast from a slice to a c-array would kinda blow? Box<[T]> barely exists so not much thought is put into it.
-
Isn't `slice.as_ptr()` around for that exact purpose?
- 4 more replies
New conversation -
-
-
Well, *const [u8] is not a type you should even pass to C, but yeah all pointers to unsized types become fat, even raw pointers
-
Context: I'm noticing that we're forcing SQLite to copy some buffers that it shouldn't need to, but its destructor function only passes the pointer back not the length. Currently wishing Vec and Box<[]> worked more like Rc in this regard
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.