rust/library
Yuki Okushi 89c98cd6b4
Rollup merge of #78063 - camelid:improve-cannot-multiply-error, r=estebank
Improve wording of "cannot multiply" type error

For example, if you had this code:

    fn foo(x: i32, y: f32) -> f32 {
        x * y
    }

You would get this error:

    error[E0277]: cannot multiply `f32` to `i32`
     --> src/lib.rs:2:7
      |
    2 |     x * y
      |       ^ no implementation for `i32 * f32`
      |
      = help: the trait `Mul<f32>` is not implemented for `i32`

However, that's not usually how people describe multiplication. People
usually describe multiplication like how the division error words it:

    error[E0277]: cannot divide `i32` by `f32`
     --> src/lib.rs:2:7
      |
    2 |     x / y
      |       ^ no implementation for `i32 / f32`
      |
      = help: the trait `Div<f32>` is not implemented for `i32`

So that's what this change does. It changes this:

    error[E0277]: cannot multiply `f32` to `i32`
     --> src/lib.rs:2:7
      |
    2 |     x * y
      |       ^ no implementation for `i32 * f32`
      |
      = help: the trait `Mul<f32>` is not implemented for `i32`

To this:

    error[E0277]: cannot multiply `i32` by `f32`
     --> src/lib.rs:2:7
      |
    2 |     x * y
      |       ^ no implementation for `i32 * f32`
      |
      = help: the trait `Mul<f32>` is not implemented for `i32`
2020-10-21 13:59:39 +09:00
..
alloc Rollup merge of #78056 - ssomers:btree_chop_up_1, r=dtolnay 2020-10-21 13:59:37 +09:00
backtrace@a6dd47bd58 Bump backtrace-rs 2020-10-15 15:21:12 -04:00
core Rollup merge of #78063 - camelid:improve-cannot-multiply-error, r=estebank 2020-10-21 13:59:39 +09:00
panic_abort
panic_unwind
proc_macro Bump to 1.48 bootstrap compiler 2020-10-07 19:51:36 -04:00
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Rollup merge of #77923 - wcampbell0x2a:cleanup-net-module, r=scottmcm 2020-10-20 12:11:04 +09:00
stdarch@3c3664355e
term
test Auto merge of #74480 - yoshuawuyts:hardware_threads, r=dtolnay 2020-10-18 02:28:21 +00:00
unwind Remove useless all in cfg 2020-10-09 13:24:05 +02:00