Skip to content

System should be an unsafe trait #19022

Open
@ItsDoot

Description

@ItsDoot

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:

/// 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:

pub trait System: Send + Sync + 'static {

This should be rectified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorC-Code-QualityA section of code that is hard to understand or changeC-DocsAn addition or correction to our documentationD-UnsafeTouches with unsafe code in some wayS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions