#bevy #errors #debug

macro bevycheck

Helpful bevy error messages by proc-macro

7 releases

Uses new Rust 2021

0.3.0 Apr 15, 2022
0.2.0 Jan 19, 2022
0.1.4 Jun 24, 2021
0.1.3 May 19, 2021
0.1.1 Apr 9, 2021

#402 in Procedural macros

Download history 26/week @ 2022-04-15 12/week @ 2022-04-22 16/week @ 2022-04-29 47/week @ 2022-05-06 120/week @ 2022-05-13 24/week @ 2022-05-20 42/week @ 2022-05-27 60/week @ 2022-06-03 5/week @ 2022-06-10 10/week @ 2022-06-17 2/week @ 2022-06-24 22/week @ 2022-07-01 15/week @ 2022-07-08 9/week @ 2022-07-15 15/week @ 2022-07-22 16/week @ 2022-07-29

62 downloads per month

MIT license

20KB
317 lines

bevycheck

Bevycheck helps debug bevy errors by adding procedural macros which display nice error messages.

If you want a proper linter with type information, also check out https://github.com/MinerSebas/bevy_lint

Disclaimer

bevycheck can't figure out all valid system parameters, for example, custom types with #[derive(SystemParam)] won't work. If you find a type that should work but get's reported, please file an issue.

This crate is meant as a temporary measure to figure out why something doesn't compile, but shouldn't be kept in the final code.

Invalid Systems

If you get an error like

  • no method named "system" found for fn item "for<'r, 's> fn(Query<'r, &'s Component>, Commands) {my_system}" in the current scope "my_system" is a function, perhaps you wish to call it
  • the trait bound "Component: WorldQuery" is not satisfied the trait "WorldQuery" is not implemented for "Component"

simply add #[bevycheck::system] to your function and helpful error messages will appear.

#[bevycheck::system]
fn system(commands: &mut Commands, query: Query<(Entity, GlobalTransform)>) {
    // ...
}
error: invalid system parameter
 --> examples/test.rs:4:21
  |
4 | fn system(commands: &mut Commands, query: Query<(Entity, GlobalTransform)>) {}
  |                     ^^^^^^^^^^^^^
  |
  = help: use `mut commands: Commands`

error: invalid query parameter
 --> examples/test.rs:4:58
  |
4 | fn system(commands: &mut Commands, query: Query<(Entity, GlobalTransform)>) {}
  |                                                          ^^^^^^^^^^^^^^^
  |
  = note: `GlobalTransform` is not a valid query type
  = help: if you want to query for a resource, use `&GlobalTransform` or `&mut GlobalTransform`

error: aborting due to 2 previous errors

error: could not compile `bevycheck`

To learn more, run the command again with --verbose.

Bevy support table

bevy beyvcheck
0.7 0.3
0.6 0.2
0.5 0.1

Dependencies

~11–17MB
~346K SLoC