]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #20119 : FlaPer87/rust/oibit-send-and-friends, r=nikomatsakis
authorbors <bors@rust-lang.org>
Sat, 27 Dec 2014 13:11:48 +0000 (13:11 +0000)
committerbors <bors@rust-lang.org>
Sat, 27 Dec 2014 13:11:48 +0000 (13:11 +0000)
More work on opt-in built in traits. `Send` and `Sync` are not opt-in, `OwnedPtr` renamed to `UniquePtr` and the `Send` and `Sync` traits are now unsafe.

NOTE: This likely needs to be rebased on top of the yet-to-land snapshot.

r? @nikomatsakis

cc #13231

1  2 
src/librustc/middle/mem_categorization.rs
src/librustc/middle/traits/select.rs
src/librustc_borrowck/borrowck/check_loans.rs
src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
src/librustc_borrowck/borrowck/gather_loans/restrictions.rs
src/librustc_trans/trans/mod.rs
src/librustc_typeck/check/regionck.rs
src/libstd/c_str.rs
src/libstd/comm/mod.rs

Simple merge
Simple merge
Simple merge
Simple merge
index d3bfaab83da487c859d99d3d71b67884011aa482,269d988d1eeb925027aa997fcc129a7788fa558a..c85bea87218ff6be2aa279890ad08dd1c4ed76db
@@@ -1018,11 -1025,33 +1023,32 @@@ impl<T: Send> Drop for Receiver<T> 
      }
  }
  
+ /// A version of `UnsafeCell` intended for use in concurrent data
+ /// structures (for example, you might put it in an `Arc`).
+ struct RacyCell<T>(pub UnsafeCell<T>);
+ impl<T> RacyCell<T> {
+     fn new(value: T) -> RacyCell<T> {
+         RacyCell(UnsafeCell { value: value })
+     }
+     unsafe fn get(&self) -> *mut T {
+         self.0.get()
+     }
+ }
+ unsafe impl<T:Send> Send for RacyCell<T> { }
+ unsafe impl<T> kinds::Sync for RacyCell<T> { } // Oh dear
  #[cfg(test)]
  mod test {
 +    use super::*;
      use prelude::*;
 -
      use os;
 -    use super::*;
  
      pub fn stress_factor() -> uint {
          match os::getenv("RUST_TEST_STRESS") {