]>
Commit | Line | Data |
---|---|---|
60c5eb7d XL |
1 | Trait methods currently cannot take patterns as arguments. |
2 | ||
f035d41b | 3 | Erroneous code example: |
60c5eb7d XL |
4 | |
5 | ```compile_fail,E0642 | |
6 | trait Foo { | |
7 | fn foo((x, y): (i32, i32)); // error: patterns aren't allowed | |
8 | // in trait methods | |
9 | } | |
10 | ``` | |
11 | ||
12 | You can instead use a single name for the argument: | |
13 | ||
14 | ``` | |
15 | trait Foo { | |
16 | fn foo(x_and_y: (i32, i32)); // ok! | |
17 | } | |
18 | ``` |