2017-10-21 11:41:27 -05:00
error[E0369]: binary operation `+` cannot be applied to type `&str`
2019-03-27 12:13:09 -05:00
--> $DIR/issue-39018.rs:2:22
2017-01-14 14:25:33 -06:00
|
2018-02-22 18:42:32 -06:00
LL | let x = "Hello " + "World!";
2019-03-28 12:54:29 -05:00
| -------- ^ -------- &str
| | |
| | `+` can't be used to concatenate two `&str` strings
2019-03-27 12:13:09 -05:00
| &str
2017-05-16 08:12:24 -05:00
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
2017-06-28 01:16:04 -05:00
|
2018-02-24 17:01:39 -06:00
LL | let x = "Hello ".to_owned() + "World!";
2017-06-28 01:16:04 -05:00
| ^^^^^^^^^^^^^^^^^^^
2017-01-14 14:25:33 -06:00
error[E0369]: binary operation `+` cannot be applied to type `World`
2019-03-27 12:13:09 -05:00
--> $DIR/issue-39018.rs:8:26
2017-01-14 14:25:33 -06:00
|
2018-02-22 18:42:32 -06:00
LL | let y = World::Hello + World::Goodbye;
2019-03-27 12:13:09 -05:00
| ------------ ^ -------------- World
| |
| World
2017-01-14 14:25:33 -06:00
|
2017-02-09 14:37:59 -06:00
= note: an implementation of `std::ops::Add` might be missing for `World`
2017-01-14 14:25:33 -06:00
2018-02-21 00:46:51 -06:00
error[E0369]: binary operation `+` cannot be applied to type `&str`
2019-03-27 12:13:09 -05:00
--> $DIR/issue-39018.rs:11:22
2018-02-21 00:46:51 -06:00
|
2018-02-24 17:59:34 -06:00
LL | let x = "Hello " + "World!".to_owned();
2019-03-27 12:13:09 -05:00
| ---------^--------------------
| | |
| | std::string::String
| &str
| `+` can't be used to concatenate a `&str` with a `String`
2018-02-21 00:46:51 -06:00
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
|
2018-07-22 00:33:32 -05:00
LL | let x = "Hello ".to_owned() + &"World!".to_owned();
| ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
2018-02-21 00:46:51 -06:00
error: aborting due to 3 previous errors
2017-01-14 14:25:33 -06:00
2018-03-03 08:59:40 -06:00
For more information about this error, try `rustc --explain E0369`.