Use cfg(target_has_atomic) on no-std targets to support platforms without atomic CAS (no dep) #761
+46
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This does not replace #467 ("Add feature to support platforms without atomic CAS"), but is sufficient to fix #461 in use cases that do not need
Bytes
/BytesMut
. (i.e., What some of the people who say we need #479 ("Make alloc optional") actually need.)The following documentation added by this PR should explain exactly the status of the API after this PR is merged and its relationship to #467:
This implements the first one listed in #573 (comment).
The concern with this approach was MSRV of the
cfg(target_os = "none")
targets, but I have been using this approach with futures-rs for over a year and have not received any complaints about this. Below is an explanation to this MSRV concern from futures-rs PR (rust-lang/futures-rs#2811) that implemented it.(Btw, futures-rs also implements the same approach as #467, not only this.)