Uh oh!
There was an error while loading. Please reload this page.
Add atomic module to alloc::sync - #58175
Conversation
rust-highfive
commented
Feb 5, 2019
r? @aidanhs (rust_highfive has picked a reviewer for you, use r? to override) |
Uh oh!
There was an error while loading. Please reload this page.
rust-highfive
commented
Feb 5, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
rust-highfive
commented
Feb 6, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
rust-highfive
commented
Feb 9, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
rust-highfive
commented
Feb 17, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
taiki-e
commented
Feb 18, 2019
r? @SimonSapin |
SimonSapin
commented
Feb 18, 2019
Good catch! RFC 2480 states a similar goal:
I agree that it should also be a superset of Regarding this PR’s implementation, I think it can be a single As to stability, I think it should be the same as |
SimonSapin
commented
Feb 18, 2019
Hmm on a closer look I’m not sure. There are many other modules that are present in libcore but not liballoc. |
| // Since the current `liballoc` is not a superset of `libcore`, | ||
| // using `pub use core::sync::atomic;` will fail with some link errors. | ||
| // If `liballoc` becomes a superset of `libcore`, replace this with | ||
| // `pub use core::sync::atomic;`. |
There was a problem hiding this comment.
Specifically, it is this error: #58175 (comment)
[01:36:43] alloc/sync/atomic/index.html:13: broken link - alloc/marker/trait.Sync.html
taiki-e
commented
Feb 19, 2019
See #58175 (comment).
Thanks, I changed it. |
SimonSapin
commented
Feb 19, 2019
@rust-lang/libs Any thoughts on whether liballoc should be a superset of libcore? |
Amanieu
commented
Feb 19, 2019
@SimonSapin I personally don't mind either way. |
alexcrichton
commented
Feb 19, 2019
Agreed this should be fine to land |
SimonSapin
commented
Feb 19, 2019
Oh I see, there’s a subtlety that I missed in the PR description: for modules that exist in both crates, this makes I think that conditional is not useful. If we care about having what’s in libcore, I’d rather we do that at the crate level and reexport everything. ( |
taiki-e
commented
Feb 19, 2019
There is no sentence clearly specifying this in rust-lang/rfcs#2480, but the following sentence looks like to contain "
|
taiki-e
commented
Feb 19, 2019
The current |
taiki-e
commented
Feb 19, 2019
FYI: Comparison of imports
use std::borrow::{Borrow,Cow};use std::iter;use std::sync::{atomic,Arc};current use alloc::borrow::{Borrow,Cow};use alloc::sync::Arc;use core::iter;use core::sync::atomic;after this PR: use alloc::borrow::{Borrow,Cow};use alloc::sync::{atomic,Arc};use core::iter;if use alloc::borrow::{Borrow,Cow};use alloc::iter;use alloc::sync::{atomic,Arc}; |
Amanieu
commented
Feb 19, 2019
On second thought, I think that If we really want to keep pushing in that direction then we should consider renaming |
SimonSapin
commented
Feb 20, 2019
@taiki-e That RFC is not accepted yet and can still evolve, so don’t read too much is what exactly it says or not. In fact I think this very conversation will affect the RFC. As to the “intermediate” subset, it doesn’t have to be imported all from one crate. Whenever liballoc is available, libcore is too. @Amanieu If Whether to rename the alloc crate is an unresolved question of RFC 2480. |
Amanieu
commented
Feb 20, 2019
@SimonSapin Yes, I would say that IMO the only 2 approaches that make sense are:
I am personally happy with either approach. |
Dylan-DPC-zz
commented
Mar 4, 2019
ping from triage @taiki-e@SimonSapin what's the update on this? |
This was one of the unresolved questions of rust-lang/rfcs#2480. As the RFC says this is maybe not useful in the sense that we are unlikely to ever have a second version, but making the crate a true subset makes one less issue to think about if we stabilize it and later want to merge standard library crates and have Cargo feature flags to enable or disable parts of the `std` crate. See also discussion in rust-lang#58175
SimonSapin
commented
Mar 5, 2019
I agree with @Amanieu about the two approaches. I’ve added an unresolved question to rust-lang/rfcs#2480 about picking one. (I think I prefer the status quo.) I’ll close this PR since it does neither of those approaches, but thanks for the patch @taiki-e! |
Move alloc::prelude::* to alloc::prelude::v1, make alloc a subset of std This was one of the unresolved questions of rust-lang/rfcs#2480. As the RFC says this is maybe not useful in the sense that we are unlikely to ever have a second version, but making the crate a true subset makes one less issue to think about if we stabilize it and later want to merge standard library crates and have Cargo feature flags to enable or disable parts of the `std` crate. See also discussion in rust-lang#58175. Also rename the feature gate and point to a dedicated tracking issue: rust-lang#58935
Move alloc::prelude::* to alloc::prelude::v1, make alloc a subset of std This was one of the unresolved questions of rust-lang/rfcs#2480. As the RFC says this is maybe not useful in the sense that we are unlikely to ever have a second version, but making the crate a true subset makes one less issue to think about if we stabilize it and later want to merge standard library crates and have Cargo feature flags to enable or disable parts of the `std` crate. See also discussion in rust-lang#58175. Also rename the feature gate and point to a dedicated tracking issue: rust-lang#58935
Of the modules of the
alloccrate, modules with the same names with thecorecrate exceptpreludeandsyncare re-exporting items of the same name module of thecorecrate.I think should also be done for
alloc::sync.cc rust-lang/rfcs#2480