bevy/release-content
Chris Russell 5f936aefc8
Prevent exclusive systems from being used as observers (#19033)
# Objective

Prevent using exclusive systems as observers. Allowing them is unsound,
because observers are only expected to have `DeferredWorld` access, and
the observer infrastructure will keep pointers that are invalidated by
the creation of `&mut World`.

See
https://github.com/bevyengine/bevy/actions/runs/14778342801/job/41491517847?pr=19011
for a MIRI failure in a recent PR caused by an exclusive system being
used as an observer in a test.

## Solution

Have `Observer::new` panic if `System::is_exclusive()` is true. Document
that method, and methods that call it, as panicking.

(It should be possible to express this in the type system so that the
calls won't even compile, but I did not want to attempt that.)

## Testing

Added a unit test that calls `World::add_observer` with an exclusive
system.
2025-05-05 17:46:25 +00:00
..
migration-guides Prevent exclusive systems from being used as observers (#19033) 2025-05-05 17:46:25 +00:00
release-notes Text background colors (#18892) 2025-05-04 08:18:46 +00:00
migration_guides_template.md Make some changes to the migration guide recommendations (#18794) 2025-04-10 19:25:56 +00:00
migration_guides.md Make some changes to the migration guide recommendations (#18794) 2025-04-10 19:25:56 +00:00
README.md Add basic release content tagging workflow (#18568) 2025-03-27 17:46:39 +00:00
release_notes_template.md Add basic release content tagging workflow (#18568) 2025-03-27 17:46:39 +00:00
release_notes.md Add basic release content tagging workflow (#18568) 2025-03-27 17:46:39 +00:00

Release Content

This directory contains drafts of documentation for the current development cycle, which will be published to the website during the next release. You can find more information in the release notes and migration guide files.