Skip to content

Commit e104365

Browse files
committed
Reorder safety comment
1 parent ecd2c89 commit e104365

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/bevy_ecs/src/query/state.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,13 @@ impl<Q: WorldQuery, F: ReadOnlyWorldQuery> QueryState<Q, F> {
107107
///
108108
/// # Safety
109109
///
110-
/// It is possible to get Bevy to cast `&U` into `&T` by providing the incorrect [`ComponentId`].
110+
/// State must be the same as what is returned by [`WorldQuery::init_state`] with the same [`World`]
111+
/// passed into the function.
111112
///
112-
/// When possible use [`QueryState::new`] or initialize state using [`WorldQuery::init_state`] using
113-
/// the same [`World`] passed into this function.
113+
/// Use [`QueryState::new`] directly when possible.
114+
///
115+
/// It is possible to get Bevy to cast `&U` into `&T` by providing the incorrect [`ComponentId`]
116+
/// when querying references to components.
114117
///
115118
/// ```rust
116119
/// # use bevy_ecs::prelude::*;

0 commit comments

Comments
 (0)