]>
Commit | Line | Data |
---|---|---|
dfeec247 | 1 | error[E0369]: cannot add `&str` to `&str` |
532ac7d7 | 2 | --> $DIR/issue-39018.rs:2:22 |
8bb4bdeb | 3 | | |
0531ce1d | 4 | LL | let x = "Hello " + "World!"; |
532ac7d7 XL |
5 | | -------- ^ -------- &str |
6 | | | | | |
48663c56 | 7 | | | `+` cannot be used to concatenate two `&str` strings |
532ac7d7 | 8 | | &str |
e74abb32 | 9 | | |
5099ac24 FG |
10 | = note: string concatenation requires an owned `String` on the left |
11 | help: create an owned `String` from a string reference | |
041b39d2 | 12 | | |
0531ce1d | 13 | LL | let x = "Hello ".to_owned() + "World!"; |
5099ac24 | 14 | | +++++++++++ |
8bb4bdeb | 15 | |
dfeec247 | 16 | error[E0369]: cannot add `World` to `World` |
532ac7d7 | 17 | --> $DIR/issue-39018.rs:8:26 |
8bb4bdeb | 18 | | |
0531ce1d | 19 | LL | let y = World::Hello + World::Goodbye; |
532ac7d7 XL |
20 | | ------------ ^ -------------- World |
21 | | | | |
22 | | World | |
8bb4bdeb | 23 | | |
c295e0f8 XL |
24 | note: an implementation of `Add<_>` might be missing for `World` |
25 | --> $DIR/issue-39018.rs:15:1 | |
26 | | | |
27 | LL | enum World { | |
28 | | ^^^^^^^^^^ must implement `Add<_>` | |
29 | note: the following trait must be implemented | |
30 | --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | |
31 | | | |
32 | LL | / pub trait Add<Rhs = Self> { | |
33 | LL | | /// The resulting type after applying the `+` operator. | |
34 | LL | | #[stable(feature = "rust1", since = "1.0.0")] | |
35 | LL | | type Output; | |
36 | ... | | |
37 | LL | | fn add(self, rhs: Rhs) -> Self::Output; | |
38 | LL | | } | |
39 | | |_^ | |
8bb4bdeb | 40 | |
1b1a35ee | 41 | error[E0369]: cannot add `String` to `&str` |
532ac7d7 | 42 | --> $DIR/issue-39018.rs:11:22 |
0531ce1d XL |
43 | | |
44 | LL | let x = "Hello " + "World!".to_owned(); | |
1b1a35ee | 45 | | -------- ^ ------------------- String |
48663c56 XL |
46 | | | | |
47 | | | `+` cannot be used to concatenate a `&str` with a `String` | |
532ac7d7 | 48 | | &str |
e74abb32 | 49 | | |
5099ac24 | 50 | help: create an owned `String` on the left and add a borrow on the right |
0531ce1d | 51 | | |
8faf50e0 | 52 | LL | let x = "Hello ".to_owned() + &"World!".to_owned(); |
5099ac24 | 53 | | +++++++++++ + |
0531ce1d | 54 | |
1b1a35ee | 55 | error[E0369]: cannot add `&String` to `&String` |
48663c56 XL |
56 | --> $DIR/issue-39018.rs:26:16 |
57 | | | |
58 | LL | let _ = &a + &b; | |
1b1a35ee | 59 | | -- ^ -- &String |
48663c56 XL |
60 | | | | |
61 | | | `+` cannot be used to concatenate two `&str` strings | |
1b1a35ee | 62 | | &String |
e74abb32 | 63 | | |
5099ac24 FG |
64 | = note: string concatenation requires an owned `String` on the left |
65 | help: remove the borrow to obtain an owned `String` | |
48663c56 | 66 | | |
5099ac24 FG |
67 | LL - let _ = &a + &b; |
68 | LL + let _ = a + &b; | |
923072b8 | 69 | | |
48663c56 | 70 | |
1b1a35ee | 71 | error[E0369]: cannot add `String` to `&String` |
48663c56 XL |
72 | --> $DIR/issue-39018.rs:27:16 |
73 | | | |
74 | LL | let _ = &a + b; | |
1b1a35ee | 75 | | -- ^ - String |
48663c56 XL |
76 | | | | |
77 | | | `+` cannot be used to concatenate a `&str` with a `String` | |
1b1a35ee | 78 | | &String |
e74abb32 | 79 | | |
5099ac24 | 80 | help: remove the borrow on the left and add one on the right |
48663c56 | 81 | | |
5099ac24 FG |
82 | LL - let _ = &a + b; |
83 | LL + let _ = a + &b; | |
923072b8 | 84 | | |
48663c56 XL |
85 | |
86 | error[E0308]: mismatched types | |
87 | --> $DIR/issue-39018.rs:29:17 | |
88 | | | |
89 | LL | let _ = a + b; | |
90 | | ^ | |
91 | | | | |
1b1a35ee | 92 | | expected `&str`, found struct `String` |
48663c56 | 93 | | help: consider borrowing here: `&b` |
48663c56 | 94 | |
1b1a35ee | 95 | error[E0369]: cannot add `String` to `&String` |
48663c56 XL |
96 | --> $DIR/issue-39018.rs:30:15 |
97 | | | |
98 | LL | let _ = e + b; | |
1b1a35ee | 99 | | - ^ - String |
48663c56 XL |
100 | | | | |
101 | | | `+` cannot be used to concatenate a `&str` with a `String` | |
1b1a35ee | 102 | | &String |
e74abb32 | 103 | | |
5099ac24 | 104 | help: create an owned `String` on the left and add a borrow on the right |
48663c56 XL |
105 | | |
106 | LL | let _ = e.to_owned() + &b; | |
5099ac24 | 107 | | +++++++++++ + |
48663c56 | 108 | |
1b1a35ee | 109 | error[E0369]: cannot add `&String` to `&String` |
48663c56 XL |
110 | --> $DIR/issue-39018.rs:31:15 |
111 | | | |
112 | LL | let _ = e + &b; | |
1b1a35ee | 113 | | - ^ -- &String |
48663c56 XL |
114 | | | | |
115 | | | `+` cannot be used to concatenate two `&str` strings | |
1b1a35ee | 116 | | &String |
e74abb32 | 117 | | |
5099ac24 FG |
118 | = note: string concatenation requires an owned `String` on the left |
119 | help: create an owned `String` from a string reference | |
48663c56 XL |
120 | | |
121 | LL | let _ = e.to_owned() + &b; | |
5099ac24 | 122 | | +++++++++++ |
48663c56 | 123 | |
1b1a35ee | 124 | error[E0369]: cannot add `&str` to `&String` |
48663c56 XL |
125 | --> $DIR/issue-39018.rs:32:15 |
126 | | | |
127 | LL | let _ = e + d; | |
128 | | - ^ - &str | |
129 | | | | | |
130 | | | `+` cannot be used to concatenate two `&str` strings | |
1b1a35ee | 131 | | &String |
e74abb32 | 132 | | |
5099ac24 FG |
133 | = note: string concatenation requires an owned `String` on the left |
134 | help: create an owned `String` from a string reference | |
48663c56 XL |
135 | | |
136 | LL | let _ = e.to_owned() + d; | |
5099ac24 | 137 | | +++++++++++ |
48663c56 | 138 | |
1b1a35ee | 139 | error[E0369]: cannot add `&&str` to `&String` |
48663c56 XL |
140 | --> $DIR/issue-39018.rs:33:15 |
141 | | | |
142 | LL | let _ = e + &d; | |
143 | | - ^ -- &&str | |
144 | | | | | |
145 | | | `+` cannot be used to concatenate two `&str` strings | |
1b1a35ee | 146 | | &String |
e74abb32 | 147 | | |
5099ac24 FG |
148 | = note: string concatenation requires an owned `String` on the left |
149 | help: create an owned `String` from a string reference | |
48663c56 XL |
150 | | |
151 | LL | let _ = e.to_owned() + &d; | |
5099ac24 | 152 | | +++++++++++ |
48663c56 | 153 | |
dfeec247 | 154 | error[E0369]: cannot add `&&str` to `&&str` |
48663c56 XL |
155 | --> $DIR/issue-39018.rs:34:16 |
156 | | | |
157 | LL | let _ = &c + &d; | |
158 | | -- ^ -- &&str | |
159 | | | | |
160 | | &&str | |
48663c56 | 161 | |
dfeec247 | 162 | error[E0369]: cannot add `&str` to `&&str` |
48663c56 XL |
163 | --> $DIR/issue-39018.rs:35:16 |
164 | | | |
165 | LL | let _ = &c + d; | |
166 | | -- ^ - &str | |
167 | | | | |
168 | | &&str | |
48663c56 | 169 | |
dfeec247 | 170 | error[E0369]: cannot add `&&str` to `&str` |
48663c56 XL |
171 | --> $DIR/issue-39018.rs:36:15 |
172 | | | |
173 | LL | let _ = c + &d; | |
174 | | - ^ -- &&str | |
175 | | | | | |
176 | | | `+` cannot be used to concatenate two `&str` strings | |
177 | | &str | |
e74abb32 | 178 | | |
5099ac24 FG |
179 | = note: string concatenation requires an owned `String` on the left |
180 | help: create an owned `String` from a string reference | |
48663c56 XL |
181 | | |
182 | LL | let _ = c.to_owned() + &d; | |
5099ac24 | 183 | | +++++++++++ |
48663c56 | 184 | |
dfeec247 | 185 | error[E0369]: cannot add `&str` to `&str` |
48663c56 XL |
186 | --> $DIR/issue-39018.rs:37:15 |
187 | | | |
188 | LL | let _ = c + d; | |
189 | | - ^ - &str | |
190 | | | | | |
191 | | | `+` cannot be used to concatenate two `&str` strings | |
192 | | &str | |
e74abb32 | 193 | | |
5099ac24 FG |
194 | = note: string concatenation requires an owned `String` on the left |
195 | help: create an owned `String` from a string reference | |
48663c56 XL |
196 | | |
197 | LL | let _ = c.to_owned() + d; | |
5099ac24 | 198 | | +++++++++++ |
48663c56 XL |
199 | |
200 | error: aborting due to 14 previous errors | |
8bb4bdeb | 201 | |
48663c56 XL |
202 | Some errors have detailed explanations: E0308, E0369. |
203 | For more information about an error, try `rustc --explain E0308`. |