]> git.proxmox.com Git - rustc.git/blame - src/test/ui/span/issue-39018.stderr
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / span / issue-39018.stderr
CommitLineData
dfeec247 1error[E0369]: cannot add `&str` to `&str`
532ac7d7 2 --> $DIR/issue-39018.rs:2:22
8bb4bdeb 3 |
0531ce1d 4LL | 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
11help: create an owned `String` from a string reference
041b39d2 12 |
0531ce1d 13LL | let x = "Hello ".to_owned() + "World!";
5099ac24 14 | +++++++++++
8bb4bdeb 15
dfeec247 16error[E0369]: cannot add `World` to `World`
532ac7d7 17 --> $DIR/issue-39018.rs:8:26
8bb4bdeb 18 |
0531ce1d 19LL | let y = World::Hello + World::Goodbye;
532ac7d7
XL
20 | ------------ ^ -------------- World
21 | |
22 | World
8bb4bdeb 23 |
c295e0f8
XL
24note: an implementation of `Add<_>` might be missing for `World`
25 --> $DIR/issue-39018.rs:15:1
26 |
27LL | enum World {
28 | ^^^^^^^^^^ must implement `Add<_>`
29note: the following trait must be implemented
30 --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
31 |
32LL | / pub trait Add<Rhs = Self> {
33LL | | /// The resulting type after applying the `+` operator.
34LL | | #[stable(feature = "rust1", since = "1.0.0")]
35LL | | type Output;
36... |
37LL | | fn add(self, rhs: Rhs) -> Self::Output;
38LL | | }
39 | |_^
8bb4bdeb 40
1b1a35ee 41error[E0369]: cannot add `String` to `&str`
532ac7d7 42 --> $DIR/issue-39018.rs:11:22
0531ce1d
XL
43 |
44LL | 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 50help: create an owned `String` on the left and add a borrow on the right
0531ce1d 51 |
8faf50e0 52LL | let x = "Hello ".to_owned() + &"World!".to_owned();
5099ac24 53 | +++++++++++ +
0531ce1d 54
1b1a35ee 55error[E0369]: cannot add `&String` to `&String`
48663c56
XL
56 --> $DIR/issue-39018.rs:26:16
57 |
58LL | 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
65help: remove the borrow to obtain an owned `String`
48663c56 66 |
5099ac24
FG
67LL - let _ = &a + &b;
68LL + let _ = a + &b;
923072b8 69 |
48663c56 70
1b1a35ee 71error[E0369]: cannot add `String` to `&String`
48663c56
XL
72 --> $DIR/issue-39018.rs:27:16
73 |
74LL | 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 80help: remove the borrow on the left and add one on the right
48663c56 81 |
5099ac24
FG
82LL - let _ = &a + b;
83LL + let _ = a + &b;
923072b8 84 |
48663c56
XL
85
86error[E0308]: mismatched types
87 --> $DIR/issue-39018.rs:29:17
88 |
89LL | let _ = a + b;
90 | ^
91 | |
1b1a35ee 92 | expected `&str`, found struct `String`
48663c56 93 | help: consider borrowing here: `&b`
48663c56 94
1b1a35ee 95error[E0369]: cannot add `String` to `&String`
48663c56
XL
96 --> $DIR/issue-39018.rs:30:15
97 |
98LL | 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 104help: create an owned `String` on the left and add a borrow on the right
48663c56
XL
105 |
106LL | let _ = e.to_owned() + &b;
5099ac24 107 | +++++++++++ +
48663c56 108
1b1a35ee 109error[E0369]: cannot add `&String` to `&String`
48663c56
XL
110 --> $DIR/issue-39018.rs:31:15
111 |
112LL | 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
119help: create an owned `String` from a string reference
48663c56
XL
120 |
121LL | let _ = e.to_owned() + &b;
5099ac24 122 | +++++++++++
48663c56 123
1b1a35ee 124error[E0369]: cannot add `&str` to `&String`
48663c56
XL
125 --> $DIR/issue-39018.rs:32:15
126 |
127LL | 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
134help: create an owned `String` from a string reference
48663c56
XL
135 |
136LL | let _ = e.to_owned() + d;
5099ac24 137 | +++++++++++
48663c56 138
1b1a35ee 139error[E0369]: cannot add `&&str` to `&String`
48663c56
XL
140 --> $DIR/issue-39018.rs:33:15
141 |
142LL | 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
149help: create an owned `String` from a string reference
48663c56
XL
150 |
151LL | let _ = e.to_owned() + &d;
5099ac24 152 | +++++++++++
48663c56 153
dfeec247 154error[E0369]: cannot add `&&str` to `&&str`
48663c56
XL
155 --> $DIR/issue-39018.rs:34:16
156 |
157LL | let _ = &c + &d;
158 | -- ^ -- &&str
159 | |
160 | &&str
48663c56 161
dfeec247 162error[E0369]: cannot add `&str` to `&&str`
48663c56
XL
163 --> $DIR/issue-39018.rs:35:16
164 |
165LL | let _ = &c + d;
166 | -- ^ - &str
167 | |
168 | &&str
48663c56 169
dfeec247 170error[E0369]: cannot add `&&str` to `&str`
48663c56
XL
171 --> $DIR/issue-39018.rs:36:15
172 |
173LL | 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
180help: create an owned `String` from a string reference
48663c56
XL
181 |
182LL | let _ = c.to_owned() + &d;
5099ac24 183 | +++++++++++
48663c56 184
dfeec247 185error[E0369]: cannot add `&str` to `&str`
48663c56
XL
186 --> $DIR/issue-39018.rs:37:15
187 |
188LL | 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
195help: create an owned `String` from a string reference
48663c56
XL
196 |
197LL | let _ = c.to_owned() + d;
5099ac24 198 | +++++++++++
48663c56
XL
199
200error: aborting due to 14 previous errors
8bb4bdeb 201
48663c56
XL
202Some errors have detailed explanations: E0308, E0369.
203For more information about an error, try `rustc --explain E0308`.