@@ -2,18 +2,13 @@ error[E0369]: cannot add `&str` to `&str`
2
2
--> $DIR/issue-39018.rs:2:22
3
3
|
4
4
LL | let x = "Hello " + "World!";
5
- | -------- ^ -------- &str
6
- | | |
7
- | | `+` cannot be used to concatenate two `&str` strings
5
+ | ---------^ -------- &str
6
+ | | ||
7
+ | | |`+` cannot be used to concatenate two `&str` strings
8
+ | | help: create an owned `String` from a string reference: `.to_owned()`
8
9
| &str
9
10
|
10
- = note: String concatenation appends the string on the right to the
11
- string on the left and may require reallocation.
12
- This requires ownership of the string on the left.
13
- help: use `to_owned()` to create an owned `String` from a string reference
14
- |
15
- LL | let x = "Hello ".to_owned() + "World!";
16
- | +++++++++++
11
+ = note: string concatenation requires an owned `String` on the left
17
12
18
13
error[E0369]: cannot add `World` to `World`
19
14
--> $DIR/issue-39018.rs:8:26
@@ -49,7 +44,7 @@ LL | let x = "Hello " + "World!".to_owned();
49
44
| | `+` cannot be used to concatenate a `&str` with a `String`
50
45
| &str
51
46
|
52
- help: call `.to_owned() ` on the left and add a borrow on the right
47
+ help: create an owned `String ` on the left and add a borrow on the right
53
48
|
54
49
LL | let x = "Hello ".to_owned() + &"World!".to_owned();
55
50
| +++++++++++ +
@@ -64,9 +59,7 @@ LL | let _ = &a + &b;
64
59
| &String
65
60
| help: remove the borrow to obtain an owned `String`
66
61
|
67
- = note: String concatenation appends the string on the right to the
68
- string on the left and may require reallocation.
69
- This requires ownership of the string on the left.
62
+ = note: string concatenation requires an owned `String` on the left
70
63
71
64
error[E0369]: cannot add `String` to `&String`
72
65
--> $DIR/issue-39018.rs:27:16
@@ -101,7 +94,7 @@ LL | let _ = e + b;
101
94
| | `+` cannot be used to concatenate a `&str` with a `String`
102
95
| &String
103
96
|
104
- help: call `.to_owned() ` on the left and add a borrow on the right
97
+ help: create an owned `String ` on the left and add a borrow on the right
105
98
|
106
99
LL | let _ = e.to_owned() + &b;
107
100
| +++++++++++ +
@@ -110,52 +103,37 @@ error[E0369]: cannot add `&String` to `&String`
110
103
--> $DIR/issue-39018.rs:31:15
111
104
|
112
105
LL | let _ = e + &b;
113
- | - ^ -- &String
114
- | | |
115
- | | `+` cannot be used to concatenate two `&str` strings
106
+ | --^ -- &String
107
+ | |||
108
+ | ||`+` cannot be used to concatenate two `&str` strings
109
+ | |help: create an owned `String` from a string reference: `.to_owned()`
116
110
| &String
117
111
|
118
- = note: String concatenation appends the string on the right to the
119
- string on the left and may require reallocation.
120
- This requires ownership of the string on the left.
121
- help: use `to_owned()` to create an owned `String` from a string reference
122
- |
123
- LL | let _ = e.to_owned() + &b;
124
- | +++++++++++
112
+ = note: string concatenation requires an owned `String` on the left
125
113
126
114
error[E0369]: cannot add `&str` to `&String`
127
115
--> $DIR/issue-39018.rs:32:15
128
116
|
129
117
LL | let _ = e + d;
130
- | - ^ - &str
131
- | | |
132
- | | `+` cannot be used to concatenate two `&str` strings
118
+ | --^ - &str
119
+ | |||
120
+ | ||`+` cannot be used to concatenate two `&str` strings
121
+ | |help: create an owned `String` from a string reference: `.to_owned()`
133
122
| &String
134
123
|
135
- = note: String concatenation appends the string on the right to the
136
- string on the left and may require reallocation.
137
- This requires ownership of the string on the left.
138
- help: use `to_owned()` to create an owned `String` from a string reference
139
- |
140
- LL | let _ = e.to_owned() + d;
141
- | +++++++++++
124
+ = note: string concatenation requires an owned `String` on the left
142
125
143
126
error[E0369]: cannot add `&&str` to `&String`
144
127
--> $DIR/issue-39018.rs:33:15
145
128
|
146
129
LL | let _ = e + &d;
147
- | - ^ -- &&str
148
- | | |
149
- | | `+` cannot be used to concatenate two `&str` strings
130
+ | --^ -- &&str
131
+ | |||
132
+ | ||`+` cannot be used to concatenate two `&str` strings
133
+ | |help: create an owned `String` from a string reference: `.to_owned()`
150
134
| &String
151
135
|
152
- = note: String concatenation appends the string on the right to the
153
- string on the left and may require reallocation.
154
- This requires ownership of the string on the left.
155
- help: use `to_owned()` to create an owned `String` from a string reference
156
- |
157
- LL | let _ = e.to_owned() + &d;
158
- | +++++++++++
136
+ = note: string concatenation requires an owned `String` on the left
159
137
160
138
error[E0369]: cannot add `&&str` to `&&str`
161
139
--> $DIR/issue-39018.rs:34:16
@@ -177,35 +155,25 @@ error[E0369]: cannot add `&&str` to `&str`
177
155
--> $DIR/issue-39018.rs:36:15
178
156
|
179
157
LL | let _ = c + &d;
180
- | - ^ -- &&str
181
- | | |
182
- | | `+` cannot be used to concatenate two `&str` strings
158
+ | --^ -- &&str
159
+ | |||
160
+ | ||`+` cannot be used to concatenate two `&str` strings
161
+ | |help: create an owned `String` from a string reference: `.to_owned()`
183
162
| &str
184
163
|
185
- = note: String concatenation appends the string on the right to the
186
- string on the left and may require reallocation.
187
- This requires ownership of the string on the left.
188
- help: use `to_owned()` to create an owned `String` from a string reference
189
- |
190
- LL | let _ = c.to_owned() + &d;
191
- | +++++++++++
164
+ = note: string concatenation requires an owned `String` on the left
192
165
193
166
error[E0369]: cannot add `&str` to `&str`
194
167
--> $DIR/issue-39018.rs:37:15
195
168
|
196
169
LL | let _ = c + d;
197
- | - ^ - &str
198
- | | |
199
- | | `+` cannot be used to concatenate two `&str` strings
170
+ | --^ - &str
171
+ | |||
172
+ | ||`+` cannot be used to concatenate two `&str` strings
173
+ | |help: create an owned `String` from a string reference: `.to_owned()`
200
174
| &str
201
175
|
202
- = note: String concatenation appends the string on the right to the
203
- string on the left and may require reallocation.
204
- This requires ownership of the string on the left.
205
- help: use `to_owned()` to create an owned `String` from a string reference
206
- |
207
- LL | let _ = c.to_owned() + d;
208
- | +++++++++++
176
+ = note: string concatenation requires an owned `String` on the left
209
177
210
178
error: aborting due to 14 previous errors
211
179
0 commit comments