bevy/crates/bevy_ecs/src/world
Rob Parrett 46293ce1e4 Fix init_non_send_resource overwriting previous values (#7261)
# Objective

Repeated calls to `init_non_send_resource` currently overwrite the old value because the wrong storage is being checked.

## Solution

Use the correct storage. Add some tests.

## Notes

Without the fix, the new test fails with
```
thread 'world::tests::init_non_send_resource_does_not_overwrite' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`', crates/bevy_ecs/src/world/mod.rs:2267:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test world::tests::init_non_send_resource_does_not_overwrite ... FAILED
```

This was introduced by #7174 and it seems like a fairly straightforward oopsie.
2023-01-18 17:06:08 +00:00
..
entity_ref.rs Make EntityRef::new unsafe (#7222) 2023-01-16 22:10:51 +00:00
identifier.rs Implement SparseSetIndex for WorldId (#7125) 2023-01-09 21:43:27 +00:00
mod.rs Fix init_non_send_resource overwriting previous values (#7261) 2023-01-18 17:06:08 +00:00
spawn_batch.rs add more SAFETY comments and lint for missing ones in bevy_ecs (#4835) 2022-07-04 14:44:24 +00:00
world_cell.rs Panic on dropping NonSend in non-origin thread. (#6534) 2023-01-09 20:40:34 +00:00