rust-lang / unsafe-code-guidelines

Forum for discussion about what unsafe code can and can't do
https://rust-lang.github.io/unsafe-code-guidelines
Apache License 2.0
670 stars 58 forks source link

update the docs for layout guarantees of option-like enums #538

Closed RalfJung closed 1 week ago

RalfJung commented 1 month ago

This updates our docs to match the FCP in https://github.com/rust-lang/rust/pull/130628. The UCG reference has been a valuable resource for figuring out what is and is not guaranteed about layout, so it seems worth keeping it up-to-date.

(Medium-term, I expect this to be superseded by @chorman0773's new layout chapter for the reference, but we're not there yet.)

RalfJung commented 4 weeks ago

@rust-lang/opsem could someone take a look at this so we can get it merged? :)

saethlin commented 1 week ago

The definition at the top is at least something to point to. I'm still not enthused about the wording, but I think it's better to merge this and wait for someone to actually be confused than continue to haggle over it.

saethlin commented 1 week ago

I don't know which of the merge buttons you want to use here, so I'll let you merge this :)

RalfJung commented 1 week ago

I see only one merge button?^^ :)

ia0 commented 1 week ago

I guess the question was between merge, rebase, and squash (all sharing the same button using a drop down for selection). But given the git history and how this PR was merged, the answer was indeed merge 😅 This can be enforced with a branch rule if needed, such that only one option is available in the drop down, making such question automatically answered in the future.