≈ the.bay.news

When is the memory location of `Box ` guaranteed to remain stable?

The Rust Programming Language Forum
When is the memory location of `Box ` guaranteed to remain stable?
I have code which performs chunked reads of framed data via an (unsafe) ioctl call, with the following basic shape (after removing a load of additional validations, abstractions, etc): let zeroes = Box::<[u8]>::new_zeroed_slice(frames.size()); // SAFETY: `\0` is valid as `u8` let mut buf = unsafe { zeroes.assume_init() }; let chunk_bufs = buf.chunks_mut(self.chunk_size()); for chunk_buf in chunk_bufs { // SAFETY: we own the underlying buffer, which is not moved and well-sized unsafe {...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.