fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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