You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
Do not suggest using `to_owned()` on `&str += &str`
- Don't provide incorrect suggestion for `&str += &str` (fixrust-lang#52410)
- On `&str + String` suggest `&str.to_owned() + &String` as a single suggestion
Current output for
&str += &str
:It should at the very least not provide the incorrect suggestion, probably have custom
help
explaining thata
should be aString
, best would be to suggest new valid code (but it's probably too complex a case to do).The text was updated successfully, but these errors were encountered: