Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
commit 8b9ada599747648cd10d9971e97ddb610712b711 2 parents 0bc993c + 3a4904f
@bors bors authored
Showing with 24 additions and 1 deletion.
  1. +2 −1  src/libcore/atomic.rs
  2. +22 −0 src/test/run-pass/sync-send-atomics.rs
View
3  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
View
22 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() {}
Please sign in to comment.
Something went wrong with that request. Please try again.