Skip to content

Commit

Permalink
rename 'world lifetime
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxyUwU committed Aug 7, 2022
1 parent 45d080d commit 5a6da79
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/bevy_ecs/src/system/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ pub mod query_world_borrows {
/// This struct only implements [`Copy`] and [`Clone`] when `QF: ReadOnlyWorldQuery` to mimic the fact that
/// `ReadOnlyWorldQuery` borrows should act like `&'lock HashMap<..., ...>` wheras mutable world queries act
/// like `&'lock mut HashMap<..., ...>` (see module level docs).
pub struct QueryLockBorrows<'world, QF: WorldQuery> {
world: &'world World,
pub struct QueryLockBorrows<'lock, QF: WorldQuery> {
world: &'lock World,
// invariance because its probably possible to have two worldquery's where one is the subtype of another
// but each have different mutabilities. i.e. `dyn for<'a> Trait<'a>: WorldQuery` and `dyn Trait<'static>: WorldQuery`.
// probably not unsound since `Q` and `F` are already invariant on `Query` but this seems like a footgun and I don't care
Expand All @@ -330,9 +330,9 @@ pub mod query_world_borrows {
_p: PhantomData<fn(QF) -> QF>,
}

impl<'world, QF: WorldQuery> QueryLockBorrows<'world, QF> {
impl<'lock, QF: WorldQuery> QueryLockBorrows<'lock, QF> {
// FIXME: should this be unsafe?
pub fn new(world: &'world World) -> Self {
pub fn new(world: &'lock World) -> Self {
Self {
world,
_p: PhantomData,
Expand All @@ -345,7 +345,7 @@ pub mod query_world_borrows {
/// - The `World` must not be accessed in a way that the `Query`'s access does not give
/// it permission to. You should be careful when working with this `&World` as many safe functions
/// on `World` will be unsound to call.
pub unsafe fn into_world_ref(self) -> &'world World {
pub unsafe fn into_world_ref(self) -> &'lock World {
self.world
}

Expand Down Expand Up @@ -386,7 +386,7 @@ pub mod query_world_borrows {
/// on `World` will be unsound to call.
/// - As the returned lifetime is not bound to `&self` you should avoid calling any methods on this struct
/// until you can be sure that the returned borrow (and any copies of it) are dead.
pub unsafe fn world_ref_unbounded(&self) -> &'world World {
pub unsafe fn world_ref_unbounded(&self) -> &'lock World {
self.world
}

Expand Down Expand Up @@ -414,7 +414,7 @@ pub mod query_world_borrows {
}
}

pub fn to_readonly(self) -> QueryLockBorrows<'world, QF::ReadOnly> {
pub fn to_readonly(self) -> QueryLockBorrows<'lock, QF::ReadOnly> {
QueryLockBorrows {
world: self.world,
_p: PhantomData,
Expand Down

0 comments on commit 5a6da79

Please sign in to comment.