diff options
| author | bors <bors@rust-lang.org> | 2015-07-30 04:18:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-07-30 04:18:50 +0000 |
| commit | 8b9ada599747648cd10d9971e97ddb610712b711 (patch) | |
| tree | 2b435e85566fc7b7afde424075b645f4f06fed0d | |
| parent | 0bc993c75bb8f40dd446fa65ccafa0d5b70a7a8a (diff) | |
| parent | 3a4904f06f5d39bfa50d1cd55e6ad6229c34045d (diff) | |
| download | rust-8b9ada599747648cd10d9971e97ddb610712b711.tar.gz rust-8b9ada599747648cd10d9971e97ddb610712b711.zip | |
Auto merge of #27052 - wthrowe:atomic_send, r=Gankro
I think this was just missed when `Send` and `Sync` were redone, since it seems odd to not be able to use things like `Arc<AtomicPtr>`. If it was intentional feel free to just close this. I used another test as a template for writing mine, so I hope I got all the headers and stuff right.
| -rw-r--r-- | src/libcore/atomic.rs | 3 | ||||
| -rw-r--r-- | src/test/run-pass/sync-send-atomics.rs | 22 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/libcore/atomic.rs b/src/libcore/atomic.rs index 3d133b6b7b0..53952cdc908 100644 --- a/src/libcore/atomic.rs +++ b/src/libcore/atomic.rs @@ -72,7 +72,7 @@ use self::Ordering::*; -use marker::Sync; +use marker::{Send, Sync}; use intrinsics; use cell::UnsafeCell; @@ -134,6 +134,7 @@ impl<T> Default for AtomicPtr<T> { } } +unsafe impl<T> Send for AtomicPtr<T> {} unsafe impl<T> Sync for AtomicPtr<T> {} /// Atomic memory orderings diff --git a/src/test/run-pass/sync-send-atomics.rs b/src/test/run-pass/sync-send-atomics.rs new file mode 100644 index 00000000000..1ead6268d0c --- /dev/null +++ b/src/test/run-pass/sync-send-atomics.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +use std::sync::atomic::*; + +trait SendSync: Send + Sync {} + +impl SendSync for AtomicBool {} +impl SendSync for AtomicIsize {} +impl SendSync for AtomicUsize {} +impl<T> SendSync for AtomicPtr<T> {} + +fn main() {} |
