You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In light of rust-lang/rust#129778, we should do more to defend against misconceptions about the durability of padding bytes across moves. For example, FromZeros::new_zeroed returns its value by-move, and so padding bytes within Self may not be 0.
We can do some combination of the following. First, we can aggressively sign-post this risk. As a rule, one shouldn't depend on the value of padding bytes.
Second, we can wrap zeroed types in a type that ensures padding remains preserved; e.g.:
Activity
Document that writes to padding are not preserved
Document that writes to padding are not preserved
Document that writes to padding are not preserved
RalfJung commentedon Sep 16, 2024
The last
u8should beT, right?jswrenn commentedon Sep 16, 2024
Yeah, that's a typo. Unfortunately, using
Tthere also isn't currently stable. For now, the best we can do is documentation, I think (#1660).Document that writes to padding are not preserved
Document that writes to padding are not preserved (#1660)
joshlf commentedon Sep 16, 2024
If we need to add a utility type, we can do that when the need arises.
For now, I'll consider this closed by #1660.