- Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
Current output for &str += &str:
error[E0368]: binary assignment operation `+=` cannot be applied to type `&str` --> $DIR/issue-10401.rs:13:5 | LL | a += { "b" }; | -^^^^^^^^^^^ | | | cannot use `+=` on type `&str` | `+` can't be used to concatenate two `&str` strings help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left | LL | a.to_owned() += { "b" }; | ^^^^^^^^^^^^ It should at the very least not provide the incorrect suggestion, probably have custom help explaining that a should be a String, best would be to suggest new valid code (but it's probably too complex a case to do).
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints