rust-lang / rust-lang/reference

Closure trait descriptions could be clearer.

Open
#1,218 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

https://doc.rust-lang.org/reference/types/closure.html#other-traits

A closure is Send if all variables captured by non-unique immutable reference are Sync, and all values captured by unique immutable or mutable reference, copy, or move are Send.

This phrase suggests that there are three types of references:

  • non-unique immutable
  • unique immutable
  • unique mutable

But typically only & and &mut are considered. What does "unique immutable reference" mean? Shall the phrase be made clearer and some code example of Send vs !Send closure peculiarities be demonstrated?


IRC provided the help:

<demize> _Vi: https://doc.rust-lang.org/reference/types/closure.html#unique-immutable-borrows-in-captures

Maybe at least the phrase "unique immutable" in "Other traits" should link there?

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 at the Reference's closure "Other traits" section and follow the linked "Unique immutable borrows in captures" section. Clarify what "unique immutable reference" means, consider linking that term directly, and determine whether Send versus !Send closure examples are needed; done means the trait description is unambiguous.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.