Auto merge of #40565 - estebank:binops-help, r=arielb1
Explicit help message for binop type mismatch
When trying to do `1 + Some(2)`, or some other binary operation on two
types different types without an appropriate trait implementation, provide
an explicit help message:
```rust
help: `{integer} + std::option::Option<{integer}>` has no implementation
```
Re: #39579, #38564, #37626, #39942, #34698.
This commit is contained in:
commit
730e5ad04e
8 changed files with 164 additions and 17 deletions
|
|
@ -9,11 +9,7 @@ error[E0277]: the trait bound `u32: std::ops::Add<()>` is not satisfied
|
|||
27 | | y),
|
||||
| |______________^ ...ending here: the trait `std::ops::Add<()>` is not implemented for `u32`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<u32 as std::ops::Add>
|
||||
<&'a u32 as std::ops::Add<u32>>
|
||||
<u32 as std::ops::Add<&'a u32>>
|
||||
<&'b u32 as std::ops::Add<&'a u32>>
|
||||
= note: no implementation for `u32 + ()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue