Skip to content

bevy_math tests are broken #12729

@spectria-limina

Description

@spectria-limina

Bevy version

31d9146

What you did

cargo test -p bevy_math

What went wrong

   Compiling bevy_math v0.14.0-dev (/home/alercah/code/bevy/crates/bevy_math)
error[E0277]: the trait bound `glam::Vec3: RelativeEq<_>` is not satisfied
   --> crates/bevy_math/src/bounding/bounded3d/mod.rs:711:9
    |
711 | /         assert_relative_eq!(
712 | |             transformed.center,
713 | |             Vec3::new(2.0, std::f32::consts::SQRT_2 - 2.0, 5.0)
714 | |         );
    | |_________^ the trait `RelativeEq<_>` is not implemented for `glam::Vec3`
    |
    = help: the following other types implement trait `RelativeEq<Rhs>`:
              <f32 as RelativeEq>
              <f64 as RelativeEq>
              <Cell<T> as RelativeEq>
              <RefCell<T> as RelativeEq>
              <[A] as RelativeEq<[B]>>
              <&'a T as RelativeEq>
              <&'a mut T as RelativeEq>
note: required by a bound in `Relative`
   --> /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/approx-0.5.1/src/lib.rs:257:8
    |
255 | pub struct Relative<A, B = A>
    |            -------- required by a bound in this struct
256 | where
257 |     A: RelativeEq<B> + ?Sized,
    |        ^^^^^^^^^^^^^ required by this bound in `Relative`
    = note: this error originates in the macro `relative_eq` which comes from the expansion of the macro `assert_relative_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `glam::Vec3: RelativeEq<_>` is not satisfied
   --> crates/bevy_math/src/bounding/bounded3d/mod.rs:711:9
    |
711 | /         assert_relative_eq!(
712 | |             transformed.center,
713 | |             Vec3::new(2.0, std::f32::consts::SQRT_2 - 2.0, 5.0)
714 | |         );
    | |_________^ the trait `RelativeEq<_>` is not implemented for `glam::Vec3`
    |
    = help: the following other types implement trait `RelativeEq<Rhs>`:
              <f32 as RelativeEq>
              <f64 as RelativeEq>
              <Cell<T> as RelativeEq>
              <RefCell<T> as RelativeEq>
              <[A] as RelativeEq<[B]>>
              <&'a T as RelativeEq>
              <&'a mut T as RelativeEq>
note: required by a bound in `Relative::<A, B>::eq`
   --> /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/approx-0.5.1/src/lib.rs:282:8
    |
282 |     A: RelativeEq<B> + ?Sized,
    |        ^^^^^^^^^^^^^ required by this bound in `Relative::<A, B>::eq`
...
303 |     pub fn eq(self, lhs: &A, rhs: &B) -> bool {
    |            -- required by a bound in this associated function
    = note: this error originates in the macro `relative_eq` which comes from the expansion of the macro `assert_relative_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `glam::Vec3: AbsDiffEq` is not satisfied in `Relative<glam::Vec3>`
   --> crates/bevy_math/src/bounding/bounded3d/mod.rs:711:9
    |
711 | /         assert_relative_eq!(
712 | |             transformed.center,
713 | |             Vec3::new(2.0, std::f32::consts::SQRT_2 - 2.0, 5.0)
714 | |         );
    | |_________^ within `Relative<glam::Vec3>`, the trait `AbsDiffEq` is not implemented for `glam::Vec3`, which is required by `Relative<glam::Vec3>: Sized`
    |
    = help: the following other types implement trait `AbsDiffEq<Rhs>`:
              <isize as AbsDiffEq>
              <i8 as AbsDiffEq>
              <i16 as AbsDiffEq>
              <i32 as AbsDiffEq>
              <i64 as AbsDiffEq>
              <usize as AbsDiffEq>
              <u8 as AbsDiffEq>
              <u16 as AbsDiffEq>
            and 9 others
note: required because it appears within the type `Relative<glam::Vec3>`
   --> /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/approx-0.5.1/src/lib.rs:255:12
    |
255 | pub struct Relative<A, B = A>
    |            ^^^^^^^^
    = note: the return type of a function must have a statically known size
    = note: this error originates in the macro `relative_eq` which comes from the expansion of the macro `assert_relative_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `glam::Vec2: RelativeEq<_>` is not satisfied
   --> crates/bevy_math/src/rotation2d.rs:449:9
    |
449 |         assert_relative_eq!(rotation * Vec2::X, Vec2::Y);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RelativeEq<_>` is not implemented for `glam::Vec2`
    |
    = help: the following other types implement trait `RelativeEq<Rhs>`:
              <f32 as RelativeEq>
              <f64 as RelativeEq>
              <Cell<T> as RelativeEq>
              <RefCell<T> as RelativeEq>
              <[A] as RelativeEq<[B]>>
              <&'a T as RelativeEq>
              <&'a mut T as RelativeEq>
note: required by a bound in `Relative`
   --> /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/approx-0.5.1/src/lib.rs:257:8
    |
255 | pub struct Relative<A, B = A>
    |            -------- required by a bound in this struct
256 | where
257 |     A: RelativeEq<B> + ?Sized,
    |        ^^^^^^^^^^^^^ required by this bound in `Relative`
    = note: this error originates in the macro `relative_eq` which comes from the expansion of the macro `assert_relative_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `glam::Vec2: RelativeEq<_>` is not satisfied
   --> crates/bevy_math/src/rotation2d.rs:449:9
    |
449 |         assert_relative_eq!(rotation * Vec2::X, Vec2::Y);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RelativeEq<_>` is not implemented for `glam::Vec2`
    |
    = help: the following other types implement trait `RelativeEq<Rhs>`:
              <f32 as RelativeEq>
              <f64 as RelativeEq>
              <Cell<T> as RelativeEq>
              <RefCell<T> as RelativeEq>
              <[A] as RelativeEq<[B]>>
              <&'a T as RelativeEq>
              <&'a mut T as RelativeEq>
