Skip to content

Commit efbebce

Browse files
add missing safety comment
1 parent d637af0 commit efbebce

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/bevy_asset/src/reflect.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ impl<A: Asset + FromReflect> FromType<A> for ReflectAsset {
145145
asset.map(|asset| asset as &dyn Reflect)
146146
},
147147
get_unchecked_mut: |world, handle| {
148+
// SAFETY: `get_unchecked_mut` must be callied with `InteriorMutableWorld` having access to `Assets<A>`,
149+
// and must ensure to only have at most one reference to it live at all times.
148150
let assets = unsafe { world.get_resource_mut::<Assets<A>>().unwrap().into_inner() };
149151
let asset = assets.get_mut(&handle.typed());
150152
asset.map(|asset| asset as &mut dyn Reflect)

0 commit comments

Comments
 (0)