From 73d655e9c2106566f328de28aeff6fd3a8ee8e21 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 16 Oct 2022 10:38:48 +0200 Subject: remove redundant Send impls for references also move them next to the trait they are implementing --- library/core/src/marker.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'library') diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index d5ed52124e2..bb10caee6e2 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -44,6 +44,12 @@ impl !Send for *const T {} #[stable(feature = "rust1", since = "1.0.0")] impl !Send for *mut T {} +// Most instances arise automatically, but this instance is needed to link up `T: Sync` with +// `&T: Send` (and it also removes the unsound default instance `T Send` -> `&T: Send` that would +// otherwise exist). +#[stable(feature = "rust1", since = "1.0.0")] +unsafe impl Send for &T {} + /// Types with a constant size known at compile time. /// /// All type parameters have an implicit bound of `Sized`. The special syntax @@ -680,13 +686,6 @@ pub struct PhantomData; impls! { PhantomData } -mod impls { - #[stable(feature = "rust1", since = "1.0.0")] - unsafe impl Send for &T {} - #[stable(feature = "rust1", since = "1.0.0")] - unsafe impl Send for &mut T {} -} - /// Compiler-internal trait used to indicate the type of enum discriminants. /// /// This trait is automatically implemented for every type and does not add any -- cgit 1.4.1-3-g733a5