@@ -2,13 +2,16 @@ error[E0369]: cannot add `&str` to `&str`
22 --> $DIR/issue-39018.rs:2:22
33 |
44LL | let x = "Hello " + "World!";
5- | ---------^ -------- &str
6- | | ||
7- | | |`+` cannot be used to concatenate two `&str` strings
8- | | help: create an owned `String` from a string reference: `.to_owned()`
5+ | -------- ^ -------- &str
6+ | | |
7+ | | `+` cannot be used to concatenate two `&str` strings
98 | &str
109 |
1110 = note: string concatenation requires an owned `String` on the left
11+ help: create an owned `String` from a string reference
12+ |
13+ LL | let x = "Hello ".to_owned() + "World!";
14+ | +++++++++++
1215
1316error[E0369]: cannot add `World` to `World`
1417 --> $DIR/issue-39018.rs:8:26
@@ -57,9 +60,13 @@ LL | let _ = &a + &b;
5760 | | |
5861 | | `+` cannot be used to concatenate two `&str` strings
5962 | &String
60- | help: remove the borrow to obtain an owned `String`
6163 |
6264 = note: string concatenation requires an owned `String` on the left
65+ help: remove the borrow to obtain an owned `String`
66+ |
67+ LL - let _ = &a + &b;
68+ LL + let _ = a + &b;
69+ |
6370
6471error[E0369]: cannot add `String` to `&String`
6572 --> $DIR/issue-39018.rs:27:16
@@ -103,37 +110,46 @@ error[E0369]: cannot add `&String` to `&String`
103110 --> $DIR/issue-39018.rs:31:15
104111 |
105112LL | let _ = e + &b;
106- | --^ -- &String
107- | |||
108- | ||`+` cannot be used to concatenate two `&str` strings
109- | |help: create an owned `String` from a string reference: `.to_owned()`
113+ | - ^ -- &String
114+ | | |
115+ | | `+` cannot be used to concatenate two `&str` strings
110116 | &String
111117 |
112118 = note: string concatenation requires an owned `String` on the left
119+ help: create an owned `String` from a string reference
120+ |
121+ LL | let _ = e.to_owned() + &b;
122+ | +++++++++++
113123
114124error[E0369]: cannot add `&str` to `&String`
115125 --> $DIR/issue-39018.rs:32:15
116126 |
117127LL | let _ = e + d;
118- | --^ - &str
119- | |||
120- | ||`+` cannot be used to concatenate two `&str` strings
121- | |help: create an owned `String` from a string reference: `.to_owned()`
128+ | - ^ - &str
129+ | | |
130+ | | `+` cannot be used to concatenate two `&str` strings
122131 | &String
123132 |
124133 = note: string concatenation requires an owned `String` on the left
134+ help: create an owned `String` from a string reference
135+ |
136+ LL | let _ = e.to_owned() + d;
137+ | +++++++++++
125138
126139error[E0369]: cannot add `&&str` to `&String`
127140 --> $DIR/issue-39018.rs:33:15
128141 |
129142LL | let _ = e + &d;
130- | --^ -- &&str
131- | |||
132- | ||`+` cannot be used to concatenate two `&str` strings
133- | |help: create an owned `String` from a string reference: `.to_owned()`
143+ | - ^ -- &&str
144+ | | |
145+ | | `+` cannot be used to concatenate two `&str` strings
134146 | &String
135147 |
136148 = note: string concatenation requires an owned `String` on the left
149+ help: create an owned `String` from a string reference
150+ |
151+ LL | let _ = e.to_owned() + &d;
152+ | +++++++++++
137153
138154error[E0369]: cannot add `&&str` to `&&str`
139155 --> $DIR/issue-39018.rs:34:16
@@ -155,25 +171,31 @@ error[E0369]: cannot add `&&str` to `&str`
155171 --> $DIR/issue-39018.rs:36:15
156172 |
157173LL | let _ = c + &d;
158- | --^ -- &&str
159- | |||
160- | ||`+` cannot be used to concatenate two `&str` strings
161- | |help: create an owned `String` from a string reference: `.to_owned()`
174+ | - ^ -- &&str
175+ | | |
176+ | | `+` cannot be used to concatenate two `&str` strings
162177 | &str
163178 |
164179 = note: string concatenation requires an owned `String` on the left
180+ help: create an owned `String` from a string reference
181+ |
182+ LL | let _ = c.to_owned() + &d;
183+ | +++++++++++
165184
166185error[E0369]: cannot add `&str` to `&str`
167186 --> $DIR/issue-39018.rs:37:15
168187 |
169188LL | let _ = c + d;
170- | --^ - &str
171- | |||
172- | ||`+` cannot be used to concatenate two `&str` strings
173- | |help: create an owned `String` from a string reference: `.to_owned()`
189+ | - ^ - &str
190+ | | |
191+ | | `+` cannot be used to concatenate two `&str` strings
174192 | &str
175193 |
176194 = note: string concatenation requires an owned `String` on the left
195+ help: create an owned `String` from a string reference
196+ |
197+ LL | let _ = c.to_owned() + d;
198+ | +++++++++++
177199
178200error: aborting due to 14 previous errors
179201
0 commit comments