`bevy_reflect` and `bevy_tasks` do not build on platforms without atomics
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version and features
```toml
bevy = { version = "0.19.0", default-features = false, features = ["default_no_std"] }
```
## Relevant system information
`cargo 1.99.0-nightly (3efb1f477 2026-07-17)`
building for `mipsel-sony-psx`
## Small futures-lite problem
```
error[E0432]: unresolved import `atomic::AtomicUsize`
--> /Users/calin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-core-0.3.33/src/task/__internal/atomic_waker.rs:5:5
|
5 | use atomic::AtomicUsize;
| ^^^^^^^^-----------
| |
| no `AtomicUsize` in `sync::atomic`
```
As far as I can tell this happens because `bevy_tasks` unconditionally depends on `futures-lite` which depends on `futures-core` *without* the `portable-atomic` feature and no way to enable it (and for reference because this tripped me up, `portable-atomic` is an implicit feature for the optional dependency, it is not listed explicitly but it does exist)
```sh
cargo tree -i futures-core
futures-core v0.3.33
└── futures-lite v2.6.1
└── bevy_tasks v0.19.0
├── bevy_app v0.19.0
...
```
The workaround is to add
```toml
futures-core = { version = "*", default-features = false, features = ["portable-atomic"] }
```
to the project
## `bevy_reflect` uses core::sync liberally
Next, more importantly, `bevy-reflect` does not compile and despite having a `critical-section` feature as it contains code like:
```rs
impl_reflect_for_atomic!(
::core::sync::atomic::AtomicIsize,
::core::sync::atomic::Ordering::SeqCst
);
```
```sh
error[E0425]: cannot find type `AtomicIsize` in module `::core::sync::atomic`
--> /Users/calin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_reflect-0.19.0/src/impls/core/sync.rs:135:27
|
135 | ::core::sync::atomic::AtomicIsize,
| ^^^^^^^^^^^ not found in `::core::sync::atomic`
|
help: consider importing this struct
|
1 + use bevy_platform::sync::atomic::AtomicIsize;
|
help: if you import `AtomicIsize`, refer to it directly
|
135 - ::core::sync::atomic::AtomicIsize,
135 + AtomicIsize,
|
```
perhaps it should indeed implement the traits on the `bevy_platform` alternative?
Contributor guide
Research direction
Start by tracing bevy_tasks' futures-lite and futures-core feature configuration, then inspect bevy_reflect/src/impls/core/sync.rs and its use of core::sync::atomic. Reproduce the default_no_std build for mipsel-sony-psx and determine the platform-compatible atomic types and feature wiring; done means the affected crates compile without atomics while existing supported builds remain valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100