librustc: Separate most trait bounds with '+'. rs=plussing
This commit is contained in:
parent
a307608781
commit
bf2a225c0b
204 changed files with 729 additions and 726 deletions
|
@ -80,7 +80,7 @@ impl &Condvar {
|
|||
struct ARC<T> { x: SharedMutableState<T> }
|
||||
|
||||
/// Create an atomically reference counted wrapper.
|
||||
pub fn ARC<T: Const Owned>(data: T) -> ARC<T> {
|
||||
pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
|
||||
ARC { x: unsafe { shared_mutable_state(data) } }
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ pub fn ARC<T: Const Owned>(data: T) -> ARC<T> {
|
|||
* Access the underlying data in an atomically reference counted
|
||||
* wrapper.
|
||||
*/
|
||||
pub fn get<T: Const Owned>(rc: &a/ARC<T>) -> &a/T {
|
||||
pub fn get<T:Const + Owned>(rc: &a/ARC<T>) -> &a/T {
|
||||
unsafe { get_shared_immutable_state(&rc.x) }
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ pub fn get<T: Const Owned>(rc: &a/ARC<T>) -> &a/T {
|
|||
* object. However, one of the `arc` objects can be sent to another task,
|
||||
* allowing them to share the underlying data.
|
||||
*/
|
||||
pub fn clone<T: Const Owned>(rc: &ARC<T>) -> ARC<T> {
|
||||
pub fn clone<T:Const + Owned>(rc: &ARC<T>) -> ARC<T> {
|
||||
ARC { x: unsafe { clone_shared_mutable_state(&rc.x) } }
|
||||
}
|
||||
|
||||
|
@ -112,12 +112,12 @@ pub fn clone<T: Const Owned>(rc: &ARC<T>) -> ARC<T> {
|
|||
* unwrap from a task that holds another reference to the same ARC; it is
|
||||
* guaranteed to deadlock.
|
||||
*/
|
||||
pub fn unwrap<T: Const Owned>(rc: ARC<T>) -> T {
|
||||
pub fn unwrap<T:Const + Owned>(rc: ARC<T>) -> T {
|
||||
let ARC { x: x } = rc;
|
||||
unsafe { unwrap_shared_mutable_state(x) }
|
||||
}
|
||||
|
||||
impl<T: Const Owned> Clone for ARC<T> {
|
||||
impl<T:Const + Owned> Clone for ARC<T> {
|
||||
fn clone(&self) -> ARC<T> {
|
||||
clone(self)
|
||||
}
|
||||
|
@ -133,14 +133,14 @@ struct MutexARCInner<T> { lock: Mutex, failed: bool, data: T }
|
|||
struct MutexARC<T> { x: SharedMutableState<MutexARCInner<T>> }
|
||||
|
||||
/// Create a mutex-protected ARC with the supplied data.
|
||||
pub fn MutexARC<T: Owned>(user_data: T) -> MutexARC<T> {
|
||||
pub fn MutexARC<T:Owned>(user_data: T) -> MutexARC<T> {
|
||||
mutex_arc_with_condvars(user_data, 1)
|
||||
}
|
||||
/**
|
||||
* Create a mutex-protected ARC with the supplied data and a specified number
|
||||
* of condvars (as sync::mutex_with_condvars).
|
||||
*/
|
||||
pub fn mutex_arc_with_condvars<T: Owned>(user_data: T,
|
||||
pub fn mutex_arc_with_condvars<T:Owned>(user_data: T,
|
||||
num_condvars: uint) -> MutexARC<T> {
|
||||
let data =
|
||||
MutexARCInner { lock: mutex_with_condvars(num_condvars),
|
||||
|
@ -148,7 +148,7 @@ pub fn mutex_arc_with_condvars<T: Owned>(user_data: T,
|
|||
MutexARC { x: unsafe { shared_mutable_state(data) } }
|
||||
}
|
||||
|
||||
impl<T: Owned> Clone for MutexARC<T> {
|
||||
impl<T:Owned> Clone for MutexARC<T> {
|
||||
/// Duplicate a mutex-protected ARC, as arc::clone.
|
||||
fn clone(&self) -> MutexARC<T> {
|
||||
// NB: Cloning the underlying mutex is not necessary. Its reference
|
||||
|
@ -157,7 +157,7 @@ impl<T: Owned> Clone for MutexARC<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Owned> &MutexARC<T> {
|
||||
impl<T:Owned> &MutexARC<T> {
|
||||
|
||||
/**
|
||||
* Access the underlying mutable data with mutual exclusion from other
|
||||
|
@ -219,7 +219,7 @@ impl<T: Owned> &MutexARC<T> {
|
|||
* Will additionally fail if another task has failed while accessing the arc.
|
||||
*/
|
||||
// FIXME(#3724) make this a by-move method on the arc
|
||||
pub fn unwrap_mutex_arc<T: Owned>(arc: MutexARC<T>) -> T {
|
||||
pub fn unwrap_mutex_arc<T:Owned>(arc: MutexARC<T>) -> T {
|
||||
let MutexARC { x: x } = arc;
|
||||
let inner = unsafe { unwrap_shared_mutable_state(x) };
|
||||
let MutexARCInner { failed: failed, data: data, _ } = inner;
|
||||
|
@ -283,14 +283,14 @@ struct RWARC<T> {
|
|||
}
|
||||
|
||||
/// Create a reader/writer ARC with the supplied data.
|
||||
pub fn RWARC<T: Const Owned>(user_data: T) -> RWARC<T> {
|
||||
pub fn RWARC<T:Const + Owned>(user_data: T) -> RWARC<T> {
|
||||
rw_arc_with_condvars(user_data, 1)
|
||||
}
|
||||
/**
|
||||
* Create a reader/writer ARC with the supplied data and a specified number
|
||||
* of condvars (as sync::rwlock_with_condvars).
|
||||
*/
|
||||
pub fn rw_arc_with_condvars<T: Const Owned>(
|
||||
pub fn rw_arc_with_condvars<T:Const + Owned>(
|
||||
user_data: T,
|
||||
num_condvars: uint) -> RWARC<T>
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ pub fn rw_arc_with_condvars<T: Const Owned>(
|
|||
RWARC { x: unsafe { shared_mutable_state(data) }, cant_nest: () }
|
||||
}
|
||||
|
||||
impl<T: Const Owned> RWARC<T> {
|
||||
impl<T:Const + Owned> RWARC<T> {
|
||||
/// Duplicate a rwlock-protected ARC, as arc::clone.
|
||||
fn clone(&self) -> RWARC<T> {
|
||||
RWARC { x: unsafe { clone_shared_mutable_state(&self.x) },
|
||||
|
@ -309,7 +309,7 @@ impl<T: Const Owned> RWARC<T> {
|
|||
|
||||
}
|
||||
|
||||
impl<T: Const Owned> &RWARC<T> {
|
||||
impl<T:Const + Owned> &RWARC<T> {
|
||||
/**
|
||||
* Access the underlying data mutably. Locks the rwlock in write mode;
|
||||
* other readers and writers will block.
|
||||
|
@ -418,7 +418,7 @@ impl<T: Const Owned> &RWARC<T> {
|
|||
* in write mode.
|
||||
*/
|
||||
// FIXME(#3724) make this a by-move method on the arc
|
||||
pub fn unwrap_rw_arc<T: Const Owned>(arc: RWARC<T>) -> T {
|
||||
pub fn unwrap_rw_arc<T:Const + Owned>(arc: RWARC<T>) -> T {
|
||||
let RWARC { x: x, _ } = arc;
|
||||
let inner = unsafe { unwrap_shared_mutable_state(x) };
|
||||
let RWARCInner { failed: failed, data: data, _ } = inner;
|
||||
|
@ -432,7 +432,7 @@ pub fn unwrap_rw_arc<T: Const Owned>(arc: RWARC<T>) -> T {
|
|||
// lock it. This wraps the unsafety, with the justification that the 'lock'
|
||||
// field is never overwritten; only 'failed' and 'data'.
|
||||
#[doc(hidden)]
|
||||
fn borrow_rwlock<T: Const Owned>(state: *const RWARCInner<T>) -> *RWlock {
|
||||
fn borrow_rwlock<T:Const + Owned>(state: *const RWARCInner<T>) -> *RWlock {
|
||||
unsafe { cast::transmute(&const (*state).lock) }
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ pub enum RWWriteMode<T> =
|
|||
/// The "read permission" token used for RWARC.write_downgrade().
|
||||
pub enum RWReadMode<T> = (&T, sync::RWlockReadMode);
|
||||
|
||||
impl<T: Const Owned> &RWWriteMode<T> {
|
||||
impl<T:Const + Owned> &RWWriteMode<T> {
|
||||
/// Access the pre-downgrade RWARC in write mode.
|
||||
fn write<U>(blk: fn(x: &mut T) -> U) -> U {
|
||||
match *self {
|
||||
|
@ -474,7 +474,7 @@ impl<T: Const Owned> &RWWriteMode<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Const Owned> &RWReadMode<T> {
|
||||
impl<T:Const + Owned> &RWReadMode<T> {
|
||||
/// Access the post-downgrade rwlock in read mode.
|
||||
fn read<U>(blk: fn(x: &T) -> U) -> U {
|
||||
match *self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue