Skip to content

Closure trait descriptions could be clearer. #1218

Open
@vi

Description

@vi

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions