-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emphasize no structural changes in SystemParam::get_param #17996
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Should I document this behavior on |
I've added the note to |
The agree that the safety docs here need some clarification, and I do like the idea of giving advice that structural changes like I'm not sure this belongs as a safety requirement on Maybe we could instead improve the safety docs for It might also be less of an issue now that Rust 2024 made the Also note that if #16622 happens, then |
Ah, right! I suppose clarifying this on And about #16622, I think the promise would then be implied by whether |
Sorry for the overly long delay, I kinda forgot I made this PR at all 😅 Anyway, only |
Objective
Many systems like
Schedule
rely on the fact that every structural ECS changes are deferred until an exclusive system flushes theWorld
itself. This gives us the benefits of being able to run systems in parallel without worrying about dangling references caused by memory (re)allocations, which will in turn lead to Undefined Behavior. However, this isn't explicitly documented inSystemParam
; currently it only vaguely hints that ininit_state
, based on the fact that structural ECS changes require mutable access to the wholeWorld
.Solution
Document this behavior explicitly in
SystemParam
's type-level documentations.