fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

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