Add portable-atomic feature and disable portable-atomic/critical-section by default#265
Conversation
02b54df to
ed37805
Compare
ed37805 to
449e5d7
Compare
|
This all looks alright to me, thanks a lot for putting this together! |
|
|
||
| # Enables `once_cell::race` module. | ||
| race = [] | ||
| race = ["portable-atomic?/require-cas"] |
There was a problem hiding this comment.
Hmm, due to Cargo bug (rust-lang/cargo#10801), this makes portable-atomic to appear in Cargo.lock (even if the portable-atomic feature is not enabled. even if portable-atomic will never be compiled).
With the diagnostic improvements in portable-atomic 1.8 (taiki-e/portable-atomic#181), the need for require-cas feature has decreased, so I think it is probably fine to remove "portable-atomic?/require-cas"...
There was a problem hiding this comment.
I am also fine with keeping it! Cargo bug is a bug, the code here seems correct, and could perhaps be helpful for older versions of portable-atomic?
I guess you are the best person to make a judgement call here though :)
Closes #264
This implements the first of the ways I mentioned in #264 (comment).
(The second way mentioned there was probably more user-friendly, but I did not choose it because it would have caused
portable-atomicto appear in Cargo.lock as a platform-specific dependency. Like cfg-specific dependencies in crossbeam-rs/crossbeam#487 (comment).)No new test case was added, because the following case is sufficient to test the situation where the
racemodule is enabled (due to default features) andportable-atomicis used instead ofcore::sync::atomic(due tocritical-sectionfeature enablesportable-atomicfeature).once_cell/xtask/src/main.rs
Line 40 in 72f7c2e
This also closes #248 since this is a sound way to do that.
cc @kaspar030 @brodycj