Use portable-atomic to allow use on targets without atomic instructions#30
Use portable-atomic to allow use on targets without atomic instructions#30orhun merged 6 commits intoratatui:mainfrom
Conversation
j-g00da
left a comment
There was a problem hiding this comment.
Thanks! This is great, but it should definitely be behind a feature flag. critical-section and unsafe-assume-single-core features should also be exposed.
This would not be idiomatic. For But re-reading the usage example above has reminded me that for the features this needs I think I should have written it like this: portable-atomic = { version = "1.3", default-features = false, features = ["require-cas"] } |
orhun
left a comment
There was a problem hiding this comment.
Would be nice to have this under a feature flag and then it should be good to go :)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #30 +/- ##
=======================================
Coverage 76.24% 76.24%
=======================================
Files 8 8
Lines 1229 1229
=======================================
Hits 937 937
Misses 292 292 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
j-g00da
left a comment
There was a problem hiding this comment.
Run fmt and I think this is good to go, thanks!
Suggested commit message: feat: Add portable-atomic feature for targets without atomic instructions.
On a side note, it would be nice to make the ci run with std / no std / no std with portable-atomic separately. (In a separate PR.)
After releasing new version we can integrate it into Ratatui.
cc: @joshka
Add builds for some common no_std targets to ensure that we don't accidentally break them. See comment requesting this feature here: #30 (review) Will not succeed until #30 is merged because the portable-atomic feature is not present until then.
## 🤖 New release * `kasuari`: 0.4.7 -> 0.4.8 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.4.8](v0.4.7...v0.4.8) - 2025-09-04 ### Other - *(deps)* bump the rust-dependencies group across 1 directory with 2 updates ([#32](#32)) - add smoke tests for no_std targets ([#31](#31)) - use portable-atomic to allow use on targets without atomic instructions ([#30](#30)) - *(deps)* bump actions/checkout from 4 to 5 in the github-actions group ([#27](#27)) - *(deps)* bump the rust-dependencies group with 2 updates ([#28](#28)) - *(deps)* bump rstest from 0.25.0 to 0.26.1 in the rust-dependencies group ([#25](#25)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
I think it might be useful to add some more docs to this (just the same things that you've mentioned in the justification of the PR). Basically something that will help answer "Why should I enable this feature and what does it change?". Right now the doc that will show up on the features lists is "use portable-atomic to polyfill CAS atomics on targets that do not have them", which for someone unfamiliar with those things might be a little too bare. This also applies to the same idea on the Ratatui side. Think about the docs.rs output needs of this. |
Some targets do not natively support atomics (eg rp2040, esp32-c3).
By adding portable-atomic, these targets can select a method to emulate atomics.
It might be nice to make this a feature instead to avoid forcing it on for everyone.
Happy to get some feedback on this.