bevy/crates
Boxy 099386f184 Fix unsound lifetime annotation on Query::get_component (#2964)
#2605 changed the lifetime annotations on `get_component` introducing unsoundness as you could keep the returned borrow even after using the query.

Example unsoundness:
```rust
use bevy::prelude::*;

fn main() {
    App::new()
        .add_startup_system(startup)
        .add_system(unsound)
        .run();
}

#[derive(Debug, Component, PartialEq, Eq)]
struct Foo(Vec<u32>);

fn startup(mut c: Commands) {
    let e = c.spawn().insert(Foo(vec![10])).id();
    c.insert_resource(e);
}

fn unsound(mut q: Query<&mut Foo>, res: Res<Entity>) {
    let foo = q.get_component::<Foo>(*res).unwrap();
    let mut foo2 = q.iter_mut().next().unwrap();

    let first_elem = &foo.0[0];
    for _ in 0..16 {
        foo2.0.push(12);
    }
    dbg!(*first_elem);
}
```
output:
`[src/main.rs:26] *first_elem = 0`
2021-10-15 16:59:29 +00:00
..
bevy_app Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_asset Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_audio Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_core Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_derive Avoid some format! into immediate format! (#2913) 2021-10-06 18:34:33 +00:00
bevy_diagnostic Avoid some format! into immediate format! (#2913) 2021-10-06 18:34:33 +00:00
bevy_dylib Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_dynamic_plugin Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_ecs Fix unsound lifetime annotation on Query::get_component (#2964) 2021-10-15 16:59:29 +00:00
bevy_gilrs Remove double Events::update in bevy-gilrs (#2894) 2021-10-08 00:37:08 +00:00
bevy_gltf Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_input Add convenience methods for checking a set of inputs (#2760) 2021-09-01 21:21:41 +00:00
bevy_internal Add trace_tracy feature for Tracy profiling (#2832) 2021-09-16 23:39:22 +00:00
bevy_log Add trace_tracy feature for Tracy profiling (#2832) 2021-09-16 23:39:22 +00:00
bevy_macro_utils Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_math Update glam requirement from 0.17.3 to 0.18.0 (#2748) 2021-09-06 18:49:40 +00:00
bevy_pbr Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_reflect Avoid some format! into immediate format! (#2913) 2021-10-06 18:34:33 +00:00
bevy_render Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_scene System Param Lifetime Split (#2605) 2021-08-15 20:51:53 +00:00
bevy_sprite Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_tasks Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_text Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_transform Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_ui Add ControlNode for UI (#2908) 2021-10-06 19:00:36 +00:00
bevy_utils derive Debug, Clone for FixedState (StableAHash) (#2694) 2021-08-24 01:31:39 +00:00
bevy_wgpu Nightly clippy fixes (#2702) 2021-09-09 16:41:21 +00:00
bevy_window unused deps? (#2809) 2021-09-16 09:37:12 +00:00
bevy_winit Fix scale_factor_override in the winit backend (#2784) 2021-09-10 18:46:16 +00:00