File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
crates/bevy_ecs/src/world Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ impl<'w> EntityRef<'w> {
201
201
///
202
202
/// # Safety
203
203
///
204
- /// - The returned reference must never alias a mutable borrow of this component.
204
+ /// - The returned reference must never alias another reference to this component
205
205
/// - The returned reference must not be used after this component is moved which
206
206
/// may happen from **any** `insert_component`, `remove_component` or `despawn`
207
207
/// operation on this world (non-exhaustive list).
@@ -211,7 +211,8 @@ impl<'w> EntityRef<'w> {
211
211
component_id : ComponentId ,
212
212
) -> Option < MutUntyped < ' w > > {
213
213
self . world . components ( ) . get_info ( component_id) ?;
214
- // SAFETY: entity_location is valid, component_id is valid as checked by the line above, world access is promised by the caller
214
+ // SAFETY: entity_location is valid, component_id is valid as checked by the line above,
215
+ // the caller promises that they can uniquely access this component
215
216
get_mut_by_id ( self . world , self . entity , self . location , component_id)
216
217
}
217
218
}
Original file line number Diff line number Diff line change @@ -1533,7 +1533,8 @@ impl World {
1533
1533
} ;
1534
1534
1535
1535
Some ( MutUntyped {
1536
- // SAFETY: This function has exclusive access to the world so nothing aliases `ptr`.
1536
+ // SAFETY: the caller of this function has to ensure that they can mutably access this
1537
+ // component for the duration of the `'_` lifetime
1537
1538
value : ptr. assert_unique ( ) ,
1538
1539
ticks,
1539
1540
} )
You can’t perform that action at this time.
0 commit comments