yeet World::components_mut >:( (#4092)

# Objective
make bevy ecs a lil bit less unsound
## Solution
yeet unsound API `World::components_mut`:
```rust
use bevy_ecs::prelude::*;

#[derive(Component)]
struct Foo(u8);

#[derive(Debug, Component)]
struct Bar([u8; 100]);

fn main() {
    let mut world = World::new();
    let e = world.spawn().insert(Foo(0)).id();
    *world.components_mut() = Default::default();
    let bar = world.entity_mut(e).remove::<Bar>().unwrap();
    // oopsies reading memory copied from outside allocation
    dbg!(bar);
}
```
This commit is contained in:
Boxy 2022-03-21 23:43:08 +00:00
parent 54fbaf4b4c
commit 050d2b7f00

View File

@ -152,12 +152,6 @@ impl World {
&self.components
}
/// Retrieves a mutable reference to this world's [Components] collection
#[inline]
pub fn components_mut(&mut self) -> &mut Components {
&mut self.components
}
/// Retrieves this world's [Storages] collection
#[inline]
pub fn storages(&self) -> &Storages {