compiler-errors/next-solver-hir-issues

Can't add `f64 + {float}`

Closed this issue · 1 comments

fn foo(x: f64) {
    let y = x + 1.0;
}
error[E0277]: cannot add `{float}` to `f64`
 --> <source>:2:15
  |
2 |     let y = x + 1.0;
  |               ^ no implementation for `f64 + {float}`
  |
  = help: the trait `Add<{float}>` is not implemented for `f64`
  = help: the following other types implement trait `Add<Rhs>`:
            <&'a f64 as Add<f64>>
            <&f64 as Add<&f64>>
            <f64 as Add<&f64>>
            <f64 as Add>

error: the type `fn(f64, _) -> <f64 as Add<_>>::Output` is not well-formed
 --> <source>:2:15
  |
2 |     let y = x + 1.0;
  |               ^

That WF error is strange.


Probably also fixes: tests/ui/associated-types/issue-18655.rs

Oh, we were canonicalizing float vars wrong. Easy fix. Phew.