Skip to content

Enabling serialize feature on Bevy causes compilation fail on no_std targets #18780

Closed
@Shatur

Description

@Shatur

Bevy version

v0.16.0-rc.3

What you did

Enabled serialize on Bevy without any other features.

What went wrong

Fails to compile due to small_str:

    Checking smol_str v0.2.2
error[E0432]: unresolved import `alloc::sync`
   --> /home/gena/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/smol_str-0.2.2/src/lib.rs:4:54
    |
4   | use alloc::{borrow::Cow, boxed::Box, string::String, sync::Arc};
    |                                                      ^^^^ could not find `sync` in `alloc`
    |
note: found an item that was configured out
   --> /home/gena/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/lib.rs:245:9
    |
245 | pub mod sync;
    |         ^^^^
note: the item is gated here
   --> /home/gena/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/lib.rs:244:1
    |
244 | #[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0432`.
error: could not compile `smol_str` (lib) due to 1 previous error

Additional information

PR to my crate that reproduces the problem.
Just run the following:

cargo check --target thumbv6m-none-eabi --features bevy/critical-section

Commenting out serialize will make the dependency tree to compile.

Metadata

Metadata

Assignees

Labels

C-BugAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelled

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions