Skip to content

Commit

Permalink
Update dependencies (#43)
Browse files Browse the repository at this point in the history
* Update Bevy's commit hash to the latest on main.
* Update to syn 2.0.
* Update to criterion 0.5.
  • Loading branch information
joseph-gio authored Jun 29, 2023
1 parent 2071f9c commit 7cec2c4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ bevy-trait-query-impl = { path = "proc-macro", version = "0.2" }

[dependencies.bevy]
git = "https://github.com/bevyengine/bevy"
rev = "21e1893c4f39bfd33967145810479d56b03486ce"
rev = "aeeb20ec4c43db07c2690ce926169ed9d6550d93"
default-features = false

[dev-dependencies]
criterion = "0.4"
criterion = "0.5"

[[bench]]
name = "concrete"
Expand Down
2 changes: 1 addition & 1 deletion proc-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ proc-macro = true

[dependencies]
proc-macro2 = "1"
syn = { version = "1", features = ["full"] }
syn = { version = "2", features = ["full"] }
quote = "1"
proc-macro-crate = "1"
4 changes: 2 additions & 2 deletions proc-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn impl_trait_query(arg: TokenStream, item: TokenStream) -> Result<TokenStream2>

#[inline]
unsafe fn init_fetch<'w>(
world: &'w #imports::World,
world: #imports::UnsafeWorldCell<'w>,
state: &Self::State,
last_run: #imports::Tick,
this_run: #imports::Tick,
Expand Down Expand Up @@ -270,7 +270,7 @@ fn impl_trait_query(arg: TokenStream, item: TokenStream) -> Result<TokenStream2>

#[inline]
unsafe fn init_fetch<'w>(
world: &'w #imports::World,
world: #imports::UnsafeWorldCell<'w>,
state: &Self::State,
last_run: #imports::Tick,
this_run: #imports::Tick,
Expand Down
16 changes: 11 additions & 5 deletions src/all.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use crate::{
debug_unreachable, zip_exact, TraitImplMeta, TraitImplRegistry, TraitQuery, TraitQueryState,
debug_unreachable, trait_registry_error, zip_exact, TraitImplMeta, TraitImplRegistry,
TraitQuery, TraitQueryState,
};
use bevy::ecs::change_detection::Mut;
use bevy::ecs::component::{ComponentId, Tick};
use bevy::ecs::entity::Entity;
use bevy::ecs::query::{QueryItem, ReadOnlyWorldQuery, WorldQuery};
use bevy::ecs::storage::{SparseSets, Table, TableRow};
use bevy::ecs::world::unsafe_world_cell::UnsafeWorldCell;
use bevy::ecs::world::World;
use bevy::ptr::UnsafeCellDeref;

Expand Down Expand Up @@ -391,13 +393,15 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> WorldQuery for All<&'a Trait> {

#[inline]
unsafe fn init_fetch<'w>(
world: &'w World,
world: UnsafeWorldCell<'w>,
_state: &Self::State,
_last_run: Tick,
_this_run: Tick,
) -> ReadAllTraitsFetch<'w, Trait> {
ReadAllTraitsFetch {
registry: world.resource(),
registry: world
.get_resource()
.unwrap_or_else(|| trait_registry_error()),
table: None,
sparse_sets: &world.storages().sparse_sets,
}
Expand Down Expand Up @@ -506,13 +510,15 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> WorldQuery for All<&'a mut Trait> {

#[inline]
unsafe fn init_fetch<'w>(
world: &'w World,
world: UnsafeWorldCell<'w>,
_state: &Self::State,
last_run: Tick,
this_run: Tick,
) -> WriteAllTraitsFetch<'w, Trait> {
WriteAllTraitsFetch {
registry: world.resource(),
registry: world
.get_resource()
.unwrap_or_else(|| trait_registry_error()),
table: None,
sparse_sets: &world.storages().sparse_sets,
last_run,
Expand Down
10 changes: 8 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
//! # fn show_tooltips() {}
//! #
//! # fn main() {
//! # App::new().add_plugins(DefaultPlugins).add_plugin(TooltipPlugin).update();
//! # App::new().add_plugins((DefaultPlugins, TooltipPlugin)).update();
//! # }
//! ```
//!
Expand Down Expand Up @@ -359,7 +359,7 @@ pub mod imports {
Access, Added, Changed, FilteredAccess, QueryItem, ReadOnlyWorldQuery, WorldQuery,
},
storage::{Table, TableRow},
world::World,
world::{unsafe_world_cell::UnsafeWorldCell, World},
};
}

Expand Down Expand Up @@ -473,3 +473,9 @@ unsafe fn debug_unreachable() -> ! {
#[cfg(not(debug_assertions))]
std::hint::unreachable_unchecked();
}

#[inline(never)]
#[cold]
fn trait_registry_error() -> ! {
panic!("The trait query registry has not been initialized; did you forget to register your traits with the world?")
}
5 changes: 3 additions & 2 deletions src/one.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use bevy::ecs::component::{ComponentId, ComponentTicks, Tick};
use bevy::ecs::entity::Entity;
use bevy::ecs::query::{QueryItem, ReadOnlyWorldQuery, WorldQuery};
use bevy::ecs::storage::{ComponentSparseSet, SparseSets, TableRow};
use bevy::ecs::world::unsafe_world_cell::UnsafeWorldCell;
use bevy::ecs::world::World;
use bevy::ptr::{Ptr, ThinSlicePtr, UnsafeCellDeref};
use std::cell::UnsafeCell;
Expand Down Expand Up @@ -93,7 +94,7 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> WorldQuery for One<&'a Trait> {

#[inline]
unsafe fn init_fetch<'w>(
world: &'w World,
world: UnsafeWorldCell<'w>,
_state: &Self::State,
_last_run: Tick,
_this_run: Tick,
Expand Down Expand Up @@ -262,7 +263,7 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> WorldQuery for One<&'a mut Trait> {

#[inline]
unsafe fn init_fetch<'w>(
world: &'w World,
world: UnsafeWorldCell<'w>,
_state: &Self::State,
last_run: Tick,
this_run: Tick,
Expand Down

0 comments on commit 7cec2c4

Please sign in to comment.