You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This updates the description of trait parameter patterns, primarily to
shift it to the style where the main text describes the behavior in the
current edition, and changes in the edition are moved to separate
edition blocks.
The specific changes:
- Rework the edition presentation (as per our style guide).
- Try to use more consistent wording.
- Add examples.
- Rename some of the rules to switch to the updated edition style, and
try to be a little clearer about their intent.
- Change the way it refers to "methods". The reference used to define
methods as a separate kind of associated item, but we changed it so
that functions allow an optional _SelfParam_, and methods aren't as
special as they used to be. This text was still written assuming the
previous presentation.
Copy file name to clipboardexpand all lines: src/items/traits.md
+53-25
Original file line number
Diff line number
Diff line change
@@ -287,44 +287,71 @@ The [trait implementation] must also begin with the `unsafe` keyword.
287
287
r[items.traits.params]
288
288
## Parameter patterns
289
289
290
-
r[items.traits.params.allowed-patterns]
291
-
Function or method declarations without a body only allow [IDENTIFIER] or
292
-
`_`[wild card][WildcardPattern] patterns. `mut`[IDENTIFIER] is currently
293
-
allowed, but it is deprecated and will become a hard error in the future.
290
+
r[items.traits.params.patterns-no-body]
291
+
Parameters in associated functions without a body only allow [IDENTIFIER] or `_`[wild card][WildcardPattern] patterns, as well as the form allowed by [_SelfParam_]. `mut`[IDENTIFIER] is currently allowed, but it is deprecated and will become a hard error in the future.
0 commit comments