Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly impl Clone for RWArc #8198

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ impl<T:Freeze+Send> Arc<T> {
}
}

/**
* Duplicate an atomically reference counted wrapper.
*
* The resulting two `arc` objects will point to the same underlying data
* object. However, one of the `arc` objects can be sent to another task,
* allowing them to share the underlying data.
*/
impl<T:Freeze + Send> Clone for Arc<T> {
/**
* Duplicate an atomically reference counted wrapper.
*
* The resulting two `arc` objects will point to the same underlying data
* object. However, one of the `arc` objects can be sent to another task,
* allowing them to share the underlying data.
*/
fn clone(&self) -> Arc<T> {
Arc { x: self.x.clone() }
}
Expand All @@ -164,7 +164,7 @@ struct MutexArc<T> { priv x: UnsafeAtomicRcBox<MutexArcInner<T>> }


impl<T:Send> Clone for MutexArc<T> {
/// Duplicate a mutex-protected Arc, as arc::clone.
/// Duplicate a mutex-protected Arc. See arc::clone for more details.
fn clone(&self) -> MutexArc<T> {
// NB: Cloning the underlying mutex is not necessary. Its reference
// count would be exactly the same as the shared state's.
Expand Down Expand Up @@ -312,12 +312,10 @@ struct RWArc<T> {
priv x: UnsafeAtomicRcBox<RWArcInner<T>>,
}

impl<T:Freeze + Send> RWArc<T> {
/// Duplicate a rwlock-protected Arc, as arc::clone.
pub fn clone(&self) -> RWArc<T> {
RWArc {
x: self.x.clone(),
}
impl<T:Freeze + Send> Clone for RWArc<T> {
/// Duplicate a rwlock-protected Arc. See arc::clone for more details.
fn clone(&self) -> RWArc<T> {
RWArc { x: self.x.clone() }
}

}
Expand Down