reference icon indicating copy to clipboard operation
reference copied to clipboard

Closure trait descriptions could be clearer.

Open vi opened this issue 3 years ago • 0 comments

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?

vi avatar May 14 '22 22:05 vi