diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2024-12-11 18:00:56 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2025-03-06 17:58:32 -0300 |
| commit | dcdfd551f05073ececfa437be002ce7804b31c91 (patch) | |
| tree | 813604b622c9bb09c15e1724a6cebfd9d340b53d /library/alloc/src | |
| parent | 57cb498989ac29fbe9938ed2f4a31a3eab6850dc (diff) | |
| download | rust-dcdfd551f05073ececfa437be002ce7804b31c91.tar.gz rust-dcdfd551f05073ececfa437be002ce7804b31c91.zip | |
Add UseCloned trait related code
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/lib.rs | 1 | ||||
| -rw-r--r-- | library/alloc/src/rc.rs | 7 | ||||
| -rw-r--r-- | library/alloc/src/sync.rs | 7 |
3 files changed, 15 insertions, 0 deletions
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index cb93100f56c..aac0eefc519 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -113,6 +113,7 @@ #![feature(deprecated_suggestion)] #![feature(deref_pure_trait)] #![feature(dispatch_from_dyn)] +#![feature(ergonomic_clones)] #![feature(error_generic_member_access)] #![feature(exact_size_is_empty)] #![feature(extend_one)] diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 09206c2f8b2..5847bd8f281 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -245,6 +245,7 @@ use core::any::Any; use core::cell::Cell; #[cfg(not(no_global_oom_handling))] use core::clone::CloneToUninit; +use core::clone::UseCloned; use core::cmp::Ordering; use core::hash::{Hash, Hasher}; use core::intrinsics::abort; @@ -2333,6 +2334,9 @@ impl<T: ?Sized, A: Allocator + Clone> Clone for Rc<T, A> { } } +#[unstable(feature = "ergonomic_clones", issue = "132290")] +impl<T: ?Sized, A: Allocator + Clone> UseCloned for Rc<T, A> {} + #[cfg(not(no_global_oom_handling))] #[stable(feature = "rust1", since = "1.0.0")] impl<T: Default> Default for Rc<T> { @@ -3496,6 +3500,9 @@ impl<T: ?Sized, A: Allocator + Clone> Clone for Weak<T, A> { } } +#[unstable(feature = "ergonomic_clones", issue = "132290")] +impl<T: ?Sized, A: Allocator + Clone> UseCloned for Weak<T, A> {} + #[stable(feature = "rc_weak", since = "1.4.0")] impl<T: ?Sized, A: Allocator> fmt::Debug for Weak<T, A> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index dba1449347a..ddd0677ee35 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -11,6 +11,7 @@ use core::any::Any; #[cfg(not(no_global_oom_handling))] use core::clone::CloneToUninit; +use core::clone::UseCloned; use core::cmp::Ordering; use core::hash::{Hash, Hasher}; use core::intrinsics::abort; @@ -2197,6 +2198,9 @@ impl<T: ?Sized, A: Allocator + Clone> Clone for Arc<T, A> { } } +#[unstable(feature = "ergonomic_clones", issue = "132290")] +impl<T: ?Sized, A: Allocator + Clone> UseCloned for Arc<T, A> {} + #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized, A: Allocator> Deref for Arc<T, A> { type Target = T; @@ -3158,6 +3162,9 @@ impl<T: ?Sized, A: Allocator + Clone> Clone for Weak<T, A> { } } +#[unstable(feature = "ergonomic_clones", issue = "132290")] +impl<T: ?Sized, A: Allocator + Clone> UseCloned for Weak<T, A> {} + #[stable(feature = "downgraded_weak", since = "1.10.0")] impl<T> Default for Weak<T> { /// Constructs a new `Weak<T>`, without allocating memory. |
