File tree 1 file changed +47
-1
lines changed
1 file changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,53 @@ Reference:
211
211
http://doc.rust-lang.org/reference.html#trait-objects
212
212
"## ,
213
213
214
+ E0036 : r##"
215
+ This error occurred when you pass too many or not enough type parameters to a
216
+ method. Example:
217
+
218
+ ```
219
+ struct Test;
220
+
221
+ impl Test {
222
+ fn method<T>(&self, v: &[T]) -> usize {
223
+ v.len()
224
+ }
225
+ }
226
+
227
+ fn main() {
228
+ let x = Test;
229
+ let v = &[0i32];
230
+
231
+ x.method::<i32, i32>(v); // error: only one type parameter is expected!
232
+ }
233
+ ```
234
+
235
+ To fix it, just specify a correct number of type parameters:
236
+
237
+ ```
238
+ struct Test;
239
+
240
+ impl Test {
241
+ fn method<T>(&self, v: &[T]) -> usize {
242
+ v.len()
243
+ }
244
+ }
245
+
246
+ fn main() {
247
+ let x = Test;
248
+ let v = &[0i32];
249
+
250
+ x.method::<i32>(v); // OK, we're good!
251
+ }
252
+ ```
253
+
254
+ Please note on the last example that we could have called `method` like this:
255
+
256
+ ```
257
+ x.method(v);
258
+ ```
259
+ "## ,
260
+
214
261
E0040 : r##"
215
262
It is not allowed to manually call destructors in Rust. It is also not
216
263
necessary to do this since `drop` is called automatically whenever a value goes
@@ -1322,7 +1369,6 @@ For more information see the [opt-in builtin traits RFC](https://github.com/rust
1322
1369
register_diagnostics ! {
1323
1370
E0034 , // multiple applicable methods in scope
1324
1371
E0035 , // does not take type parameters
1325
- E0036 , // incorrect number of type parameters given for this method
1326
1372
E0044 , // foreign items may not have type parameters
1327
1373
E0045 , // variadic function must have C calling convention
1328
1374
E0068 ,
You can’t perform that action at this time.
0 commit comments