diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 3d10628b1cb..8d8bbb42932 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -117,6 +117,10 @@ pub struct Arc { _ptr: *mut ArcInner, } +unsafe impl Send for Arc { } +unsafe impl Sync for Arc { } + + /// A weak pointer to an `Arc`. /// /// Weak pointers will not keep the data inside of the `Arc` alive, and can be used to break cycles @@ -129,9 +133,8 @@ pub struct Weak { _ptr: *mut ArcInner, } -unsafe impl Send for Arc { } - -unsafe impl Sync for Arc { } +unsafe impl Send for Weak { } +unsafe impl Sync for Weak { } struct ArcInner { strong: atomic::AtomicUint, @@ -139,6 +142,9 @@ struct ArcInner { data: T, } +unsafe impl Send for ArcInner {} +unsafe impl Sync for ArcInner {} + impl Arc { /// Constructs a new `Arc`. /// @@ -591,6 +597,7 @@ mod tests { use std::str::Str; use std::sync::atomic; use std::task; + use std::kinds::Send; use std::vec::Vec; use super::{Arc, Weak, weak_count, strong_count}; use std::sync::Mutex;