-
Notifications
You must be signed in to change notification settings - Fork 109
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
regression with portable-atomics in 1.20.0
#264
Comments
FYI, my recommendation (as a maintainer of portable-atomic) here is adding Relevant documentations are:
By the way, the context on these being mutually exclusive is taiki-e/portable-atomic#51 and taiki-e/portable-atomic#94. |
Thanks for headsup @kaspar030 and cc @brodycj I guess I need to spend more time to understand what's going on here, but it looks like the latest release is in fact incorrect, so I will revert it in a couple of hours. |
Yanked 1.20, as this is indeed a regression and is not something which should be happening in such a widely used crate. |
Thanks! |
Still, I think I am not understanding something:
It sounds like you get in a situation where:
Shouldn't portable-atomic in this case rely on critical section itself? I guess these are actually orthogonal:
If that is the case, than it seems
And that the users can enable either or both of this features. |
Sorry for a rambling question, let me condencse this! Am I correct that the following situation is not a bug: An embdded application is using |
@taiki-e I think your insight might be really helpful. My understanding is that we should try to offer as much flexibility as possible for higher-level librarians and applications that may have any combination of features enabled, or combination of multiple libraries that may have any combination of features enabled. For example: rustls currently uses once_cell, may or may not want to have critical-section enabled to support using portable-atomic with critical-section to help support building for thumbv6 ... rustls does currently use OnceBox for (via race?) no-std, maybe rustls should offer the "unsafe" single core option as well? I am also starting to wonder if we should try to work more closely with rust-embedded to find an easier-to-understand way to get some of these options working consistently throughout multiple layers of libraries like this? |
Correct, that's not a bug. I guess the fundamental thing here is that libraries should not make those choices, but leave them to the environment where they are used.
Actually the docs of both It's just that most libraries turn into applications for their tests - there, choices need to be made ... |
IMO it should be the other way around. The
|
This reverts commit d4d35cc. Version 1.20.0 of the crate once_cell was yanked due to a regression with portable-atomics. For more information see <matklad/once_cell#264>.
Here is my understanding on the implementation before #260 (i.e., 1.19.0): First, there are two no-std compatible thread-safe implementations and each depends on different things:
And I think there are two issues:
For the first issue, it is better to allow using
(Note that For the second issue, adding
I don't think a feature for |
1.20.0 was yanked: matklad/once_cell#264
1.20.0 was yanked: matklad/once_cell#264
#260 propagates the
critical-section
feature to portable-atomics, which conflicts withunsafe-assume-single-core
.This breaks our use case.
portable-atomic
treatscritical-section
andunsafe-assume-single-core
as mutually exclusive. We depend on esp-rs, which for some platforms (e.g., esp32c2, c3) explicitly enables the latter.It is my understanding that
libraries
should not set eithercritical-section
orunsafe-assume-single-core
, but leave that to the end user.#260 states this:
What does
critical-section
onportable-atomics
actually enable that onlycritical-section
feature enable? Maybe this can be solved inportable-atomic
with a backend-agnostic feature likerequire-cas
?The text was updated successfully, but these errors were encountered: