-
Notifications
You must be signed in to change notification settings - Fork 17
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
Make DowncastSync
Optional
#22
Conversation
The `Arc` usage in `DowncastSync` prevents compilation on platforms like `thumbv6m-none-eabi`. By placing it behind a feature flag, `sync`, we can allow compilation of the supported subset.
Thanks for your contribution! And thanks for being explicit about the backward-compatibility hazard. I suppose I could publish a 2.0 with this. I'll see if there are any other similar backward-incompatible-ish changes from #14 that now might be a good time to incorporate. Do you need this published in crates.io in a rush? |
Thanks for merging it so quickly! Not a rush at all. We're able to work around the issue in Bevy and we won't be publishing a crate that'd need this change for at least a couple months, so no time pressure at all. |
I published 2.0, but cargo docs misformatted the documentation at https://crates.io/crates/downcast_rs even though docs.rs shows it fine. That's because of the conditional doc test being run conditionally based on the Filed rust-lang/crates.io#10331. |
Figured out a workaround for the docs and published 2.0.1. |
Thanks a ton for merging and shipping this for us! We really appreciate it over at Bevy <3 |
# Objective & Solution - Update `downcast-rs` to the latest version, 2. - Disable (new) `sync` feature to improve compatibility with atomically challenged platforms. - Remove stub `downcast-rs` alternative code from `bevy_app` ## Testing - CI ## Notes The only change from version 1 to version 2 is the addition of a new `sync` feature, which allows disabling the `DowncastSync` parts of `downcast-rs`, which require access to `alloc::sync::Arc`, which is not available on atomically challenged platforms. Since Bevy makes no use of the functionality provided by the `sync` feature, I've disabled it in all crates. Further details can be found [here](marcianx/downcast-rs#22).
# Objective & Solution - Update `downcast-rs` to the latest version, 2. - Disable (new) `sync` feature to improve compatibility with atomically challenged platforms. - Remove stub `downcast-rs` alternative code from `bevy_app` ## Testing - CI ## Notes The only change from version 1 to version 2 is the addition of a new `sync` feature, which allows disabling the `DowncastSync` parts of `downcast-rs`, which require access to `alloc::sync::Arc`, which is not available on atomically challenged platforms. Since Bevy makes no use of the functionality provided by the `sync` feature, I've disabled it in all crates. Further details can be found [here](marcianx/downcast-rs#22).
Objective
Currently,
downcast-rs
does not compile on platforms which lackArc
support, such asthumbv6m-none-eabi
(e.g., the Raspberry Pi Pico). Crates likeportable-atomic-util
can provide a compatibility shim, but without RFC #982, and RFC #3519, the ergonomics would be vastly different with and withoutportablie-atomic
.Solution
Added a feature flag for
DowncastSync
,sync
. Since it is the only part ofdowncast-rs
that relies onArc
, disabling just it alone is sufficient to allow compilation onthumbv6m-none-eabi
and other atomically challenged platforms. This does constitute a breaking change for users who disable default features, as they will have to enable thesync
feature to retain existing functionality.Alternatives
Wait for the above RFCs to be stabilised and then use
portable-atomic
instead.Notes
This is my first time contributing to this project. Please let me know if there's anything I can do to assist with evaluating this PR.