rust-lang / rust-lang/book

Mention or explain binding modes when describing patterns

Open
#3,333 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
18.3k
Forks
4.1k
Avg merge
14m
Merged PRs (30d)
1

Description

  • I have checked the latest main branch to see if this has already been fixed
  • I have searched existing issues and pull requests for duplicates

URL to the section(s) of the book with this problem:
https://doc.rust-lang.org/nightly/book/ch06-00-enums.html
https://doc.rust-lang.org/nightly/book/ch18-00-patterns.html
https://doc.rust-lang.org/stable/book/ch15-06-reference-cycles.html#creating-a-reference-cycle

Description of the problem:
There's no mention in chapters 6 or 18 of how matching on a reference works when there's no reference operator in the pattern (i.e. binding modes / match ergonomics). In chapter 15, there is an example that implicitly uses this behaviour, but it is not explained or given a name, meaning people who want to learn more can't easily research the topic.

Suggested fix:
Add a page or section in chapter 18, either describing the behaviour, or naming it and pointing to the rust reference page on binding modes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the chapter 18 patterns section and compare it with the chapter 6 enums material and the chapter 15 reference-cycle example linked in the issue. Add a section or page that explains or names binding modes/match ergonomics and links to the Rust Reference; done means readers can identify and research the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.