diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-03-07 19:15:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-07 19:15:33 +0100 |
| commit | f5a143f796d9227e45a8c0f4d101d2b644fa0cc8 (patch) | |
| tree | 2931e05792fe3f648428e1d40c93b4621f6f3a1f /library/alloc/src/sync.rs | |
| parent | 03eb45452305f2d52348279d0caa5fc1f12c438d (diff) | |
| parent | d2bde63b7ade858b7fa819aa042f6b2e196863ff (diff) | |
| download | rust-f5a143f796d9227e45a8c0f4d101d2b644fa0cc8.tar.gz rust-f5a143f796d9227e45a8c0f4d101d2b644fa0cc8.zip | |
Rollup merge of #134797 - spastorino:ergonomic-ref-counting-1, r=nikomatsakis
Ergonomic ref counting This is an experimental first version of ergonomic ref counting. This first version implements most of the RFC but doesn't implement any of the optimizations. This was left for following iterations. RFC: https://github.com/rust-lang/rfcs/pull/3680 Tracking issue: https://github.com/rust-lang/rust/issues/132290 Project goal: https://github.com/rust-lang/rust-project-goals/issues/107 r? ```@nikomatsakis```
Diffstat (limited to 'library/alloc/src/sync.rs')
| -rw-r--r-- | library/alloc/src/sync.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 1956dda5388..21ee59cc538 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. |
