-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.