Skip to content

the trait bound f32: From<f64> is not satisfied error on nightly #4352

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

Open
doonv opened this issue Apr 12, 2024 · 1 comment
Open

the trait bound f32: From<f64> is not satisfied error on nightly #4352

doonv opened this issue Apr 12, 2024 · 1 comment
Labels
bug Something is broken

Comments

@doonv
Copy link
Contributor

doonv commented Apr 12, 2024

Describe the bug
While compiling epaint, this error occurs:

error[E0277]: the trait bound `f32: From<f64>` is not satisfied
    --> epaint-0.26.2/src/tessellator.rs:1816:34
     |
1816 |         let stroke = Stroke::new(2.0, Color32::from_rgb(150, 255, 150));
     |                      ----------- ^^^ 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 `stroke::Stroke::new`
    --> epaint-0.26.2/src/stroke.rs:23:28
     |
23   |     pub fn new(width: impl Into<f32>, color: impl Into<Color32>) -> Self {
     |                            ^^^^^^^^^ required by this bound in `Stroke::new`

To Reproduce
Steps to reproduce the behavior:

  1. Use latest nightly rust
  2. Build epaint
@doonv doonv added the bug Something is broken label Apr 12, 2024
@doonv doonv changed the title the trait bound f32: From<f64> is not satisfied error on nightly the trait bound f32: From<f64> is not satisfied error on nightly Apr 12, 2024
@crumblingstatue
Copy link
Contributor

This will be fixed in next nightly, however the impl that broke inference might be readded in the future, so we might want to make this code more robust against inference errors anyway.

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

No branches or pull requests

2 participants