Box world to prevent pointer invalidation#20775
Box world to prevent pointer invalidation#20775radiantgurl wants to merge 1 commit intobevyengine:mainfrom
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
PhantomMorrigan
left a comment
There was a problem hiding this comment.
This should use Pin<World> instead, while I don't think box would ever reallocate the world here, it's not guaranteed.Pin exists specifically for this kind of thing.
|
Why do you need to hold on to a raw pointer to If bevy does decide to guarantee address stability for things like this, that guarantee should also be explicitly communicated in the documentation of the relevant types. |
|
|
Oh, also this requires As for the why, the answer is modding, and being able to do stuff like modifying |
|
I don't recall us having any point where we're holding non-lifetimed pointers into the render world ,and more specifically into it's on-stack representation. @radiantgurl could you illustrate where this is happening or what use case you envision this to enable? It's otherwise unclear what the motivation here is. |
|
Superseded by #20975 This PR was supoosed to add constraints ensuring certain safety properties, but i found a better way of fixing the problem. |
Objective
Solution
Testing