Closed
Description
Given the following code:
use core::ops::Add;
fn add<A, B, C>(a: A, b: B) -> C {
a + b
}
The current output is:
error[[E0369]](https://doc.rust-lang.org/stable/error-index.html#E0369): cannot add `B` to `A`
[--> src/lib.rs:4:7
](https://play.rust-lang.org/#) |
4 | a + b
| - ^ - B
| |
| A
|
help: consider restricting type parameter `A`
|
3 | fn add<A: std::ops::Add<Output = B>, B, C>(a: A, b: B) -> C {
| +++++++++++++++++++++++++++
For more information about this error, try `rustc --explain E0369`.
Ideally the output should look like:
error[[E0369]](https://doc.rust-lang.org/stable/error-index.html#E0369): cannot add `B` to `A`
[--> src/lib.rs:4:7
](https://play.rust-lang.org/#) |
4 | a + b
| - ^ - B
| |
| A
|
help: consider restricting type parameter `A`
|
3 | fn add<A: std::ops::Add<B, Output = C>, B, C>(a: A, b: B) -> C {
| ++++++++++++++++++++++++++++++
For more information about this error, try `rustc --explain E0369`.
@rustbot label D-invalid-suggestion A-suggestion-diagnostics