rust/compiler
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
..
rustc
rustc_apfloat
rustc_arena Track element count only for types that need drop 2020-10-20 17:01:51 +02:00
rustc_ast Avoid cloning the contents of a TokenStream in a few places 2020-10-19 12:30:41 -04:00
rustc_ast_lowering Auto merge of #78066 - bugadani:wat, r=jonas-schievink 2020-10-18 13:50:31 +00:00
rustc_ast_passes Lower inline const's AST to HIR 2020-10-16 15:21:16 -03:00
rustc_ast_pretty Drop unneeded mut 2020-10-20 16:42:51 +02:00
rustc_attr
rustc_builtin_macros Replace target.target with target and target.ptr_width with target.pointer_width 2020-10-15 12:02:24 +02:00
rustc_codegen_llvm Auto merge of #78047 - khyperia:set_span_mut, r=bjorn3 2020-10-18 05:36:23 +00:00
rustc_codegen_ssa Make set_span take mut self 2020-10-17 13:28:58 +02:00
rustc_data_structures Auto merge of #77908 - bugadani:obl-forest, r=nnethercote 2020-10-19 15:14:15 +00:00
rustc_driver Rollup merge of #77493 - hosseind88:ICEs_should_always_print_the_top_of_the_query_stack, r=oli-obk 2020-10-16 02:10:09 +02:00
rustc_error_codes Rollup merge of #77971 - jyn514:broken-intra-doc-links, r=mark-simulacrum 2020-10-17 05:36:49 +09:00
rustc_errors
rustc_expand Avoid cloning the contents of a TokenStream in a few places 2020-10-19 12:30:41 -04:00
rustc_feature Remove redundant 'static in the compiler 2020-10-18 17:30:15 +02:00
rustc_fs_util
rustc_graphviz
rustc_hir Lower inline const down to MIR 2020-10-16 15:21:18 -03:00
rustc_hir_pretty Lower inline const down to MIR 2020-10-16 15:21:18 -03:00
rustc_incremental
rustc_index
rustc_infer review comments 2020-10-20 09:26:15 -07:00
rustc_interface
rustc_lexer
rustc_lint Rollup merge of #77931 - aticu:fix_60336, r=petrochenkov 2020-10-20 12:11:06 +09:00
rustc_llvm
rustc_macros
rustc_metadata Replace target.target with target and target.ptr_width with target.pointer_width 2020-10-15 12:02:24 +02:00
rustc_middle Rollup merge of #78002 - estebank:issue-77598, r=oli-obk 2020-10-21 13:59:35 +09:00
rustc_mir Rollup merge of #78061 - wesleywiser:opt_zst_const_interning, r=oli-obk 2020-10-20 21:46:32 +02:00
rustc_mir_build Auto merge of #77124 - spastorino:const-exprs-rfc-2920, r=oli-obk 2020-10-17 14:44:51 +00:00
rustc_parse Avoid cloning the contents of a TokenStream in a few places 2020-10-19 12:30:41 -04:00
rustc_parse_format
rustc_passes Auto merge of #78066 - bugadani:wat, r=jonas-schievink 2020-10-18 13:50:31 +00:00
rustc_plugin_impl
rustc_privacy
rustc_query_system
rustc_resolve Rollup merge of #78048 - blyxxyz:e0424-improve-self-placement, r=lcnr 2020-10-18 04:11:11 +09:00
rustc_save_analysis
rustc_serialize
rustc_session Remove rustc_session::config::Config 2020-10-15 12:02:24 +02:00
rustc_span Add inline_const feature flag 2020-10-16 15:13:28 -03:00
rustc_symbol_mangling Rollup merge of #75675 - davidtwco:symbol-mangling-impl-params, r=eddyb 2020-10-16 02:10:02 +02:00
rustc_target Replace target.target with target and target.ptr_width with target.pointer_width 2020-10-15 12:02:24 +02:00
rustc_trait_selection Rollup merge of #78002 - estebank:issue-77598, r=oli-obk 2020-10-21 13:59:35 +09:00
rustc_traits Review comments 2020-10-16 12:58:50 -04:00
rustc_ty
rustc_typeck Rollup merge of #78063 - camelid:improve-cannot-multiply-error, r=estebank 2020-10-21 13:59:39 +09:00