DioxusLabs / taffy

A high performance rust-powered UI layout library
https://docs.rs/taffy
Other
2.06k stars 102 forks source link

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

Closed xbz-24 closed 5 months ago

xbz-24 commented 5 months ago

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:

Additional information

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

xbz-24 commented 5 months ago

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

xbz-24 commented 5 months ago
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 commented 5 months ago

image

xbz-24 commented 5 months ago

https://gist.github.com/Xbz-24/52d2c64d9c624f0753aec4877750b5a6

xbz-24 commented 5 months ago

https://github.com/bevyengine/bevy/actions/runs/8656168577/job/23736270747?pr=12923#step:6:636

this is causing a CI failure as well