From 7a477869b72e2e053182d677b3b8f785796ee95d Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Thu, 26 Aug 2021 15:59:40 +0300 Subject: [PATCH 1/4] Makes docs for references a little less confusing - Make clear that the `Pointer` trait is related to formatting - Make clear that `&T` (shared reference) implements `Send` (if `T: Send + Sync`) --- library/std/src/primitive_docs.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs index 0de9126dab2f..ca7b2da9566e 100644 --- a/library/std/src/primitive_docs.rs +++ b/library/std/src/primitive_docs.rs @@ -1104,11 +1104,11 @@ mod prim_usize {} /// * [`Clone`] \(Note that this will not defer to `T`'s `Clone` implementation if it exists!) /// * [`Deref`] /// * [`Borrow`] -/// * [`Pointer`] +/// * [`fmt::Pointer`] /// /// [`Deref`]: ops::Deref /// [`Borrow`]: borrow::Borrow -/// [`Pointer`]: fmt::Pointer +/// [`fmt::Pointer`]: fmt::Pointer /// /// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating /// multiple simultaneous mutable borrows), plus the following, regardless of the type of its @@ -1124,7 +1124,7 @@ mod prim_usize {} /// The following traits are implemented on `&T` references if the underlying `T` also implements /// that trait: /// -/// * All the traits in [`std::fmt`] except [`Pointer`] and [`fmt::Write`] +/// * All the traits in [`std::fmt`] except [`fmt::Pointer`] (which is implemented regardless of the type of its referent) and [`fmt::Write`] /// * [`PartialOrd`] /// * [`Ord`] /// * [`PartialEq`] @@ -1133,9 +1133,10 @@ mod prim_usize {} /// * [`Fn`] \(in addition, `&T` references get [`FnMut`] and [`FnOnce`] if `T: Fn`) /// * [`Hash`] /// * [`ToSocketAddrs`] +/// * [`Send`] \(`&T` references also require T: [Sync]) /// /// [`std::fmt`]: fmt -/// ['Pointer`]: fmt::Pointer +/// ['fmt::Pointer`]: fmt::Pointer /// [`Hash`]: hash::Hash #[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))] /// @@ -1150,7 +1151,6 @@ mod prim_usize {} /// * [`ExactSizeIterator`] /// * [`FusedIterator`] /// * [`TrustedLen`] -/// * [`Send`] \(note that `&T` references only get `Send` if T: [Sync]) /// * [`io::Write`] /// * [`Read`] /// * [`Seek`] From 9a4530bdd00f5df42e750e2596fb2cc992fa3627 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Fri, 27 Aug 2021 00:16:25 +0300 Subject: [PATCH 2/4] Update library/std/src/primitive_docs.rs Co-authored-by: fmease --- library/std/src/primitive_docs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs index ca7b2da9566e..d919f8ee31e3 100644 --- a/library/std/src/primitive_docs.rs +++ b/library/std/src/primitive_docs.rs @@ -1136,7 +1136,7 @@ mod prim_usize {} /// * [`Send`] \(`&T` references also require T: [Sync]) /// /// [`std::fmt`]: fmt -/// ['fmt::Pointer`]: fmt::Pointer +/// [`fmt::Pointer`]: fmt::Pointer /// [`Hash`]: hash::Hash #[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))] /// From 26aec6c9363345d14ca38d7630dc9478239fbd77 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 10 Oct 2021 14:11:58 +0300 Subject: [PATCH 3/4] Update core primitives_docs.rs up to date with std --- library/core/src/primitive_docs.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index 0de9126dab2f..d919f8ee31e3 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -1104,11 +1104,11 @@ mod prim_usize {} /// * [`Clone`] \(Note that this will not defer to `T`'s `Clone` implementation if it exists!) /// * [`Deref`] /// * [`Borrow`] -/// * [`Pointer`] +/// * [`fmt::Pointer`] /// /// [`Deref`]: ops::Deref /// [`Borrow`]: borrow::Borrow -/// [`Pointer`]: fmt::Pointer +/// [`fmt::Pointer`]: fmt::Pointer /// /// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating /// multiple simultaneous mutable borrows), plus the following, regardless of the type of its @@ -1124,7 +1124,7 @@ mod prim_usize {} /// The following traits are implemented on `&T` references if the underlying `T` also implements /// that trait: /// -/// * All the traits in [`std::fmt`] except [`Pointer`] and [`fmt::Write`] +/// * All the traits in [`std::fmt`] except [`fmt::Pointer`] (which is implemented regardless of the type of its referent) and [`fmt::Write`] /// * [`PartialOrd`] /// * [`Ord`] /// * [`PartialEq`] @@ -1133,9 +1133,10 @@ mod prim_usize {} /// * [`Fn`] \(in addition, `&T` references get [`FnMut`] and [`FnOnce`] if `T: Fn`) /// * [`Hash`] /// * [`ToSocketAddrs`] +/// * [`Send`] \(`&T` references also require T: [Sync]) /// /// [`std::fmt`]: fmt -/// ['Pointer`]: fmt::Pointer +/// [`fmt::Pointer`]: fmt::Pointer /// [`Hash`]: hash::Hash #[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))] /// @@ -1150,7 +1151,6 @@ mod prim_usize {} /// * [`ExactSizeIterator`] /// * [`FusedIterator`] /// * [`TrustedLen`] -/// * [`Send`] \(note that `&T` references only get `Send` if T: [Sync]) /// * [`io::Write`] /// * [`Read`] /// * [`Seek`] From cdb0c29a9cf83db18906d7da7e2dbb581044a633 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Fri, 19 Nov 2021 19:13:53 +0300 Subject: [PATCH 4/4] Remove unnecessary doc links --- library/core/src/primitive_docs.rs | 2 -- library/std/src/primitive_docs.rs | 2 -- 2 files changed, 4 deletions(-) diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index d919f8ee31e3..f47a30c9b5d7 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -1108,7 +1108,6 @@ mod prim_usize {} /// /// [`Deref`]: ops::Deref /// [`Borrow`]: borrow::Borrow -/// [`fmt::Pointer`]: fmt::Pointer /// /// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating /// multiple simultaneous mutable borrows), plus the following, regardless of the type of its @@ -1136,7 +1135,6 @@ mod prim_usize {} /// * [`Send`] \(`&T` references also require T: [Sync]) /// /// [`std::fmt`]: fmt -/// [`fmt::Pointer`]: fmt::Pointer /// [`Hash`]: hash::Hash #[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))] /// diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs index d919f8ee31e3..f47a30c9b5d7 100644 --- a/library/std/src/primitive_docs.rs +++ b/library/std/src/primitive_docs.rs @@ -1108,7 +1108,6 @@ mod prim_usize {} /// /// [`Deref`]: ops::Deref /// [`Borrow`]: borrow::Borrow -/// [`fmt::Pointer`]: fmt::Pointer /// /// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating /// multiple simultaneous mutable borrows), plus the following, regardless of the type of its @@ -1136,7 +1135,6 @@ mod prim_usize {} /// * [`Send`] \(`&T` references also require T: [Sync]) /// /// [`std::fmt`]: fmt -/// [`fmt::Pointer`]: fmt::Pointer /// [`Hash`]: hash::Hash #[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))] ///