Skip to content

Align pattern destructuring with rest of patterns documentation #1853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

archer-321
Copy link
Contributor

See #1845.

Fix the inconsistent use of "wildcard" and "placeholder" in patterns.destructure.placeholder.

Instead of using "placeholder", _ is now referred to as a wildcard pattern, and .. is now referred to as an et cetera or rest pattern instead of "wildcard".

Moreover, add links to the respective sections/statements to all updated references.

I didn't update the r[patterns.destructure.placeholder] part, as I imagine doing so would break (external) links to that part of the reference. I can update the commit if this reference should be updated as well.

Closes: #1845

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jun 12, 2025
@ehuss
Copy link
Contributor

ehuss commented Jun 12, 2025

I didn't update the r[patterns.destructure.placeholder] part, as I imagine doing so would break (external) links to that part of the reference. I can update the commit if this reference should be updated as well.

You're welcome to change the name. We explicitly document that the rule names are not yet stable.

Previously, `patterns.destructure.placeholder` referred to the `_` in a
destructuring pattern as "placeholder" and `..` as "wildcard". This
directly contradicted the definition of struct patterns and tuple
(struct) patterns, which (indirectly) define `_` as a wildcard pattern
and `..` as a structure pattern et cetera (for structs, enums, and union
values) or rest pattern (for tuples, tuple structs, slices, and arrays).

Update the paragraph to use "wildcard pattern", "et cetera", and "rest
pattern" instead.  Moreover, add links to their respective
sections/statements. Finally, update the rule name to
`r[patterns.destructure.wildcard]`.
@archer-321 archer-321 force-pushed the fix/1845-wildcard-in-pattern-destructuring branch from 188d553 to 7d891f2 Compare June 12, 2025 13:45
@archer-321
Copy link
Contributor Author

You're welcome to change the name. We explicitly document that the rule names are not yet stable.

I've renamed the rule identifier to [patterns.destructure.wildcard]. Please let me know if you had another name in mind!

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ehuss ehuss added this pull request to the merge queue Jun 13, 2025
Merged via the queue into rust-lang:master with commit d4c66b3 Jun 13, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: The marked PR is awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing use of "wildcard" in destructuring pattern documentation
3 participants