]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/issue-39018.stderr
a5b91f090d2c01a62d08fccad35f1a5c89a08935
[rust.git] / src / test / ui / span / issue-39018.stderr
1 error[E0369]: binary operation `+` cannot be applied to type `&str`
2   --> $DIR/issue-39018.rs:2:22
3    |
4 LL |     let x = "Hello " + "World!";
5    |             -------- ^ -------- &str
6    |             |        |
7    |             |        `+` can't be used to concatenate two `&str` strings
8    |             &str
9 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
10    |
11 LL |     let x = "Hello ".to_owned() + "World!";
12    |             ^^^^^^^^^^^^^^^^^^^
13
14 error[E0369]: binary operation `+` cannot be applied to type `World`
15   --> $DIR/issue-39018.rs:8:26
16    |
17 LL |     let y = World::Hello + World::Goodbye;
18    |             ------------ ^ -------------- World
19    |             |
20    |             World
21    |
22    = note: an implementation of `std::ops::Add` might be missing for `World`
23
24 error[E0369]: binary operation `+` cannot be applied to type `&str`
25   --> $DIR/issue-39018.rs:11:22
26    |
27 LL |     let x = "Hello " + "World!".to_owned();
28    |             ---------^--------------------
29    |             |          |
30    |             |          std::string::String
31    |             &str
32    |             `+` can't be used to concatenate a `&str` with a `String`
33 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
34    |
35 LL |     let x = "Hello ".to_owned() + &"World!".to_owned();
36    |             ^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^^^^^^
37
38 error: aborting due to 3 previous errors
39
40 For more information about this error, try `rustc --explain E0369`.