Skip to content

Conversation

joshua-holmes
Copy link
Contributor

@joshua-holmes joshua-holmes commented Mar 18, 2025

Objective

Remaining work for and closes #17682. First half of work for that issue was completed in PR 17730. However, the rest of the work ended up getting blocked because we needed a way of forcing systems to run on the main thread without the use of !Send resources. That was unblocked by PR 18301.

This work should finish unblocking the resources-as-components effort.

Testing

Ran several examples using my Linux machine, just to make sure things are working as expected and no surprises pop up.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events A-App Bevy apps and plugins X-Controversial There is active debate or serious implications around merging this PR S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Mar 18, 2025
@alice-i-cecile
Copy link
Member

I'm going to want @maniwani's eyes on this, hence the X-Controversial label.

@hymm hymm self-requested a review March 18, 2025 18:17
@joshua-holmes joshua-holmes changed the title Remove remaining internal use of !Send Remove remaining internal use of !Send resources Mar 19, 2025
@joshua-holmes
Copy link
Contributor Author

The work on this PR is complete, but we are waiting for NonSendMarker PR to get merged because this PR depends on that one. Once it's merged, I will rebase and fix up the git history so the commits related to creating NonSendMarker do not appear in this PR.

@joshua-holmes joshua-holmes force-pushed the no-more-non-send branch 3 times, most recently from 8b6d428 to ec82c5f Compare March 20, 2025 01:21
@alice-i-cecile
Copy link
Member

Merging the linked PR for you :)

@alice-i-cecile alice-i-cecile added this to the 0.17 milestone Mar 23, 2025
@joshua-holmes joshua-holmes marked this pull request as ready for review March 24, 2025 21:24
@alice-i-cecile alice-i-cecile added the X-Blessed Has a large architectural impact or tradeoffs, but the design has been endorsed by decision makers label May 5, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 5, 2025
@alice-i-cecile
Copy link
Member

Thank you so much for tackling this! I'm really happy that this is finally done, now we just need to remove the old NonSend API surface and revive the resources-as-components work.

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 5, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 6, 2025
@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels May 6, 2025
@alice-i-cecile
Copy link
Member

Back to Waiting-on-Author until CI issues are resolved :(

@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 6, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 6, 2025
Merged via the queue into bevyengine:main with commit 770f10b May 6, 2025
32 checks passed
andrewzhurov pushed a commit to andrewzhurov/bevy that referenced this pull request May 17, 2025
# Objective

Remaining work for and closes bevyengine#17682. First half of work for that issue
was completed in [PR
17730](bevyengine#17730). However, the rest
of the work ended up getting blocked because we needed a way of forcing
systems to run on the main thread without the use of `!Send` resources.
That was unblocked by [PR
18301](bevyengine#18301).

This work should finish unblocking the resources-as-components effort.

# Testing

Ran several examples using my Linux machine, just to make sure things
are working as expected and no surprises pop up.

---------

Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
Co-authored-by: François Mockers <francois.mockers@vleue.com>
@IceSentry
Copy link
Contributor

Where's the migration guide for this PR? Also, why is WINIT_WINDOWS private? That's a huge breaking change.

@joshua-holmes
Copy link
Contributor Author

There are no changes that Bevy users should need to implement on their own. One can still use !Send resources. This PR only removes Bevy's internal use of !Send resources, so a migration guide does not seem necessary.

@IceSentry can you elaborate why WINIT_WINDOWS should be public? If we need to use it somewhere else in Bevy, I would suggest making it public as a part of the PR. My understanding is that a Bevy user would never need to use this directly. I believe we talked about this in the Discord. Maybe @alice-i-cecile can shed some light on this though

@IceSentry
Copy link
Contributor

There are no changes that Bevy users should need to implement on their own. One can still use !Send resources. This PR only removes Bevy's internal use of !Send resources, so a migration guide does not seem necessary.

Removing something that used to be public is a breaking change and needs a migration guide to inform users that this change happened even if it's just telling them they can't use it anymore. Also, if people were using those NonSend resources and still want to access them they need to know how to do it without having to dig through the codebase. Knowing that you need to add a special marker and access a global variable is not obvious.

can you elaborate why WINIT_WINDOWS should be public?

I was working on a custom renderer and I needed to access the raw WinitWindow.

I was away for a while so I may have missed the discussion on discord.

I recognize this is a very niche use case, but I was hit with it and it took me a while to figure out.

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Jun 10, 2025

Indeed: this 100% needs to be made public again and have a proper migration guide. Sorry for not spotting that in review.

@joshua-holmes
Copy link
Contributor Author

I see. Yes, this makes sense. Apologies for missing this. I'll work on a migration guide and make the resource replacements public.

github-merge-queue bot pushed a commit that referenced this pull request Jun 12, 2025
After removing `!Send` resources, `GILRS` and `WINIT_WINDOWS` were not
made public, which is a breaking change. This was brought up in a
[comment on that
PR](#18386 (comment)).
This PR makes them public.

Fixes #19540.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-App Bevy apps and plugins A-ECS Entities, components, systems, and events S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Blessed Has a large architectural impact or tradeoffs, but the design has been endorsed by decision makers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐢 Make !Send resources thread_local!
7 participants