about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-12-30 11:42:04 +0100
committerGitHub <noreply@github.com>2023-12-30 11:42:04 +0100
commit19580d56c2f9e014e95f9d7879fe207a034aad16 (patch)
tree312f02f822ef2cfbf1603b546ba1f31082ed72f2
parent31aa239b9fd28a2e6de3442c3662cfd8b23caee5 (diff)
parentdd928c8f75712bb25f140a3562463a613181e8c6 (diff)
downloadrust-19580d56c2f9e014e95f9d7879fe207a034aad16.tar.gz
rust-19580d56c2f9e014e95f9d7879fe207a034aad16.zip
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 7a477869b72e ("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.
-rw-r--r--library/core/src/primitive_docs.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs
index 99208fba670..bd2851a26fb 100644
--- a/library/core/src/primitive_docs.rs
+++ b/library/core/src/primitive_docs.rs
@@ -1348,7 +1348,6 @@ mod prim_usize {}
 /// * [`Fn`] \(in addition, `&T` references get [`FnMut`] and [`FnOnce`] if `T: Fn`)
 /// * [`Hash`]
 /// * [`ToSocketAddrs`]
-/// * [`Send`] \(`&T` references also require <code>T: [Sync]</code>)
 /// * [`Sync`]
 ///
 /// [`std::fmt`]: fmt
@@ -1366,6 +1365,7 @@ mod prim_usize {}
 /// * [`ExactSizeIterator`]
 /// * [`FusedIterator`]
 /// * [`TrustedLen`]
+/// * [`Send`]
 /// * [`io::Write`]
 /// * [`Read`]
 /// * [`Seek`]
@@ -1378,6 +1378,8 @@ mod prim_usize {}
 /// [`Read`]: ../std/io/trait.Read.html
 /// [`io::Write`]: ../std/io/trait.Write.html
 ///
+/// In addition, `&T` references implement [`Send`] if and only if `T` implements [`Sync`].
+///
 /// Note that due to method call deref coercion, simply calling a trait method will act like they
 /// work on references as well as they do on owned values! The implementations described here are
 /// meant for generic contexts, where the final type `T` is a type parameter or otherwise not