Register snapshot for 9006c3c
This commit is contained in:
@@ -174,61 +174,17 @@ struct RcBox<T> {
|
|||||||
/// See the [module level documentation](../index.html) for more details.
|
/// See the [module level documentation](../index.html) for more details.
|
||||||
#[unsafe_no_drop_flag]
|
#[unsafe_no_drop_flag]
|
||||||
#[stable]
|
#[stable]
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct Rc<T> {
|
|
||||||
// FIXME #12808: strange names to try to avoid interfering with field accesses of the contained
|
|
||||||
// type via Deref
|
|
||||||
_ptr: NonZero<*mut RcBox<T>>,
|
|
||||||
_nosend: marker::NoSend,
|
|
||||||
_noshare: marker::NoSync
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An immutable reference-counted pointer type.
|
|
||||||
///
|
|
||||||
/// See the [module level documentation](../index.html) for more details.
|
|
||||||
#[unsafe_no_drop_flag]
|
|
||||||
#[stable]
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub struct Rc<T> {
|
pub struct Rc<T> {
|
||||||
// FIXME #12808: strange names to try to avoid interfering with field accesses of the contained
|
// FIXME #12808: strange names to try to avoid interfering with field accesses of the contained
|
||||||
// type via Deref
|
// type via Deref
|
||||||
_ptr: NonZero<*mut RcBox<T>>,
|
_ptr: NonZero<*mut RcBox<T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
impl<T> !marker::Send for Rc<T> {}
|
impl<T> !marker::Send for Rc<T> {}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
impl<T> !marker::Sync for Rc<T> {}
|
impl<T> !marker::Sync for Rc<T> {}
|
||||||
|
|
||||||
impl<T> Rc<T> {
|
impl<T> Rc<T> {
|
||||||
/// Constructs a new `Rc<T>`.
|
|
||||||
///
|
|
||||||
/// # Examples
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// use std::rc::Rc;
|
|
||||||
///
|
|
||||||
/// let five = Rc::new(5i);
|
|
||||||
/// ```
|
|
||||||
#[stable]
|
|
||||||
#[cfg(stage0)] // NOTE remove after next snapshot
|
|
||||||
pub fn new(value: T) -> Rc<T> {
|
|
||||||
unsafe {
|
|
||||||
Rc {
|
|
||||||
// there is an implicit weak pointer owned by all the strong pointers, which
|
|
||||||
// ensures that the weak destructor never frees the allocation while the strong
|
|
||||||
// destructor is running, even if the weak pointer is stored inside the strong one.
|
|
||||||
_ptr: NonZero::new(transmute(box RcBox {
|
|
||||||
value: value,
|
|
||||||
strong: Cell::new(1),
|
|
||||||
weak: Cell::new(1)
|
|
||||||
})),
|
|
||||||
_nosend: marker::NoSend,
|
|
||||||
_noshare: marker::NoSync
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Constructs a new `Rc<T>`.
|
/// Constructs a new `Rc<T>`.
|
||||||
///
|
///
|
||||||
@@ -240,7 +196,6 @@ impl<T> Rc<T> {
|
|||||||
/// let five = Rc::new(5i);
|
/// let five = Rc::new(5i);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable]
|
#[stable]
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub fn new(value: T) -> Rc<T> {
|
pub fn new(value: T) -> Rc<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Rc {
|
Rc {
|
||||||
@@ -267,29 +222,6 @@ impl<T> Rc<T> {
|
|||||||
///
|
///
|
||||||
/// let weak_five = five.downgrade();
|
/// let weak_five = five.downgrade();
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(stage0)] // NOTE remove after next snapshot
|
|
||||||
#[unstable = "Weak pointers may not belong in this module"]
|
|
||||||
pub fn downgrade(&self) -> Weak<T> {
|
|
||||||
self.inc_weak();
|
|
||||||
Weak {
|
|
||||||
_ptr: self._ptr,
|
|
||||||
_nosend: marker::NoSend,
|
|
||||||
_noshare: marker::NoSync
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Downgrades the `Rc<T>` to a `Weak<T>` reference.
|
|
||||||
///
|
|
||||||
/// # Examples
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// use std::rc::Rc;
|
|
||||||
///
|
|
||||||
/// let five = Rc::new(5i);
|
|
||||||
///
|
|
||||||
/// let weak_five = five.downgrade();
|
|
||||||
/// ```
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
#[unstable = "Weak pointers may not belong in this module"]
|
#[unstable = "Weak pointers may not belong in this module"]
|
||||||
pub fn downgrade(&self) -> Weak<T> {
|
pub fn downgrade(&self) -> Weak<T> {
|
||||||
self.inc_weak();
|
self.inc_weak();
|
||||||
@@ -483,25 +415,6 @@ impl<T> Drop for Rc<T> {
|
|||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<T> Clone for Rc<T> {
|
impl<T> Clone for Rc<T> {
|
||||||
/// Makes a clone of the `Rc<T>`.
|
|
||||||
///
|
|
||||||
/// This increases the strong reference count.
|
|
||||||
///
|
|
||||||
/// # Examples
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// use std::rc::Rc;
|
|
||||||
///
|
|
||||||
/// let five = Rc::new(5i);
|
|
||||||
///
|
|
||||||
/// five.clone();
|
|
||||||
/// ```
|
|
||||||
#[inline]
|
|
||||||
#[cfg(stage0)] // NOTE remove after next snapshot
|
|
||||||
fn clone(&self) -> Rc<T> {
|
|
||||||
self.inc_strong();
|
|
||||||
Rc { _ptr: self._ptr, _nosend: marker::NoSend, _noshare: marker::NoSync }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Makes a clone of the `Rc<T>`.
|
/// Makes a clone of the `Rc<T>`.
|
||||||
///
|
///
|
||||||
@@ -517,7 +430,6 @@ impl<T> Clone for Rc<T> {
|
|||||||
/// five.clone();
|
/// five.clone();
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
fn clone(&self) -> Rc<T> {
|
fn clone(&self) -> Rc<T> {
|
||||||
self.inc_strong();
|
self.inc_strong();
|
||||||
Rc { _ptr: self._ptr }
|
Rc { _ptr: self._ptr }
|
||||||
@@ -714,66 +626,21 @@ impl<T: fmt::String> fmt::String for Rc<T> {
|
|||||||
/// See the [module level documentation](../index.html) for more.
|
/// See the [module level documentation](../index.html) for more.
|
||||||
#[unsafe_no_drop_flag]
|
#[unsafe_no_drop_flag]
|
||||||
#[unstable = "Weak pointers may not belong in this module."]
|
#[unstable = "Weak pointers may not belong in this module."]
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct Weak<T> {
|
|
||||||
// FIXME #12808: strange names to try to avoid interfering with
|
|
||||||
// field accesses of the contained type via Deref
|
|
||||||
_ptr: NonZero<*mut RcBox<T>>,
|
|
||||||
_nosend: marker::NoSend,
|
|
||||||
_noshare: marker::NoSync
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A weak version of `Rc<T>`.
|
|
||||||
///
|
|
||||||
/// Weak references do not count when determining if the inner value should be dropped.
|
|
||||||
///
|
|
||||||
/// See the [module level documentation](../index.html) for more.
|
|
||||||
#[unsafe_no_drop_flag]
|
|
||||||
#[unstable = "Weak pointers may not belong in this module."]
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub struct Weak<T> {
|
pub struct Weak<T> {
|
||||||
// FIXME #12808: strange names to try to avoid interfering with
|
// FIXME #12808: strange names to try to avoid interfering with
|
||||||
// field accesses of the contained type via Deref
|
// field accesses of the contained type via Deref
|
||||||
_ptr: NonZero<*mut RcBox<T>>,
|
_ptr: NonZero<*mut RcBox<T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
#[allow(unstable)]
|
#[allow(unstable)]
|
||||||
impl<T> !marker::Send for Weak<T> {}
|
impl<T> !marker::Send for Weak<T> {}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
#[allow(unstable)]
|
#[allow(unstable)]
|
||||||
impl<T> !marker::Sync for Weak<T> {}
|
impl<T> !marker::Sync for Weak<T> {}
|
||||||
|
|
||||||
|
|
||||||
#[unstable = "Weak pointers may not belong in this module."]
|
#[unstable = "Weak pointers may not belong in this module."]
|
||||||
impl<T> Weak<T> {
|
impl<T> Weak<T> {
|
||||||
/// Upgrades a weak reference to a strong reference.
|
|
||||||
///
|
|
||||||
/// Upgrades the `Weak<T>` reference to an `Rc<T>`, if possible.
|
|
||||||
///
|
|
||||||
/// Returns `None` if there were no strong references and the data was destroyed.
|
|
||||||
///
|
|
||||||
/// # Examples
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// use std::rc::Rc;
|
|
||||||
///
|
|
||||||
/// let five = Rc::new(5i);
|
|
||||||
///
|
|
||||||
/// let weak_five = five.downgrade();
|
|
||||||
///
|
|
||||||
/// let strong_five: Option<Rc<_>> = weak_five.upgrade();
|
|
||||||
/// ```
|
|
||||||
#[cfg(stage0)] // NOTE remove after next snapshot
|
|
||||||
pub fn upgrade(&self) -> Option<Rc<T>> {
|
|
||||||
if self.strong() == 0 {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
self.inc_strong();
|
|
||||||
Some(Rc { _ptr: self._ptr, _nosend: marker::NoSend, _noshare: marker::NoSync })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Upgrades a weak reference to a strong reference.
|
/// Upgrades a weak reference to a strong reference.
|
||||||
///
|
///
|
||||||
@@ -792,7 +659,6 @@ impl<T> Weak<T> {
|
|||||||
///
|
///
|
||||||
/// let strong_five: Option<Rc<_>> = weak_five.upgrade();
|
/// let strong_five: Option<Rc<_>> = weak_five.upgrade();
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub fn upgrade(&self) -> Option<Rc<T>> {
|
pub fn upgrade(&self) -> Option<Rc<T>> {
|
||||||
if self.strong() == 0 {
|
if self.strong() == 0 {
|
||||||
None
|
None
|
||||||
@@ -849,25 +715,6 @@ impl<T> Drop for Weak<T> {
|
|||||||
|
|
||||||
#[unstable = "Weak pointers may not belong in this module."]
|
#[unstable = "Weak pointers may not belong in this module."]
|
||||||
impl<T> Clone for Weak<T> {
|
impl<T> Clone for Weak<T> {
|
||||||
/// Makes a clone of the `Weak<T>`.
|
|
||||||
///
|
|
||||||
/// This increases the weak reference count.
|
|
||||||
///
|
|
||||||
/// # Examples
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// use std::rc::Rc;
|
|
||||||
///
|
|
||||||
/// let weak_five = Rc::new(5i).downgrade();
|
|
||||||
///
|
|
||||||
/// weak_five.clone();
|
|
||||||
/// ```
|
|
||||||
#[inline]
|
|
||||||
#[cfg(stage0)] // NOTE remove after next snapshot
|
|
||||||
fn clone(&self) -> Weak<T> {
|
|
||||||
self.inc_weak();
|
|
||||||
Weak { _ptr: self._ptr, _nosend: marker::NoSend, _noshare: marker::NoSync }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Makes a clone of the `Weak<T>`.
|
/// Makes a clone of the `Weak<T>`.
|
||||||
///
|
///
|
||||||
@@ -883,7 +730,6 @@ impl<T> Clone for Weak<T> {
|
|||||||
/// weak_five.clone();
|
/// weak_five.clone();
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
fn clone(&self) -> Weak<T> {
|
fn clone(&self) -> Weak<T> {
|
||||||
self.inc_weak();
|
self.inc_weak();
|
||||||
Weak { _ptr: self._ptr }
|
Weak { _ptr: self._ptr }
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ use core::cmp::Ordering::{self, Less, Greater, Equal};
|
|||||||
use core::default::Default;
|
use core::default::Default;
|
||||||
use core::fmt::Show;
|
use core::fmt::Show;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
// NOTE(stage0) remove import after a snapshot
|
|
||||||
#[cfg(stage0)]
|
|
||||||
use core::hash::Hash;
|
|
||||||
use core::iter::{Peekable, Map, FromIterator};
|
use core::iter::{Peekable, Map, FromIterator};
|
||||||
use core::ops::{BitOr, BitAnd, BitXor, Sub};
|
use core::ops::{BitOr, BitAnd, BitXor, Sub};
|
||||||
|
|
||||||
|
|||||||
@@ -376,16 +376,6 @@ pub struct ContravariantLifetime<'a>;
|
|||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub struct InvariantLifetime<'a>;
|
pub struct InvariantLifetime<'a>;
|
||||||
|
|
||||||
/// A type which is considered "not sendable", meaning that it cannot
|
|
||||||
/// be safely sent between tasks, even if it is owned. This is
|
|
||||||
/// typically embedded in other types, such as `Gc`, to ensure that
|
|
||||||
/// their instances remain thread-local.
|
|
||||||
#[unstable = "likely to change with new variance strategy"]
|
|
||||||
#[lang="no_send_bound"]
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct NoSend;
|
|
||||||
|
|
||||||
/// A type which is considered "not POD", meaning that it is not
|
/// A type which is considered "not POD", meaning that it is not
|
||||||
/// implicitly copyable. This is typically embedded in other types to
|
/// implicitly copyable. This is typically embedded in other types to
|
||||||
/// ensure that they are never copied, even if they lack a destructor.
|
/// ensure that they are never copied, even if they lack a destructor.
|
||||||
@@ -395,15 +385,6 @@ pub struct NoSend;
|
|||||||
#[allow(missing_copy_implementations)]
|
#[allow(missing_copy_implementations)]
|
||||||
pub struct NoCopy;
|
pub struct NoCopy;
|
||||||
|
|
||||||
/// A type which is considered "not sync", meaning that
|
|
||||||
/// its contents are not threadsafe, hence they cannot be
|
|
||||||
/// shared between tasks.
|
|
||||||
#[unstable = "likely to change with new variance strategy"]
|
|
||||||
#[lang="no_sync_bound"]
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct NoSync;
|
|
||||||
|
|
||||||
/// A type which is considered managed by the GC. This is typically
|
/// A type which is considered managed by the GC. This is typically
|
||||||
/// embedded in other types.
|
/// embedded in other types.
|
||||||
#[unstable = "likely to change with new variance strategy"]
|
#[unstable = "likely to change with new variance strategy"]
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ use util::nodemap::{FnvHashMap, FnvHashSet, NodeMap};
|
|||||||
use util::common::can_reach;
|
use util::common::can_reach;
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
// NOTE(stage0) remove import after a snapshot
|
|
||||||
#[cfg(stage0)]
|
|
||||||
use std::hash::{Hash};
|
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
use syntax::{ast, visit};
|
use syntax::{ast, visit};
|
||||||
use syntax::ast::{Block, Item, FnDecl, NodeId, Arm, Pat, Stmt, Expr, Local};
|
use syntax::ast::{Block, Item, FnDecl, NodeId, Arm, Pat, Stmt, Expr, Local};
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ use prelude::v1::*;
|
|||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use ffi::CString;
|
use ffi::CString;
|
||||||
use fmt;
|
use fmt;
|
||||||
// NOTE(stage0) remove import after a snapshot
|
|
||||||
#[cfg(stage0)]
|
|
||||||
use hash::Hash;
|
|
||||||
use io::pipe::{PipeStream, PipePair};
|
use io::pipe::{PipeStream, PipePair};
|
||||||
use io::{IoResult, IoError};
|
use io::{IoResult, IoError};
|
||||||
use io;
|
use io;
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ use thread::Thread;
|
|||||||
use sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
|
use sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
|
||||||
use sync::Arc;
|
use sync::Arc;
|
||||||
use marker::{Sync, Send};
|
use marker::{Sync, Send};
|
||||||
#[cfg(stage0)] // NOTE remove use after next snapshot
|
|
||||||
use marker::{NoSend, NoSync};
|
|
||||||
use mem;
|
use mem;
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
|
|
||||||
@@ -32,42 +30,14 @@ pub struct SignalToken {
|
|||||||
inner: Arc<Inner>,
|
inner: Arc<Inner>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct WaitToken {
|
|
||||||
inner: Arc<Inner>,
|
|
||||||
no_send: NoSend,
|
|
||||||
no_sync: NoSync,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub struct WaitToken {
|
pub struct WaitToken {
|
||||||
inner: Arc<Inner>,
|
inner: Arc<Inner>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
impl !Send for WaitToken {}
|
impl !Send for WaitToken {}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
impl !Sync for WaitToken {}
|
impl !Sync for WaitToken {}
|
||||||
|
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub fn tokens() -> (WaitToken, SignalToken) {
|
|
||||||
let inner = Arc::new(Inner {
|
|
||||||
thread: Thread::current(),
|
|
||||||
woken: ATOMIC_BOOL_INIT,
|
|
||||||
});
|
|
||||||
let wait_token = WaitToken {
|
|
||||||
inner: inner.clone(),
|
|
||||||
no_send: NoSend,
|
|
||||||
no_sync: NoSync,
|
|
||||||
};
|
|
||||||
let signal_token = SignalToken {
|
|
||||||
inner: inner
|
|
||||||
};
|
|
||||||
(wait_token, signal_token)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub fn tokens() -> (WaitToken, SignalToken) {
|
pub fn tokens() -> (WaitToken, SignalToken) {
|
||||||
let inner = Arc::new(Inner {
|
let inner = Arc::new(Inner {
|
||||||
thread: Thread::current(),
|
thread: Thread::current(),
|
||||||
|
|||||||
@@ -370,22 +370,10 @@ unsafe impl<T:Send> Send for Sender<T> { }
|
|||||||
/// The sending-half of Rust's synchronous channel type. This half can only be
|
/// The sending-half of Rust's synchronous channel type. This half can only be
|
||||||
/// owned by one task, but it can be cloned to send to other tasks.
|
/// owned by one task, but it can be cloned to send to other tasks.
|
||||||
#[stable]
|
#[stable]
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct SyncSender<T> {
|
|
||||||
inner: Arc<RacyCell<sync::Packet<T>>>,
|
|
||||||
// can't share in an arc
|
|
||||||
_marker: marker::NoSync,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The sending-half of Rust's synchronous channel type. This half can only be
|
|
||||||
/// owned by one task, but it can be cloned to send to other tasks.
|
|
||||||
#[stable]
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub struct SyncSender<T> {
|
pub struct SyncSender<T> {
|
||||||
inner: Arc<RacyCell<sync::Packet<T>>>,
|
inner: Arc<RacyCell<sync::Packet<T>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
impl<T> !marker::Sync for SyncSender<T> {}
|
impl<T> !marker::Sync for SyncSender<T> {}
|
||||||
|
|
||||||
/// An error returned from the `send` function on channels.
|
/// An error returned from the `send` function on channels.
|
||||||
@@ -689,12 +677,7 @@ impl<T: Send> Drop for Sender<T> {
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
impl<T: Send> SyncSender<T> {
|
impl<T: Send> SyncSender<T> {
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
fn new(inner: Arc<RacyCell<sync::Packet<T>>>) -> SyncSender<T> {
|
|
||||||
SyncSender { inner: inner, _marker: marker::NoSync }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
fn new(inner: Arc<RacyCell<sync::Packet<T>>>) -> SyncSender<T> {
|
fn new(inner: Arc<RacyCell<sync::Packet<T>>>) -> SyncSender<T> {
|
||||||
SyncSender { inner: inner }
|
SyncSender { inner: inner }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,24 +66,12 @@ use sync::mpsc::blocking::{self, SignalToken};
|
|||||||
|
|
||||||
/// The "receiver set" of the select interface. This structure is used to manage
|
/// The "receiver set" of the select interface. This structure is used to manage
|
||||||
/// a set of receivers which are being selected over.
|
/// a set of receivers which are being selected over.
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct Select {
|
|
||||||
head: *mut Handle<'static, ()>,
|
|
||||||
tail: *mut Handle<'static, ()>,
|
|
||||||
next_id: Cell<uint>,
|
|
||||||
marker1: marker::NoSend,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The "receiver set" of the select interface. This structure is used to manage
|
|
||||||
/// a set of receivers which are being selected over.
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub struct Select {
|
pub struct Select {
|
||||||
head: *mut Handle<'static, ()>,
|
head: *mut Handle<'static, ()>,
|
||||||
tail: *mut Handle<'static, ()>,
|
tail: *mut Handle<'static, ()>,
|
||||||
next_id: Cell<uint>,
|
next_id: Cell<uint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
impl !marker::Send for Select {}
|
impl !marker::Send for Select {}
|
||||||
|
|
||||||
/// A handle to a receiver which is currently a member of a `Select` set of
|
/// A handle to a receiver which is currently a member of a `Select` set of
|
||||||
@@ -121,27 +109,12 @@ pub trait Packet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Select {
|
impl Select {
|
||||||
/// Creates a new selection structure. This set is initially empty and
|
|
||||||
/// `wait` will panic!() if called.
|
|
||||||
///
|
|
||||||
/// Usage of this struct directly can sometimes be burdensome, and usage is
|
|
||||||
/// rather much easier through the `select!` macro.
|
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub fn new() -> Select {
|
|
||||||
Select {
|
|
||||||
marker1: marker::NoSend,
|
|
||||||
head: 0 as *mut Handle<'static, ()>,
|
|
||||||
tail: 0 as *mut Handle<'static, ()>,
|
|
||||||
next_id: Cell::new(1),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new selection structure. This set is initially empty and
|
/// Creates a new selection structure. This set is initially empty and
|
||||||
/// `wait` will panic!() if called.
|
/// `wait` will panic!() if called.
|
||||||
///
|
///
|
||||||
/// Usage of this struct directly can sometimes be burdensome, and usage is
|
/// Usage of this struct directly can sometimes be burdensome, and usage is
|
||||||
/// rather much easier through the `select!` macro.
|
/// rather much easier through the `select!` macro.
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub fn new() -> Select {
|
pub fn new() -> Select {
|
||||||
Select {
|
Select {
|
||||||
head: 0 as *mut Handle<'static, ()>,
|
head: 0 as *mut Handle<'static, ()>,
|
||||||
|
|||||||
@@ -160,24 +160,6 @@ unsafe impl Sync for StaticMutex {}
|
|||||||
/// Deref and DerefMut implementations
|
/// Deref and DerefMut implementations
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable]
|
#[stable]
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct MutexGuard<'a, T: 'a> {
|
|
||||||
// funny underscores due to how Deref/DerefMut currently work (they
|
|
||||||
// disregard field privacy).
|
|
||||||
__lock: &'a StaticMutex,
|
|
||||||
__data: &'a UnsafeCell<T>,
|
|
||||||
__poison: poison::Guard,
|
|
||||||
__marker: marker::NoSend,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An RAII implementation of a "scoped lock" of a mutex. When this structure is
|
|
||||||
/// dropped (falls out of scope), the lock will be unlocked.
|
|
||||||
///
|
|
||||||
/// The data protected by the mutex can be access through this guard via its
|
|
||||||
/// Deref and DerefMut implementations
|
|
||||||
#[must_use]
|
|
||||||
#[stable]
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub struct MutexGuard<'a, T: 'a> {
|
pub struct MutexGuard<'a, T: 'a> {
|
||||||
// funny underscores due to how Deref/DerefMut currently work (they
|
// funny underscores due to how Deref/DerefMut currently work (they
|
||||||
// disregard field privacy).
|
// disregard field privacy).
|
||||||
@@ -186,7 +168,6 @@ pub struct MutexGuard<'a, T: 'a> {
|
|||||||
__poison: poison::Guard,
|
__poison: poison::Guard,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
impl<'a, T> !marker::Send for MutexGuard<'a, T> {}
|
impl<'a, T> !marker::Send for MutexGuard<'a, T> {}
|
||||||
|
|
||||||
/// Static initialization of a mutex. This constant can be used to initialize
|
/// Static initialization of a mutex. This constant can be used to initialize
|
||||||
@@ -299,20 +280,7 @@ impl StaticMutex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'mutex, T> MutexGuard<'mutex, T> {
|
impl<'mutex, T> MutexGuard<'mutex, T> {
|
||||||
#[cfg(stage0)] // NOTE remove afte next snapshot
|
|
||||||
fn new(lock: &'mutex StaticMutex, data: &'mutex UnsafeCell<T>)
|
|
||||||
-> LockResult<MutexGuard<'mutex, T>> {
|
|
||||||
poison::map_result(lock.poison.borrow(), |guard| {
|
|
||||||
MutexGuard {
|
|
||||||
__lock: lock,
|
|
||||||
__data: data,
|
|
||||||
__poison: guard,
|
|
||||||
__marker: marker::NoSend,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg afte next snapshot
|
|
||||||
fn new(lock: &'mutex StaticMutex, data: &'mutex UnsafeCell<T>)
|
fn new(lock: &'mutex StaticMutex, data: &'mutex UnsafeCell<T>)
|
||||||
-> LockResult<MutexGuard<'mutex, T>> {
|
-> LockResult<MutexGuard<'mutex, T>> {
|
||||||
poison::map_result(lock.poison.borrow(), |guard| {
|
poison::map_result(lock.poison.borrow(), |guard| {
|
||||||
|
|||||||
@@ -110,50 +110,23 @@ pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock {
|
|||||||
/// dropped.
|
/// dropped.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable]
|
#[stable]
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct RwLockReadGuard<'a, T: 'a> {
|
|
||||||
__lock: &'a StaticRwLock,
|
|
||||||
__data: &'a UnsafeCell<T>,
|
|
||||||
__marker: marker::NoSend,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// RAII structure used to release the shared read access of a lock when
|
|
||||||
/// dropped.
|
|
||||||
#[must_use]
|
|
||||||
#[stable]
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub struct RwLockReadGuard<'a, T: 'a> {
|
pub struct RwLockReadGuard<'a, T: 'a> {
|
||||||
__lock: &'a StaticRwLock,
|
__lock: &'a StaticRwLock,
|
||||||
__data: &'a UnsafeCell<T>,
|
__data: &'a UnsafeCell<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
impl<'a, T> !marker::Send for RwLockReadGuard<'a, T> {}
|
impl<'a, T> !marker::Send for RwLockReadGuard<'a, T> {}
|
||||||
|
|
||||||
/// RAII structure used to release the exclusive write access of a lock when
|
/// RAII structure used to release the exclusive write access of a lock when
|
||||||
/// dropped.
|
/// dropped.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable]
|
#[stable]
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
pub struct RwLockWriteGuard<'a, T: 'a> {
|
|
||||||
__lock: &'a StaticRwLock,
|
|
||||||
__data: &'a UnsafeCell<T>,
|
|
||||||
__poison: poison::Guard,
|
|
||||||
__marker: marker::NoSend,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// RAII structure used to release the exclusive write access of a lock when
|
|
||||||
/// dropped.
|
|
||||||
#[must_use]
|
|
||||||
#[stable]
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
pub struct RwLockWriteGuard<'a, T: 'a> {
|
pub struct RwLockWriteGuard<'a, T: 'a> {
|
||||||
__lock: &'a StaticRwLock,
|
__lock: &'a StaticRwLock,
|
||||||
__data: &'a UnsafeCell<T>,
|
__data: &'a UnsafeCell<T>,
|
||||||
__poison: poison::Guard,
|
__poison: poison::Guard,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
|
impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
|
||||||
|
|
||||||
impl<T: Send + Sync> RwLock<T> {
|
impl<T: Send + Sync> RwLock<T> {
|
||||||
@@ -332,19 +305,7 @@ impl StaticRwLock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'rwlock, T> RwLockReadGuard<'rwlock, T> {
|
impl<'rwlock, T> RwLockReadGuard<'rwlock, T> {
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
|
|
||||||
-> LockResult<RwLockReadGuard<'rwlock, T>> {
|
|
||||||
poison::map_result(lock.poison.borrow(), |_| {
|
|
||||||
RwLockReadGuard {
|
|
||||||
__lock: lock,
|
|
||||||
__data: data,
|
|
||||||
__marker: marker::NoSend,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
|
fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
|
||||||
-> LockResult<RwLockReadGuard<'rwlock, T>> {
|
-> LockResult<RwLockReadGuard<'rwlock, T>> {
|
||||||
poison::map_result(lock.poison.borrow(), |_| {
|
poison::map_result(lock.poison.borrow(), |_| {
|
||||||
@@ -356,20 +317,7 @@ impl<'rwlock, T> RwLockReadGuard<'rwlock, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'rwlock, T> RwLockWriteGuard<'rwlock, T> {
|
impl<'rwlock, T> RwLockWriteGuard<'rwlock, T> {
|
||||||
#[cfg(stage0)] // NOTE remove impl after next snapshot
|
|
||||||
fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
|
|
||||||
-> LockResult<RwLockWriteGuard<'rwlock, T>> {
|
|
||||||
poison::map_result(lock.poison.borrow(), |guard| {
|
|
||||||
RwLockWriteGuard {
|
|
||||||
__lock: lock,
|
|
||||||
__data: data,
|
|
||||||
__poison: guard,
|
|
||||||
__marker: marker::NoSend,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot
|
|
||||||
fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
|
fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell<T>)
|
||||||
-> LockResult<RwLockWriteGuard<'rwlock, T>> {
|
-> LockResult<RwLockWriteGuard<'rwlock, T>> {
|
||||||
poison::map_result(lock.poison.borrow(), |guard| {
|
poison::map_result(lock.poison.borrow(), |guard| {
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
S 2015-01-20 9006c3c
|
||||||
|
freebsd-x86_64 240b30b33263d175e30f925ed1e1e1a4e553a513
|
||||||
|
linux-i386 544c2063b8d5035342c705b881b8868244c1e9a1
|
||||||
|
linux-x86_64 eb41db80978210a013a8dcf8f4fe804969197337
|
||||||
|
macos-i386 3ed08c5ae66367e85b8f2b207615d45bfd9cf89d
|
||||||
|
macos-x86_64 d102760316b90b17d54b0bef02ca6dc35f82e6bd
|
||||||
|
winnt-i386 6940fef6caa2f64d158b8f5eb00afd5c8e0c71a5
|
||||||
|
winnt-x86_64 36b6f239fe1264bceb4b8202e692b7d49947eebe
|
||||||
|
|
||||||
S 2015-01-15 9ade482
|
S 2015-01-15 9ade482
|
||||||
freebsd-x86_64 eb8f52c6e8dc24a293456d5e4dc5d1072442e758
|
freebsd-x86_64 eb8f52c6e8dc24a293456d5e4dc5d1072442e758
|
||||||
linux-i386 0197ad7179d74eba06a8b46432548caf226aa03d
|
linux-i386 0197ad7179d74eba06a8b46432548caf226aa03d
|
||||||
|
|||||||
Reference in New Issue
Block a user