note: required by a bound in `Relative::<A, B>::eq`
   --> /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/approx-0.5.1/src/lib.rs:282:8
    |
282 |     A: RelativeEq<B> + ?Sized,
    |        ^^^^^^^^^^^^^ required by this bound in `Relative::<A, B>::eq`
...
303 |     pub fn eq(self, lhs: &A, rhs: &B) -> bool {
    |            -- required by a bound in this associated function
    = note: this error originates in the macro `relative_eq` which comes from the expansion of the macro `assert_relative_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `direction::Dir2: RelativeEq<_>` is not satisfied
   --> crates/bevy_math/src/rotation2d.rs:450:9
    |
450 |         assert_relative_eq!(rotation * Dir2::Y, Dir2::NEG_X);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RelativeEq<_>` is not implemented for `direction::Dir2`
    |
    = help: the following other types implement trait `RelativeEq<Rhs>`:
              <f32 as RelativeEq>
              <f64 as RelativeEq>
              <Cell<T> as RelativeEq>
              <RefCell<T> as RelativeEq>
              <[A] as RelativeEq<[B]>>
              <&'a T as RelativeEq>
              <&'a mut T as RelativeEq>
note: required by a bound in `Relative`
   --> /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/approx-0.5.1/src/lib.rs:257:8
    |
255 | pub struct Relative<A, B = A>
    |            -------- required by a bound in this struct
256 | where
257 |     A: RelativeEq<B> + ?Sized,
    |        ^^^^^^^^^^^^^ required by this bound in `Relative`
    = note: this error originates in the macro `relative_eq` which comes from the expansion of the macro `assert_relative_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `direction::Dir2: RelativeEq<_>` is not satisfied
   --> crates/bevy_math/src/rotation2d.rs:450:9
    |
450 |         assert_relative_eq!(rotation * Dir2::Y, Dir2::NEG_X);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RelativeEq<_>` is not implemented for `direction::Dir2`
    |
    = help: the following other types implement trait `RelativeEq<Rhs>`:
              <f32 as RelativeEq>
              <f64 as RelativeEq>
              <Cell<T> as RelativeEq>
              <RefCell<T> as RelativeEq>
              <[A] as RelativeEq<[B]>>
              <&'a T as RelativeEq>
              <&'a mut T as RelativeEq>
note: required by a bound in `Relative::<A, B>::eq`
   --> /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/approx-0.5.1/src/lib.rs:282:8
    |
282 |     A: RelativeEq<B> + ?Sized,
    |        ^^^^^^^^^^^^^ required by this bound in `Relative::<A, B>::eq`
...
303 |     pub fn eq(self, lhs: &A, rhs: &B) -> bool {
    |            -- required by a bound in this associated function
    = note: this error originates in the macro `relative_eq` which comes from the expansion of the macro `assert_relative_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `glam::Vec2: AbsDiffEq` is not satisfied in `Relative<glam::Vec2>`
   --> crates/bevy_math/src/rotation2d.rs:449:9
    |
449 |         assert_relative_eq!(rotation * Vec2::X, Vec2::Y);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Relative<glam::Vec2>`, the trait `AbsDiffEq` is not implemented for `glam::Vec2`, which is required by `Relative<glam::Vec2>: Sized`
    |
    = help: the following other types implement trait `AbsDiffEq<Rhs>`:
              <isize as AbsDiffEq>
              <i8 as AbsDiffEq>
              <i16 as AbsDiffEq>
              <i32 as AbsDiffEq>
              <i64 as AbsDiffEq>
              <usize as AbsDiffEq>
              <u8 as AbsDiffEq>
              <u16 as AbsDiffEq>
            and 9 others
note: required because it appears within the type `Relative<glam::Vec2>`
   --> /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/approx-0.5.1/src/lib.rs:255:12
    |
255 | pub struct Relative<A, B = A>
    |            ^^^^^^^^
    = note: the return type of a function must have a statically known size
    = note: this error originates in the macro `relative_eq` which comes from the expansion of the macro `assert_relative_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `direction::Dir2: AbsDiffEq` is not satisfied in `Relative<direction::Dir2>`
   --> crates/bevy_math/src/rotation2d.rs:450:9
    |
450 |         assert_relative_eq!(rotation * Dir2::Y, Dir2::NEG_X);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Relative<direction::Dir2>`, the trait `AbsDiffEq` is not implemented for `direction::Dir2`, which is required by `Relative<direction::Dir2>: Sized`
    |
    = help: the following other types implement trait `AbsDiffEq<Rhs>`:
              <isize as AbsDiffEq>
              <i8 as AbsDiffEq>
              <i16 as AbsDiffEq>
              <i32 as AbsDiffEq>
              <i64 as AbsDiffEq>
              <usize as AbsDiffEq>
              <u8 as AbsDiffEq>
              <u16 as AbsDiffEq>
            and 9 others
note: required because it appears within the type `Relative<direction::Dir2>`
   --> /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/approx-0.5.1/src/lib.rs:255:12
    |
255 | pub struct Relative<A, B = A>
    |            ^^^^^^^^
    = note: the return type of a function must have a statically known size
    = note: this error originates in the macro `relative_eq` which comes from the expansion of the macro `assert_relative_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `bevy_math` (lib test) due to 9 previous errors

Additional information

This appears to be because the implementations of approx types are not available when compiling for tests.

cargo test -p bevy_math --features approx fixes things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MathFundamental domain-agnostic mathematical operationsC-BugAn unexpected or incorrect behaviorC-TestingA change that impacts how we test Bevy or how users test their apps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions