Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The trait bound f32: From<f64> is not satisfied #642

Closed
xbz-24 opened this issue Apr 12, 2024 · 5 comments · Fixed by #643
Closed

The trait bound f32: From<f64> is not satisfied #642

xbz-24 opened this issue Apr 12, 2024 · 5 comments · Fixed by #643
Labels
bug Something isn't working

Comments

@xbz-24
Copy link

xbz-24 commented Apr 12, 2024

taffy version

The release number or commit hash of the version you're using.
0.3.18

Platform

What platform are you using taffy on? e.g. Rust, Android, IOS, JavaScript/TypeScript
Rust arm64 darwin

What you did

The steps you took to uncover this bug.

[package]
name = "sandbox"
version = "0.1.0"
edition = "2021"

[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3

[dependencies]
bevy = { version = "0.13.2", features = ["bevy_gltf", "png", "dynamic_linking"] }
bevy-inspector-egui = "0.23.4"
bevy_dolly = "0.0.3"
bevy_rapier3d = { version = "0.25.0", features = ["simd-stable", "debug-render-3d"] }

Please provide a runnable code snippet or link to an example that demonstrates the problem if you can.

error[E0277]: the trait bound `f32: From<f64>` is not satisfied
   --> /Users/xbz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/taffy-0.3.18/src/style_helpers.rs:58:31
    |
58  |     repeated_tracks.push(flex(1.0));
    |                          ---- ^^^ the trait `From<f64>` is not implemented for `f32`, which is required by `{float}: Into<f32>`
    |                          |
    |                          required by a bound introduced by this call
    |
    = help: the following other types implement trait `From<T>`:
              <f32 as From<bool>>
              <f32 as From<f16>>
              <f32 as From<i16>>
              <f32 as From<i8>>
              <f32 as From<u16>>
              <f32 as From<u8>>
    = note: required for `f64` to implement `Into<f32>`
note: required by a bound in `flex`
   --> /Users/xbz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/taffy-0.3.18/src/style_helpers.rs:100:12
    |
98  | pub fn flex<Input, Output>(flex_fraction: Input) -> Output
    |        ---- required by a bound in this function
99  | where
100 |     Input: Into<f32> + Copy,
    |            ^^^^^^^^^ required by this bound in `flex`


What went wrong

If it's not clear:

  • what were you expecting?
  • what actually happened?

Additional information

Other information that can be used to further reproduce or isolate the problem.
This commonly includes:

  • screenshots
  • logs
  • theories about what might be going wrong
  • workarounds that you used
  • links to related bugs, PRs or discussions
@xbz-24 xbz-24 added the bug Something isn't working label Apr 12, 2024
@xbz-24
Copy link
Author

xbz-24 commented Apr 12, 2024

I just added bevy-rapier3d that uses taffy 0.3.18 and I am getting this compilation error

@xbz-24
Copy link
Author

xbz-24 commented Apr 12, 2024

error[E0277]: the trait bound `f32: From<f64>` is not satisfied
   --> /Users/xbz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/taffy-0.3.18/src/style_helpers.rs:58:31
    |
58  |     repeated_tracks.push(flex(1.0));
    |                          ---- ^^^ the trait `From<f64>` is not implemented for `f32`, which is required by `{float}: Into<f32>`
    |                          |
    |                          required by a bound introduced by this call
    |
    = help: the following other types implement trait `From<T>`:
              <f32 as From<bool>>
              <f32 as From<f16>>
              <f32 as From<i16>>
              <f32 as From<i8>>
              <f32 as From<u16>>
              <f32 as From<u8>>
    = note: required for `f64` to implement `Into<f32>`
note: required by a bound in `flex`
   --> /Users/xbz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/taffy-0.3.18/src/style_helpers.rs:100:12
    |
98  | pub fn flex<Input, Output>(flex_fraction: Input) -> Output
    |        ---- required by a bound in this function
99  | where
100 |     Input: Into<f32> + Copy,
    |            ^^^^^^^^^ required by this bound in `flex`

@xbz-24
Copy link
Author

xbz-24 commented Apr 12, 2024

image

@xbz-24
Copy link
Author

xbz-24 commented Apr 12, 2024

@xbz-24
Copy link
Author

xbz-24 commented Apr 12, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant