Skip to content

Comments

[DRAFT] no_std Option for bevy_tasks#15362

Closed
bushrat011899 wants to merge 36 commits intobevyengine:mainfrom
bushrat011899:NoSTDBevyTasks
Closed

[DRAFT] no_std Option for bevy_tasks#15362
bushrat011899 wants to merge 36 commits intobevyengine:mainfrom
bushrat011899:NoSTDBevyTasks

Conversation

@bushrat011899
Copy link
Contributor

@bushrat011899 bushrat011899 commented Sep 22, 2024

Objective

  • Allows using bevy_tasks in no_std contexts

Solution

  • Created custom async_executor based on existing reference implementation but using spin sync primitives, allowing no_std usage.
  • Created an alternative TaskPool using a single global Executor

Testing

  • TBA

Notes

  • Once this is done, only bevy_ecs needs work to permit a minimal no_std Bevy application, as bevy_app is trivially no_std once these two crates are.
  • Currently draft as I am not happy with the Sync requirements required in a no_std context. Also, I'm waiting for the lints in Add core and alloc over std Lints #15281 to be merged, as this work is based off of some of those changes (hence the absurdly high change count)
  • Creating the draft now so anyone else interested in this work may comment (in support or to critique!)

bushrat011899 and others added 30 commits September 18, 2024 15:36
This is due to `Error` in `core`
Cannot rely on call-sites having `extern crate alloc;`. Perhaps `bevy_ecs` could re-export `Box` for this macro, but `std` is fine for now.
We wish to use different lints for the examples, and `cargo` currently doesn't support overriding workspace lints within a crate. As a workaround, all workspace lints are duplicated for the root crate to allow it to specifically allow the standard library.
Explains the requirement for duplicating the lints as a form of workspace overrides
Co-Authored-By: François Mockers <francois.mockers@vleue.com>
Co-Authored-By: François Mockers <francois.mockers@vleue.com>
Co-Authored-By: François Mockers <francois.mockers@vleue.com>
However, `bevy_ptr` and `bevy_utils` must still link to `core` and `alloc` due to the possibility of being `no_std` based on feature gating.
@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Tasks Tools for parallel and async work X-Needs-SME This type of work requires an SME to approve it. S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Sep 22, 2024
@bushrat011899 bushrat011899 force-pushed the NoSTDBevyTasks branch 4 times, most recently from 47dcef8 to 2f345b3 Compare September 23, 2024 10:00
@bushrat011899 bushrat011899 force-pushed the NoSTDBevyTasks branch 2 times, most recently from ff778c1 to 032bbde Compare September 25, 2024 23:02
@bushrat011899
Copy link
Contributor Author

Closed in favour of #15464

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Tasks Tools for parallel and async work C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Needs-SME This type of work requires an SME to approve it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants