doc: Document NonNull pointer ABI compatibility#157982
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @LawnGnome (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
|
|
|
My (current) understanding of this PR is that it doesn't need an FCP because it is merely improving cross-reference/reiteration of an existing stable guarantee? |
I see an existing ABI guarantee but not a layout guarantee. |
Hey i think you're right,Sorry i thought that because it's |
|
Thanks for the PR and for your efforts on it. But I'm going to close this. This is already documented where we document guarantees about ABI compatibility. In other places, where we are documenting both layout and ABI compatibility, we sometimes do say both under a Representation section, but documenting only ABI compatibility under Representation would seem wrong. We could fix that by adding a new section for ABI compatibility. But then we also need to fix the guarantee to fully match what's in the ABI compatibility section rather than truncating that guarantee. And we should cross link it. But it just doesn't seem worth it. There's cost to duplicating our guarantees. We don't consistently duplicate our ABI guarantees outside of the canonical page for that. It seems OK here to just leave it alone. |
|
@traviscross we currently have a clear inconsistency between the However this PR does not quite do that. @0xEgao I would suggest you make a new PR that focuses on making the docs consistent, i.e. explaining the same things using the same words in both cases. |
Sure I will create one focusing on that |
It intends to fix #157741
NonNull<T>is already documented in the primitive ABI compatibility docs as ABI-compatible with raw pointers, but its own representation section only mentioned theOption<NonNull<T>>size/alignment guarantee.This updates the
NonNulldocs to state directly thatNonNull<T>has the same ABI as*mut T,... .Except for the non-null validity requirement. This makes the guarantee easier to find from the
NonNullpage itself.