rust/src
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
..
bootstrap Rollup merge of #77778 - jyn514:git-hook, r=mark-simulacrum 2020-10-20 12:11:00 +09:00
build_helper cleanup: Remove duplicate library names from Cargo.tomls 2020-08-30 22:57:54 +03:00
ci Update Xcode beta version to allow aarch64-apple-darwin to compile again 2020-10-14 13:51:28 -04:00
doc Auto merge of #76885 - dylni:move-slice-check-range-to-range-bounds, r=KodrAus 2020-10-18 18:50:43 +00:00
etc BTreeMap: improve gdb introspection of BTreeMap with ZST keys or values 2020-10-14 13:03:23 +02:00
librustdoc Rollup merge of #78157 - GuillaumeGomez:remove-unused-type, r=jyn514 2020-10-20 21:46:43 +02:00
llvm-project@655a1467c9 Update LLVM for LLD COFF TLS alignment fix. 2020-10-17 01:34:08 -07:00
test Rollup merge of #78063 - camelid:improve-cannot-multiply-error, r=estebank 2020-10-21 13:59:39 +09:00
tools Rollup merge of #78059 - JohnTitor:fix-linkcheck, r=ehuss 2020-10-18 04:11:15 +09:00
README.md Update README.md 2020-08-30 13:40:11 -05:00
stage0.txt Rollup merge of #77877 - scottmcm:fewer-try-trait-method-references, r=shepmaster 2020-10-19 18:20:20 +02:00
version Bump version to 1.49.0 2020-10-02 08:39:40 -04:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.