vleue / bevy_easings

Bevy plugin for easings and simple animations
181 stars 28 forks source link

bevy_easings fails to compile with rust 1.55 #12

Closed rparrett closed 3 years ago

rparrett commented 3 years ago

This is possibly related to #11, although that predates rust 1.55 and doesn't seem like an actual solution. But perhaps that user was using rust beta?

error[E0658]: use of unstable library feature 'float_interpolation'
   --> bevy_easings/src/implemented.rs:125:49
    |
125 |                 EaseValue(Val::Percent(self_val.lerp(&other_val, scalar)))
    |                                                 ^^^^
    |
    = note: see issue #86269 <https://github.com/rust-lang/rust/issues/86269> for more information

error[E0308]: mismatched types
   --> bevy_easings/src/implemented.rs:125:54
    |
125 |                 EaseValue(Val::Percent(self_val.lerp(&other_val, scalar)))
    |                                                      ^^^^^^^^^^
    |                                                      |
    |                                                      expected `f32`, found `&f32`
    |                                                      help: consider removing the borrow: `other_val`

I am able to reproduce this consistently by

rustup update stable
rustup install 1.54

git clone git@github.com:mockersf/bevy_extra.git
cd bevy_extra/bevy_easings
git checkout 68d53df #0.4?
cargo clean && cargo +stable test #fails
cargo clean && cargo +1.54 test   #succeeds

This seems a little wacky to me, because I can't find any information about 1.55 related to float_interpolation.

mockersf commented 3 years ago

It is related to https://github.com/rust-lang/rust/issues/86269:

I'm not sure how to fix this other than renaming lerp to... something else until the feature is stabilised and then move over to std::f32::lerp

@Carlton-perkins you seemed to have an idea in https://github.com/mockersf/bevy_extra/pull/11#issuecomment-913168803 but I'm not sure I understand what you mean?

Carlton-Perkins commented 3 years ago

@Carlton-Perkins you seemed to have an idea in #11 (comment) but I'm not sure I understand what you mean?

Was completely overthinking the problem when I wrote that. This can just be fixed until the feature is stabilized via trait method disambiguation. And whenever the feature is stabilized, its a simple fix to just swap around the references to values like the original error suggests.

Fix is on PR #13.

sphinxc0re commented 3 years ago

Will there be a minor release soon that includes the fix?

parasyte commented 3 years ago

13 is merged. We need a new release.

rparrett commented 3 years ago

In the meantime, you can use https://github.com/rparrett/bevy_extra/commits/fix-0.5 which is based on the last commit that's compatible with bevy 0.5 and cherry-picks 04f9be0284f5b01b94c0f12d60ac6b7c72d1494f if you want.

mockersf commented 3 years ago

Sorry I missed that, just pushed https://crates.io/crates/bevy_easings/0.4.1 that works with Bevy 0.5 and Rust 1.55

rparrett commented 3 years ago

Thanks!