-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-DocsAn addition or correction to our documentationAn addition or correction to our documentationD-UnsafeTouches with unsafe code in some wayTouches with unsafe code in some wayS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Description
Since its introduction in 0.11
, System::update_archetype_component_access
has had a memory safety requirement for implementers (but not callers) regarding the UnsafeWorldCell
that's passed to it:
bevy/crates/bevy_ecs/src/system/system.rs
Lines 156 to 161 in cd67bac
/// Update the system's archetype component [`Access`]. | |
/// | |
/// ## Note for implementers | |
/// `world` may only be used to access metadata. This can be done in safe code | |
/// via functions such as [`UnsafeWorldCell::archetypes`]. | |
fn update_archetype_component_access(&mut self, world: UnsafeWorldCell); |
Therefore, System
must be marked as unsafe
to implement by making it an unsafe trait
. However, this is not currently the case:
bevy/crates/bevy_ecs/src/system/system.rs
Line 35 in cd67bac
pub trait System: Send + Sync + 'static { |
This should be rectified.
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-DocsAn addition or correction to our documentationAn addition or correction to our documentationD-UnsafeTouches with unsafe code in some wayTouches with unsafe code in some wayS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!