fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
7.5 KiB186 linesraw
1error[E0369]: binary operation `+` cannot be applied to type `&str`
2  --> $DIR/issue-39018.rs:2:22
3   |
4LL |     let x = "Hello " + "World!";
5   |             -------- ^ -------- &str
6   |             |        |
7   |             |        `+` cannot be used to concatenate two `&str` strings
8   |             &str
9   |
10help: `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
11   |
12LL |     let x = "Hello ".to_owned() + "World!";
13   |             ^^^^^^^^^^^^^^^^^^^
14
15error[E0369]: binary operation `+` cannot be applied to type `World`
16  --> $DIR/issue-39018.rs:8:26
17   |
18LL |     let y = World::Hello + World::Goodbye;
19   |             ------------ ^ -------------- World
20   |             |
21   |             World
22   |
23   = note: an implementation of `std::ops::Add` might be missing for `World`
24
25error[E0369]: binary operation `+` cannot be applied to type `&str`
26  --> $DIR/issue-39018.rs:11:22
27   |
28LL |     let x = "Hello " + "World!".to_owned();
29   |             -------- ^ ------------------- std::string::String
30   |             |        |
31   |             |        `+` cannot be used to concatenate a `&str` with a `String`
32   |             &str
33   |
34help: `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
35   |
36LL |     let x = "Hello ".to_owned() + &"World!".to_owned();
37   |             ^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^^^^^^
38
39error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
40  --> $DIR/issue-39018.rs:26:16
41   |
42LL |     let _ = &a + &b;
43   |             -- ^ -- &std::string::String
44   |             |  |
45   |             |  `+` cannot be used to concatenate two `&str` strings
46   |             &std::string::String
47   |
48help: 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
49   |
50LL |     let _ = a + &b;
51   |             ^
52
53error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
54  --> $DIR/issue-39018.rs:27:16
55   |
56LL |     let _ = &a + b;
57   |             -- ^ - std::string::String
58   |             |  |
59   |             |  `+` cannot be used to concatenate a `&str` with a `String`
60   |             &std::string::String
61   |
62help: `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
63   |
64LL |     let _ = a + &b;
65   |             ^   ^^
66
67error[E0308]: mismatched types
68  --> $DIR/issue-39018.rs:29:17
69   |
70LL |     let _ = a + b;
71   |                 ^
72   |                 |
73   |                 expected &str, found struct `std::string::String`
74   |                 help: consider borrowing here: `&b`
75   |
76   = note: expected type `&str`
77              found type `std::string::String`
78
79error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
80  --> $DIR/issue-39018.rs:30:15
81   |
82LL |     let _ = e + b;
83   |             - ^ - std::string::String
84   |             | |
85   |             | `+` cannot be used to concatenate a `&str` with a `String`
86   |             &std::string::String
87   |
88help: `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
89   |
90LL |     let _ = e.to_owned() + &b;
91   |             ^^^^^^^^^^^^   ^^
92
93error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
94  --> $DIR/issue-39018.rs:31:15
95   |
96LL |     let _ = e + &b;
97   |             - ^ -- &std::string::String
98   |             | |
99   |             | `+` cannot be used to concatenate two `&str` strings
100   |             &std::string::String
101   |
102help: `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
103   |
104LL |     let _ = e.to_owned() + &b;
105   |             ^^^^^^^^^^^^
106
107error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
108  --> $DIR/issue-39018.rs:32:15
109   |
110LL |     let _ = e + d;
111   |             - ^ - &str
112   |             | |
113   |             | `+` cannot be used to concatenate two `&str` strings
114   |             &std::string::String
115   |
116help: `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
117   |
118LL |     let _ = e.to_owned() + d;
119   |             ^^^^^^^^^^^^
120
121error[E0369]: binary operation `+` cannot be applied to type `&std::string::String`
122  --> $DIR/issue-39018.rs:33:15
123   |
124LL |     let _ = e + &d;
125   |             - ^ -- &&str
126   |             | |
127   |             | `+` cannot be used to concatenate two `&str` strings
128   |             &std::string::String
129   |
130help: `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
131   |
132LL |     let _ = e.to_owned() + &d;
133   |             ^^^^^^^^^^^^
134
135error[E0369]: binary operation `+` cannot be applied to type `&&str`
136  --> $DIR/issue-39018.rs:34:16
137   |
138LL |     let _ = &c + &d;
139   |             -- ^ -- &&str
140   |             |
141   |             &&str
142   |
143   = note: an implementation of `std::ops::Add` might be missing for `&&str`
144
145error[E0369]: binary operation `+` cannot be applied to type `&&str`
146  --> $DIR/issue-39018.rs:35:16
147   |
148LL |     let _ = &c + d;
149   |             -- ^ - &str
150   |             |
151   |             &&str
152   |
153   = note: an implementation of `std::ops::Add` might be missing for `&&str`
154
155error[E0369]: binary operation `+` cannot be applied to type `&str`
156  --> $DIR/issue-39018.rs:36:15
157   |
158LL |     let _ = c + &d;
159   |             - ^ -- &&str
160   |             | |
161   |             | `+` cannot be used to concatenate two `&str` strings
162   |             &str
163   |
164help: `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
165   |
166LL |     let _ = c.to_owned() + &d;
167   |             ^^^^^^^^^^^^
168
169error[E0369]: binary operation `+` cannot be applied to type `&str`
170  --> $DIR/issue-39018.rs:37:15
171   |
172LL |     let _ = c + d;
173   |             - ^ - &str
174   |             | |
175   |             | `+` cannot be used to concatenate two `&str` strings
176   |             &str
177   |
178help: `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
179   |
180LL |     let _ = c.to_owned() + d;
181   |             ^^^^^^^^^^^^
182
183error: aborting due to 14 previous errors
184
185Some errors have detailed explanations: E0308, E0369.
186For more information about an error, try `rustc --explain E0308`.