Skip to content

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

@doonv

Description

@doonv

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions