]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0642.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0642.md
1 Trait methods currently cannot take patterns as arguments.
2
3 Erroneous code example:
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 ```