Skip to content

Commit 8d8eb50

Browse files
committed
Relax A: Clone requirement on Rc/Arc::unwrap_or_clone.
1 parent d6122f1 commit 8d8eb50

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

library/alloc/src/rc.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,9 @@ impl<T: Clone, A: Allocator + Clone> Rc<T, A> {
18091809
// reference to the allocation.
18101810
unsafe { &mut this.ptr.as_mut().value }
18111811
}
1812+
}
18121813

1814+
impl<T: Clone, A: Allocator> Rc<T, A> {
18131815
/// If we have the only reference to `T` then unwrap it. Otherwise, clone `T` and return the
18141816
/// clone.
18151817
///

library/alloc/src/sync.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,9 @@ impl<T: Clone, A: Allocator + Clone> Arc<T, A> {
22272227
// either unique to begin with, or became one upon cloning the contents.
22282228
unsafe { Self::get_mut_unchecked(this) }
22292229
}
2230+
}
22302231

2232+
impl<T: Clone, A: Allocator> Arc<T, A> {
22312233
/// If we have the only reference to `T` then unwrap it. Otherwise, clone `T` and return the
22322234
/// clone.
22332235
///

0 commit comments

Comments
 (0)