File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 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"),
2828E0030 : include_str!( "./error_codes/E0030.md" ) ,
2929E0033 : include_str!( "./error_codes/E0033.md" ) ,
3030E0034 : include_str!( "./error_codes/E0034.md" ) ,
31+ E0036 : include_str!( "./error_codes/E0036.md" ) ,
3132E0038 : include_str!( "./error_codes/E0038.md" ) ,
3233E0040 : include_str!( "./error_codes/E0040.md" ) ,
3334E0044 : include_str!( "./error_codes/E0044.md" ) ,
@@ -414,7 +415,6 @@ E0745: include_str!("./error_codes/E0745.md"),
414415// E0006, // merged with E0005
415416// E0008, // cannot bind by-move into a pattern guard
416417// E0035, merged into E0087/E0089
417- // E0036, merged into E0087/E0089
418418// E0068,
419419// E0085,
420420// 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