Hacker News new | ask | show | jobs
by notpopcorn 1597 days ago
> So we use a &'static str here instead of a C string so there are some changes to the C code.

> [..]

> So why does this type not support zero initialization? What do we have to change? Can zeroed not be used at all? Some of you might think that the answer is #[repr(C)] on the struct to force a C layout but that won't solve the problem.

The type of the first field was switched to a type (&str) that specifically promises it is never null. If the original type (a pointer) was kept, or a Option<&str> was used, mem::zero would've worked fine.