Skip to content

Commit 19580d5

Browse files
authored
Rollup merge of #119424 - ojeda:send-sync, r=est31
Primitive docs: fix confusing `Send` in `&T`'s list The two lists in this document describe what traits are implemented on references when their underlying `T` also implements them. However, while it is true that `T: Send + Sync` implies `&T: Send` (which is what the sentence is trying to explain), it is confusing to have `Send` in the list because `T: Send` is not needed for that. In particular, the "also require" part may be interpreted as "both `T: Send` and `T: Sync` are required". Instead, move `Send` back to where it was before commit 7a47786 ("Makes docs for references a little less confusing"), i.e. to the `&mut` list (where no extra nota is needed, i.e. it fits naturally) and move the `Sync` definition/note to the bottom as something independent.
2 parents 31aa239 + dd928c8 commit 19580d5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/core/src/primitive_docs.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,6 @@ mod prim_usize {}
13481348
/// * [`Fn`] \(in addition, `&T` references get [`FnMut`] and [`FnOnce`] if `T: Fn`)
13491349
/// * [`Hash`]
13501350
/// * [`ToSocketAddrs`]
1351-
/// * [`Send`] \(`&T` references also require <code>T: [Sync]</code>)
13521351
/// * [`Sync`]
13531352
///
13541353
/// [`std::fmt`]: fmt
@@ -1366,6 +1365,7 @@ mod prim_usize {}
13661365
/// * [`ExactSizeIterator`]
13671366
/// * [`FusedIterator`]
13681367
/// * [`TrustedLen`]
1368+
/// * [`Send`]
13691369
/// * [`io::Write`]
13701370
/// * [`Read`]
13711371
/// * [`Seek`]
@@ -1378,6 +1378,8 @@ mod prim_usize {}
13781378
/// [`Read`]: ../std/io/trait.Read.html
13791379
/// [`io::Write`]: ../std/io/trait.Write.html
13801380
///
1381+
/// In addition, `&T` references implement [`Send`] if and only if `T` implements [`Sync`].
1382+
///
13811383
/// Note that due to method call deref coercion, simply calling a trait method will act like they
13821384
/// work on references as well as they do on owned values! The implementations described here are
13831385
/// meant for generic contexts, where the final type `T` is a type parameter or otherwise not

0 commit comments

Comments
 (0)