Skip to content

Prefer core and alloc over std where possible #6370

Closed
@alice-i-cecile

Description

@alice-i-cecile

What problem does this solve or what need does it fill?

Some less common platforms (e.g. Nintendo Switch, and likely other consoles), do not support the full Rust standard library.
Bevy uses a number of features from the standard library, but it's unclear exactly which parts need to be disabled (or replaced) in order to achieve these ports.

What solution would you like?

Add and follow the three lints listed in rust-lang/rust-clippy#9103.

This will have no effect on existing platforms (these are just re-exports), but will make it much clearer which crates (and features within crates) are no_std compatible.

We should enable these lints at the level of each crate in their lib.rs, in order to make the dev experience less frustrating due to desyncs with CI.

What alternative(s) have you considered?

Obviously, console devs can simply make these changes in their own fork. However, making this change comes at very little cost, and reduces the frustration of keeping forks synchronized.

Additional context

See this thread for discussion about no_std requirements for the official Switch target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-Cross-CuttingImpacts the entire engineC-Code-QualityA section of code that is hard to understand or changeX-ControversialThere is active debate or serious implications around merging this PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions