Make NonSendMarker !Send#19107
Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom May 7, 2025
Merged
Conversation
alice-i-cecile
approved these changes
May 7, 2025
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
I'm very much hoping to remove this for 0.17 but we might as well merge this.
andrewzhurov
pushed a commit
to andrewzhurov/bevy
that referenced
this pull request
May 17, 2025
# Objective In bevyengine#18301, `NonSendMarker` was defined in such a way that it actually implements `Send`. This isn't strictly a soundness issue, as its goal is to be used as a `SystemParam`, and it _does_ appropriately mark system access as `!Send`. It just seems odd that `NonSendMarker: Send`. ## Solution - Made `NonSendMarker` wrap `PhantomData<*mut ()>`, which forces it to be `!Send`. ## Testing - CI --- ## Notes This does mean constructing a `NonSendMarker` _value_ will require using the `SystemParam` trait, but I think that's acceptable as the marker as a value should be rarely required if at all.
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
In #18301,
NonSendMarkerwas defined in such a way that it actually implementsSend. This isn't strictly a soundness issue, as its goal is to be used as aSystemParam, and it does appropriately mark system access as!Send. It just seems odd thatNonSendMarker: Send.Solution
NonSendMarkerwrapPhantomData<*mut ()>, which forces it to be!Send.Testing
Notes
This does mean constructing a
NonSendMarkervalue will require using theSystemParamtrait, but I think that's acceptable as the marker as a value should be rarely required if at all.