Skip to content
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

Move Layout and LayoutErr to core::mem #71856

Closed
wants to merge 3 commits into from

Conversation

TimDiekmann
Copy link
Member

@TimDiekmann TimDiekmann commented May 3, 2020

This moves core::alloc::{Layout, LayoutErr} to core::mem::{Layout, LayoutError} and reexport them as core::alloc::{Layout, LayoutErr}. Currently it is neither possible to deprecate reexports, nor to document them, however I added the comment so it shows up if rustdoc supports this one day. Also #[doc(no_inline)] was added to express, that this is a reexport, this is probably the best bet. The alternative would be #[doc(hidden)].

It's may be an option to also reexport mem::LayoutError as alloc::LayoutError but this is not required.

I have another commit in the queue which changes (I hope) all occurrences to the new path, but I want to wait for the CI first. This shouldn't cause any errors or warnings. I pushed the commit. All previous test passed.

r? @LukasKalbertodt

closes rust-lang/wg-allocators#59

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 3, 2020
@TimDiekmann TimDiekmann marked this pull request as ready for review May 4, 2020 01:25
@joelpalmer joelpalmer added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 12, 2020
@Dylan-DPC-zz
Copy link

r? @dtolnay

@bors
Copy link
Contributor

bors commented May 19, 2020

☔ The latest upstream changes (presumably #71447) made this pull request unmergeable. Please resolve the merge conflicts.

@TimDiekmann
Copy link
Member Author

r? @Amanieu

@rust-highfive rust-highfive assigned Amanieu and unassigned dtolnay May 19, 2020
@Amanieu
Copy link
Member

Amanieu commented May 19, 2020

I'm not a big fan of this change since it feels like a lot of churn for something that is already stable. However I can see that core::mem is also a good location for Layout since it isn't strictly allocation-related (it could be used for things like offset_of, safe transmute, etc).

@rust-lang/libs any thoughts?

@BurntSushi
Copy link
Member

Also not a huge fan of this. I can see how mem could be a good spot for it, but alloc actually seems like the best spot since it's part of the core allocator API. At the very least, alloc doesn't seem like a bad spot to me.

@dtolnay
Copy link
Member

dtolnay commented May 22, 2020

How about we revisit this if a method is ever added in core::mem involving Layout in the signature. For now alloc is the only module containing methods that involve Layout, even if the same type is useful for other purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move Layout and LayoutErr to core::mem
9 participants