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
I think padding should probably be described in the type layout chapter.
My question though, other than being an unnameable psuedo-field that can theoretically have any value, does it have any other properties? E.g., can they be repurposed by enums to do niche optimizations (making it unsafe to set the value)? Other restrictions?
The text was updated successfully, but these errors were encountered:
My question though, other than being an unnameable psuedo-field that can theoretically have any value, does it have any other properties?
Yes, a very crucial one: padding content is lost on "typed copies" (assignment, function argument/return passing). The content of the padding is not guaranteed to be preserved by such actions.
That's also why it can not be used for niche optimizations.
I am not sure what you mean by "move". ;) Both the MIR Operand::Copy and Operand::Move are "typed copies". There might be a difference between them, that is discussed at rust-lang/unsafe-code-guidelines#188.
We don't have a good explanation of the properties of padding. Currently we talk about it in two places:
I think padding should probably be described in the type layout chapter.
My question though, other than being an unnameable psuedo-field that can theoretically have any value, does it have any other properties? E.g., can they be repurposed by enums to do niche optimizations (making it unsafe to set the value)? Other restrictions?
The text was updated successfully, but these errors were encountered: