Skip to content

Commit

Permalink
Fix broken WorldCell test (bevyengine#5009)
Browse files Browse the repository at this point in the history
# Objective

Fixes bevyengine#5008. Aliasing references is allowed under Rust if and only if they are immutable.

This logic applies to `WorldCell` as well.
  • Loading branch information
alice-i-cecile committed Jun 14, 2022
1 parent 915fa69 commit dc950a4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/bevy_ecs/src/world/world_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,11 @@ mod tests {
}

#[test]
#[should_panic]
fn world_cell_ref_and_ref() {
let mut world = World::default();
world.insert_resource(1u32);
let cell = world.cell();
let _value_a = cell.resource_mut::<u32>();
let _value_a = cell.resource::<u32>();
let _value_b = cell.resource::<u32>();
}
}

0 comments on commit dc950a4

Please sign in to comment.