Allow bevy_utils in no_std Contexts#15279
Merged
alice-i-cecile merged 3 commits intobevyengine:mainfrom Sep 18, 2024
Merged
Conversation
Added `alloc` and `std` features to `bevy_utils` (`std` is enabled by default), allowing their use in `no_std` contexts.
alice-i-cecile
approved these changes
Sep 18, 2024
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
Sure, this is useful enough. nostd support is part of being a good Rust citizen IMO.
For follow-up:
- We should consider enabling the lint for using std rather than core globally, just to make this easier and reduce merge conflicts.
- We should also consider setting up cargo-deny to enforce that our no-std crates/feature flag settings are actually std-free.
Member
|
Waiting on a second approval; this is contentious enough that I want at least a bit of discussion. |
ItsDoot
approved these changes
Sep 18, 2024
Contributor
Author
That would be good!
I'm not very familiar with the CI-side of Bevy, but I do agree it would be nice to make some guarantees that can be checked by CI. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
bevy_utilsto make itno_stdcompatiblecoreandallocoverstdwhere possible #6370Solution
Added
allocandstdfeatures tobevy_utils(stdis enabled by default), allowing the crate's use inno_stdcontexts.Testing
bevy_utilsin ano_stdcrate as an experiment and compiled successfully.Migration Guide
If you were importing
bevy_utilsand settingdefault_featurestofalse, but relying on elements which are now gated behind thestdorallocfeatures, include the relevant feature in yourCargo.toml.Notes
no_stdcrate,bevy_ptr, so there is precedent for this change.bevy_utilsis widely used across the rest of Bevy, further work to make Bevyno_stdcompatible would be blocked on this crate, if such work was to be undertaken.to_string()within unit tests.