diff options
| author | Adrian Taylor <adetaylor@chromium.org> | 2024-09-11 12:27:08 +0000 | 
|---|---|---|
| committer | Adrian Taylor <adetaylor@chromium.org> | 2024-10-22 12:55:16 +0000 | 
| commit | 8f85b90ca6d57459eb19accb6aaf781dd1c7bf6c (patch) | |
| tree | 3c7d77a8f0fb8dc2ee157028bbe54d6244548ae2 /library/core/src | |
| parent | 916e9ced404f276e90171d7852d436b6ca92df56 (diff) | |
| download | rust-8f85b90ca6d57459eb19accb6aaf781dd1c7bf6c.tar.gz rust-8f85b90ca6d57459eb19accb6aaf781dd1c7bf6c.zip | |
Rename Receiver -> LegacyReceiver
As part of the "arbitrary self types v2" project, we are going to replace the current `Receiver` trait with a new mechanism based on a new, different `Receiver` trait. This PR renames the old trait to get it out the way. Naming is hard. Options considered included: * HardCodedReceiver (because it should only be used for things in the standard library, and hence is sort-of hard coded) * LegacyReceiver * TargetLessReceiver * OldReceiver These are all bad names, but fortunately this will be temporary. Assuming the new mechanism proceeds to stabilization as intended, the legacy trait will be removed altogether. Although we expect this trait to be used only in the standard library, we suspect it may be in use elsehwere, so we're landing this change separately to identify any surprising breakages. It's known that this trait is used within the Rust for Linux project; a patch is in progress to remove their dependency. This is a part of the arbitrary self types v2 project, https://github.com/rust-lang/rfcs/pull/3519 https://github.com/rust-lang/rust/issues/44874 r? @wesleywiser
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/ops/deref.rs | 20 | ||||
| -rw-r--r-- | library/core/src/ops/mod.rs | 4 | ||||
| -rw-r--r-- | library/core/src/pin.rs | 6 | 
3 files changed, 18 insertions, 12 deletions
| diff --git a/library/core/src/ops/deref.rs b/library/core/src/ops/deref.rs index f0d2c761ef3..49b380e4574 100644 --- a/library/core/src/ops/deref.rs +++ b/library/core/src/ops/deref.rs @@ -297,15 +297,21 @@ unsafe impl<T: ?Sized> DerefPure for &mut T {} /// Indicates that a struct can be used as a method receiver, without the /// `arbitrary_self_types` feature. This is implemented by stdlib pointer types like `Box<T>`, /// `Rc<T>`, `&T`, and `Pin<P>`. -#[lang = "receiver"] -#[unstable(feature = "receiver_trait", issue = "none")] +/// +/// This trait will shortly be removed and replaced with a more generic +/// facility based around the current "arbitrary self types" unstable feature. +/// That new facility will use a replacement trait called `Receiver` which is +/// why this is now named `LegacyReceiver`. +#[cfg_attr(bootstrap, lang = "receiver")] +#[cfg_attr(not(bootstrap), lang = "legacy_receiver")] +#[unstable(feature = "legacy_receiver_trait", issue = "none")] #[doc(hidden)] -pub trait Receiver { +pub trait LegacyReceiver { // Empty. } -#[unstable(feature = "receiver_trait", issue = "none")] -impl<T: ?Sized> Receiver for &T {} +#[unstable(feature = "legacy_receiver_trait", issue = "none")] +impl<T: ?Sized> LegacyReceiver for &T {} -#[unstable(feature = "receiver_trait", issue = "none")] -impl<T: ?Sized> Receiver for &mut T {} +#[unstable(feature = "legacy_receiver_trait", issue = "none")] +impl<T: ?Sized> LegacyReceiver for &mut T {} diff --git a/library/core/src/ops/mod.rs b/library/core/src/ops/mod.rs index 5464bf645d9..c9f47e5daad 100644 --- a/library/core/src/ops/mod.rs +++ b/library/core/src/ops/mod.rs @@ -168,8 +168,8 @@ pub use self::control_flow::ControlFlow; pub use self::coroutine::{Coroutine, CoroutineState}; #[unstable(feature = "deref_pure_trait", issue = "87121")] pub use self::deref::DerefPure; -#[unstable(feature = "receiver_trait", issue = "none")] -pub use self::deref::Receiver; +#[unstable(feature = "legacy_receiver_trait", issue = "none")] +pub use self::deref::LegacyReceiver; #[stable(feature = "rust1", since = "1.0.0")] pub use self::deref::{Deref, DerefMut}; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs index 5d5733d38fc..254b306fcaa 100644 --- a/library/core/src/pin.rs +++ b/library/core/src/pin.rs @@ -921,7 +921,7 @@ #![stable(feature = "pin", since = "1.33.0")] use crate::hash::{Hash, Hasher}; -use crate::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, Receiver}; +use crate::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, LegacyReceiver}; #[allow(unused_imports)] use crate::{ cell::{RefCell, UnsafeCell}, @@ -1692,8 +1692,8 @@ impl<Ptr: DerefMut<Target: Unpin>> DerefMut for Pin<Ptr> { #[unstable(feature = "deref_pure_trait", issue = "87121")] unsafe impl<Ptr: DerefPure> DerefPure for Pin<Ptr> {} -#[unstable(feature = "receiver_trait", issue = "none")] -impl<Ptr: Receiver> Receiver for Pin<Ptr> {} +#[unstable(feature = "legacy_receiver_trait", issue = "none")] +impl<Ptr: LegacyReceiver> LegacyReceiver for Pin<Ptr> {} #[stable(feature = "pin", since = "1.33.0")] impl<Ptr: fmt::Debug> fmt::Debug for Pin<Ptr> { | 
