diff options
| author | Flavio Percoco <flaper87@gmail.com> | 2014-12-06 11:39:25 -0500 |
|---|---|---|
| committer | Flavio Percoco <flaper87@gmail.com> | 2014-12-26 17:26:32 +0100 |
| commit | fb803a857000813e4d572900799f0498fb20050b (patch) | |
| tree | a1247d535c6dbb3fcaca0743cda7900481d14053 /src/liballoc | |
| parent | c43efee6def9a4a4e943feef0236d3e17b3f581d (diff) | |
| download | rust-fb803a857000813e4d572900799f0498fb20050b.tar.gz rust-fb803a857000813e4d572900799f0498fb20050b.zip | |
Require types to opt-in Sync
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/boxed.rs | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 893c9d250b7..e060ecad974 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -129,6 +129,10 @@ pub struct Weak<T> { _ptr: *mut ArcInner<T>, } +impl<T: Sync + Send> Send for Arc<T> { } + +impl<T: Sync + Send> Sync for Arc<T> { } + struct ArcInner<T> { strong: atomic::AtomicUint, weak: atomic::AtomicUint, diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 5fd234192c5..0f81d43356d 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -19,6 +19,7 @@ use core::hash::{mod, Hash}; use core::kinds::Sized; use core::mem; use core::option::Option; +use core::ptr::OwnedPtr; use core::raw::TraitObject; use core::result::Result; use core::result::Result::{Ok, Err}; @@ -44,7 +45,7 @@ pub static HEAP: () = (); /// A type that represents a uniquely-owned value. #[lang = "owned_box"] #[unstable = "custom allocators will add an additional type parameter (with default)"] -pub struct Box<T>(*mut T); +pub struct Box<T>(OwnedPtr<T>); #[stable] impl<T: Default> Default for Box<T> { |
