-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stabilize most common subset of alloc_layout_extras #69362
Conversation
whoops I broke highfive by r-ing a team, so rng says... r? @dtolnay |
I would like |
Personally, I'm not comfortable making the call on whether In another formulation, I don't feel confident calling for the stabilization of |
Fair enough, let's defer on @rfcbot fcp merge |
Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
1bf23b7
to
6d9ecb2
Compare
Amended to refer to a 1.44 stabilization in the attributes. |
☔ The latest upstream changes (presumably #70362) made this pull request unmergeable. Please resolve the merge conflicts. |
ping @sfackler @KodrAus @withoutboats for checkboxes. |
1 similar comment
ping @sfackler @KodrAus @withoutboats for checkboxes. |
6d9ecb2
to
1b76bb0
Compare
Rebased. |
(I went ahead and checked for @KodrAus since he's busy) |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
65d4505
to
053c2dd
Compare
Co-Authored-By: Ralf Jung <[email protected]>
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after fixing the doc comments.
Co-Authored-By: Amanieu d'Antras <[email protected]>
@bors r+ |
📌 Commit 98f0a82 has been approved by |
Rollup of 4 pull requests Successful merges: - rust-lang#69362 (Stabilize most common subset of alloc_layout_extras) - rust-lang#71174 (Check that main/start is not async) - rust-lang#71285 (MIR: use HirId instead of NodeId to avoid cycles while inlining) - rust-lang#71346 (Do not build tools if user do not want them) Failed merges: r? @ghost
A subset of this feature was stabilized in rust-lang/rust#69362, and none of the still-unstable methods are in use in `blog_os`
A subset of this feature was stabilized in rust-lang/rust#69362, and none of the still-unstable methods are in use in `blog_os`
Tracking issue: #55724
Specifically, this stabilizes:
Methods that are tracked by #55724 but are not stabilized here:
Combined, these stabilized functions allow code to construct and manipulate
repr(C)
layouts while letting the standard library handle correctness in the face of edge cases. For example use cases, consider the usage in hashbrown, crossbeam-skiplist, pointer-utils/slice-dst, and of course the standard library itself.Providing a higher-level API such as
Layout::repr_c<const N: usize>(fields: [Layout; N]) -> Result<(Layout, [usize; N]), LayoutErr>
is blocked on const generics, which are a ways off. Providing an API that doesn't provide offsets would be quite suboptimal, as the reason for calculating the layout like this rather thanLayout::new
is to get the field offsets.The primary issue with the current API is having to call
.pad_to_align()
to match the layout of arepr(C)
struct. However, I think this is not just a (failing? limitation?) of the API, but rather intrinsic complexity. While all Rust-defined types have size==stride, and probably will for the foreseeable future, there is no inherent reason why this is a limitation of all allocations. As such, theLayout
manipulation APIs shouldn't impose this limitation, and instead the higher level api ofrepr_c
(or just plain old usingLayout::new
) can make keeping it simple.cc @matklad r? @rust-lang/libs