@@ -164,7 +164,13 @@ The [trait implementation] must also begin with the `unsafe` keyword.
164164
165165## Parameter patterns
166166
167- The pattern for a trait function or method parameter is optional:
167+ Function or method declarations without a body only allow [ IDENTIFIER] or
168+ ` _ ` [ wild card] [ WildcardPattern ] patterns. ` mut ` [ IDENTIFIER] is currently
169+ allowed, but it is deprecated and will become a hard error in the future.
170+ <!-- https://github.com/rust-lang/rust/issues/35203 -->
171+
172+ In the 2015 edition, the pattern for a trait function or method parameter is
173+ optional:
168174
169175``` rust
170176trait T {
@@ -180,18 +186,16 @@ The kinds of patterns for parameters is limited to one of the following:
180186* ` & ` [ IDENTIFIER]
181187* ` && ` [ IDENTIFIER]
182188
183- Function or method declarations without a body only allow [ IDENTIFIER] or
184- [ wild card] [ WildcardPattern ] patterns. ` mut ` [ IDENTIFIER] is currently
185- allowed, but it is deprecated and will become a hard error in the future.
186- <!-- https://github.com/rust-lang/rust/issues/35203 -->
187-
188- <!-- 2018 changes:
189-
190- Function or method parameter patterns are no longer optional, and are required.
191-
192- All irrefutable pattern kinds are allowed (as long as there is a body).
193- -->
189+ Beginning in the 2018 edition, function or method parameter patterns are no
190+ longer optional. Also, all irrefutable patterns are allowed as long as there
191+ is a body. Without a body, the limitations listed above are still in effect.
194192
193+ ``` rust,edition2018
194+ trait T {
195+ fn f1((a, b): (i32, i32)) {}
196+ fn f2(_: (i32, i32)); // Cannot use tuple pattern without a body.
197+ }
198+ ```
195199
196200[ IDENTIFIER ] : identifiers.html
197201[ WildcardPattern ] : patterns.html#wildcard-pattern
0 commit comments