File tree 2 files changed +41
-1
lines changed
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ E0029: include_str!("./error_codes/E0029.md"),
28
28
E0030 : include_str!( "./error_codes/E0030.md" ) ,
29
29
E0033 : include_str!( "./error_codes/E0033.md" ) ,
30
30
E0034 : include_str!( "./error_codes/E0034.md" ) ,
31
+ E0036 : include_str!( "./error_codes/E0036.md" ) ,
31
32
E0038 : include_str!( "./error_codes/E0038.md" ) ,
32
33
E0040 : include_str!( "./error_codes/E0040.md" ) ,
33
34
E0044 : include_str!( "./error_codes/E0044.md" ) ,
@@ -414,7 +415,6 @@ E0745: include_str!("./error_codes/E0745.md"),
414
415
// E0006, // merged with E0005
415
416
// E0008, // cannot bind by-move into a pattern guard
416
417
// E0035, merged into E0087/E0089
417
- // E0036, merged into E0087/E0089
418
418
// E0068,
419
419
// E0085,
420
420
// E0086,
Original file line number Diff line number Diff line change
1
+ #### Note: this error code is no longer emitted by the compiler.
2
+
3
+ This error occurrs when you pass too many or not enough type parameters to
4
+ a method. Erroneous code example:
5
+
6
+ ``` compile_fail,E0107
7
+ struct Test;
8
+ impl Test {
9
+ fn method<T>(&self, v: &[T]) -> usize {
10
+ v.len()
11
+ }
12
+ }
13
+ fn main() {
14
+ let x = Test;
15
+ let v = &[0];
16
+ x.method::<i32, i32>(v); // error: only one type parameter is expected!
17
+ }
18
+ ```
19
+
20
+ To fix it, just specify a correct number of type parameters:
21
+
22
+ ```
23
+ struct Test;
24
+ impl Test {
25
+ fn method<T>(&self, v: &[T]) -> usize {
26
+ v.len()
27
+ }
28
+ }
29
+ fn main() {
30
+ let x = Test;
31
+ let v = &[0];
32
+ x.method::<i32>(v); // OK, we're good!
33
+ }
34
+ ```
35
+
36
+ Please note on the last example that we could have called ` method ` like this:
37
+
38
+ ``` text
39
+ x.method(v);
40
+ ```
You can’t perform that action at this time.
0 commit comments