rust-lang / rust-lang/reference

Please disambiguate phrase "these traits" in 8.2.13

Open
#983 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
607
PR merge metrics
PR metrics pending

Description

I am reading the Rust reference to help me learn Rust.

I am looking at 8.2.13 "closure expressions" and I do not understand this sentence (bolded):

The compiler will determine which of the closure traits the closure's type will implement by how it acts on its captured variables. The closure will also implement Send and/or Sync if all of its captured types do. These traits allow functions to accept closures using generics, even though the exact types can't be named.

The first appearance of "closure traits" is a link to 10.1.12. I am confused whether the phase "these traits" refers to:

  • The closure traits defined in 10.1.12
  • The traits Send and Sync, defined in the previous sentence.
  • The informal English construction meaning "these characteristics…"

"Expected behavior": You should replace "These traits" with some more specific wording. My proposed alternate text for the paragraph would be (based on my current best guess at the meaning):

The compiler will determine which of the closure traits the closure's type will implement by how it acts on its captured variables. The closure will also implement the closure traits Send and/or Sync if all of its captured types do. Closure traits allow functions to accept closures using generics, even though the exact types can't be named.

I can create a PR for this change if someone can confirm that this is actually an accurate capture of the original paragraph's intent.

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

Open the Rust Reference section 8.2.13, “closure expressions,” and compare the paragraph with the linked closure traits section 10.1.12 and the Send and Sync definitions. Confirm which traits the sentence intends to name, then replace “These traits” with wording that is specific and accurate while preserving the paragraph’s meaning.

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
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.