This repository was archived by the owner on Apr 5, 2024. It is now read-only.
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Legal values for a Box<T> where T is zero-sized #3
Closed
Description
On IRC, @mystor asked me whether, given some zero-sized type ZST
, it would be legal to represent Box<ZST>
using some arbitrary non-null value, or must it be a particular value (e.g., 1)?
For example, if there is a pointer p
to some stack variable, can one write unsafe { Box::from_raw(p as *mut ZST) }
and have that be a legal box?