Skip to content

bevy_easings fails to compile with rust 1.55 #12

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

Closed
rparrett opened this issue Sep 10, 2021 · 7 comments
Closed

bevy_easings fails to compile with rust 1.55 #12

rparrett opened this issue Sep 10, 2021 · 7 comments

Comments

@rparrett
Copy link
Contributor

rparrett commented Sep 10, 2021

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 [email protected]: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
Copy link
Member

It is related to rust-lang/rust#86269:

  • on June 17 the pr to add lerp to std::f32 was merged - Linear interpolation rust-lang/rust#85925
  • since then building with nightly would fail
  • since the 1.55 release, rust stable has knowledge of the code behind a feature flag even though you can't enable it on stable as it's unstable - meaning you can't have your own lerp on stable and can't use the std::f32 one.

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 #11 (comment) but I'm not sure I understand what you mean?

@Carlton-Perkins
Copy link
Contributor

@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
Copy link

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

@parasyte
Copy link

#13 is merged. We need a new release.

@rparrett
Copy link
Contributor Author

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 04f9be0 if you want.

@mockersf
Copy link
Member

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
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants