]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0642.md
Rollup merge of #68288 - RalfJung:fmt, r=oli-obk
[rust.git] / src / librustc_error_codes / error_codes / E0642.md
1 Trait methods currently cannot take patterns as arguments.
2
3 Example of erroneous code:
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 ```