diff options
| author | Camelid <camelidcamel@gmail.com> | 2020-10-17 19:59:51 -0700 |
|---|---|---|
| committer | Camelid <camelidcamel@gmail.com> | 2020-10-17 22:19:25 -0700 |
| commit | 7b33ae642e29635f8446fed7641b5665d0c149e6 (patch) | |
| tree | a321db350362898721ac51ed63b108e3195a939e /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | f1b97ee7f8ffb1a814944b85c7e05a1555a7eda5 (diff) | |
| download | rust-7b33ae642e29635f8446fed7641b5665d0c149e6.tar.gz rust-7b33ae642e29635f8446fed7641b5665d0c149e6.zip | |
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`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
