Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c096f7d

Browse files
committedJun 10, 2013
librustc: Change "Owned" to "Send" everywhere
1 parent c8bce58 commit c096f7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+221
-221
lines changed
 

‎src/libextra/arc.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ impl<'self> Condvar<'self> {
112112
pub struct ARC<T> { x: UnsafeAtomicRcBox<T> }
113113

114114
/// Create an atomically reference counted wrapper.
115-
pub fn ARC<T:Freeze + Owned>(data: T) -> ARC<T> {
115+
pub fn ARC<T:Freeze + Send>(data: T) -> ARC<T> {
116116
ARC { x: UnsafeAtomicRcBox::new(data) }
117117
}
118118

119119
/**
120120
* Access the underlying data in an atomically reference counted
121121
* wrapper.
122122
*/
123-
impl<T:Freeze+Owned> ARC<T> {
123+
impl<T:Freeze+Send> ARC<T> {
124124
pub fn get<'a>(&'a self) -> &'a T {
125125
unsafe { &*self.x.get_immut() }
126126
}
@@ -133,7 +133,7 @@ impl<T:Freeze+Owned> ARC<T> {
133133
* object. However, one of the `arc` objects can be sent to another task,
134134
* allowing them to share the underlying data.
135135
*/
136-
impl<T:Freeze + Owned> Clone for ARC<T> {
136+
impl<T:Freeze + Send> Clone for ARC<T> {
137137
fn clone(&self) -> ARC<T> {
138138
ARC { x: self.x.clone() }
139139
}
@@ -149,22 +149,22 @@ struct MutexARCInner<T> { lock: Mutex, failed: bool, data: T }
149149
struct MutexARC<T> { x: UnsafeAtomicRcBox<MutexARCInner<T>> }
150150

151151
/// Create a mutex-protected ARC with the supplied data.
152-
pub fn MutexARC<T:Owned>(user_data: T) -> MutexARC<T> {
152+
pub fn MutexARC<T:Send>(user_data: T) -> MutexARC<T> {
153153
mutex_arc_with_condvars(user_data, 1)
154154
}
155155
/**
156156
* Create a mutex-protected ARC with the supplied data and a specified number
157157
* of condvars (as sync::mutex_with_condvars).
158158
*/
159-
pub fn mutex_arc_with_condvars<T:Owned>(user_data: T,
159+
pub fn mutex_arc_with_condvars<T:Send>(user_data: T,
160160
num_condvars: uint) -> MutexARC<T> {
161161
let data =
162162
MutexARCInner { lock: mutex_with_condvars(num_condvars),
163163
failed: false, data: user_data };
164164
MutexARC { x: UnsafeAtomicRcBox::new(data) }
165165
}
166166

167-
impl<T:Owned> Clone for MutexARC<T> {
167+
impl<T:Send> Clone for MutexARC<T> {
168168
/// Duplicate a mutex-protected ARC, as arc::clone.
169169
fn clone(&self) -> MutexARC<T> {
170170
// NB: Cloning the underlying mutex is not necessary. Its reference
@@ -173,7 +173,7 @@ impl<T:Owned> Clone for MutexARC<T> {
173173
}
174174
}
175175

176-
impl<T:Owned> MutexARC<T> {
176+
impl<T:Send> MutexARC<T> {
177177

178178
/**
179179
* Access the underlying mutable data with mutual exclusion from other
@@ -285,14 +285,14 @@ struct RWARC<T> {
285285
}
286286

287287
/// Create a reader/writer ARC with the supplied data.
288-
pub fn RWARC<T:Freeze + Owned>(user_data: T) -> RWARC<T> {
288+
pub fn RWARC<T:Freeze + Send>(user_data: T) -> RWARC<T> {
289289
rw_arc_with_condvars(user_data, 1)
290290
}
291291
/**
292292
* Create a reader/writer ARC with the supplied data and a specified number
293293
* of condvars (as sync::rwlock_with_condvars).
294294
*/
295-
pub fn rw_arc_with_condvars<T:Freeze + Owned>(
295+
pub fn rw_arc_with_condvars<T:Freeze + Send>(
296296
user_data: T,
297297
num_condvars: uint) -> RWARC<T>
298298
{
@@ -302,7 +302,7 @@ pub fn rw_arc_with_condvars<T:Freeze + Owned>(
302302
RWARC { x: UnsafeAtomicRcBox::new(data), cant_nest: () }
303303
}
304304

305-
impl<T:Freeze + Owned> RWARC<T> {
305+
impl<T:Freeze + Send> RWARC<T> {
306306
/// Duplicate a rwlock-protected ARC, as arc::clone.
307307
pub fn clone(&self) -> RWARC<T> {
308308
RWARC {
@@ -313,7 +313,7 @@ impl<T:Freeze + Owned> RWARC<T> {
313313

314314
}
315315

316-
impl<T:Freeze + Owned> RWARC<T> {
316+
impl<T:Freeze + Send> RWARC<T> {
317317
/**
318318
* Access the underlying data mutably. Locks the rwlock in write mode;
319319
* other readers and writers will block.
@@ -439,7 +439,7 @@ impl<T:Freeze + Owned> RWARC<T> {
439439
// lock it. This wraps the unsafety, with the justification that the 'lock'
440440
// field is never overwritten; only 'failed' and 'data'.
441441
#[doc(hidden)]
442-
fn borrow_rwlock<T:Freeze + Owned>(state: *const RWARCInner<T>) -> *RWlock {
442+
fn borrow_rwlock<T:Freeze + Send>(state: *const RWARCInner<T>) -> *RWlock {
443443
unsafe { cast::transmute(&const (*state).lock) }
444444
}
445445

@@ -456,7 +456,7 @@ pub struct RWReadMode<'self, T> {
456456
token: sync::RWlockReadMode<'self>,
457457
}
458458

459-
impl<'self, T:Freeze + Owned> RWWriteMode<'self, T> {
459+
impl<'self, T:Freeze + Send> RWWriteMode<'self, T> {
460460
/// Access the pre-downgrade RWARC in write mode.
461461
pub fn write<U>(&mut self, blk: &fn(x: &mut T) -> U) -> U {
462462
match *self {
@@ -497,7 +497,7 @@ impl<'self, T:Freeze + Owned> RWWriteMode<'self, T> {
497497
}
498498
}
499499

500-
impl<'self, T:Freeze + Owned> RWReadMode<'self, T> {
500+
impl<'self, T:Freeze + Send> RWReadMode<'self, T> {
501501
/// Access the post-downgrade rwlock in read mode.
502502
pub fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
503503
match *self {

‎src/libextra/comm.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub struct DuplexStream<T, U> {
3030
}
3131

3232
// Allow these methods to be used without import:
33-
impl<T:Owned,U:Owned> DuplexStream<T, U> {
33+
impl<T:Send,U:Send> DuplexStream<T, U> {
3434
pub fn send(&self, x: T) {
3535
self.chan.send(x)
3636
}
@@ -48,19 +48,19 @@ impl<T:Owned,U:Owned> DuplexStream<T, U> {
4848
}
4949
}
5050

51-
impl<T:Owned,U:Owned> GenericChan<T> for DuplexStream<T, U> {
51+
impl<T:Send,U:Send> GenericChan<T> for DuplexStream<T, U> {
5252
fn send(&self, x: T) {
5353
self.chan.send(x)
5454
}
5555
}
5656

57-
impl<T:Owned,U:Owned> GenericSmartChan<T> for DuplexStream<T, U> {
57+
impl<T:Send,U:Send> GenericSmartChan<T> for DuplexStream<T, U> {
5858
fn try_send(&self, x: T) -> bool {
5959
self.chan.try_send(x)
6060
}
6161
}
6262

63-
impl<T:Owned,U:Owned> GenericPort<U> for DuplexStream<T, U> {
63+
impl<T:Send,U:Send> GenericPort<U> for DuplexStream<T, U> {
6464
fn recv(&self) -> U {
6565
self.port.recv()
6666
}
@@ -70,20 +70,20 @@ impl<T:Owned,U:Owned> GenericPort<U> for DuplexStream<T, U> {
7070
}
7171
}
7272

73-
impl<T:Owned,U:Owned> Peekable<U> for DuplexStream<T, U> {
73+
impl<T:Send,U:Send> Peekable<U> for DuplexStream<T, U> {
7474
fn peek(&self) -> bool {
7575
self.port.peek()
7676
}
7777
}
7878

79-
impl<T:Owned,U:Owned> Selectable for DuplexStream<T, U> {
79+
impl<T:Send,U:Send> Selectable for DuplexStream<T, U> {
8080
fn header(&mut self) -> *mut pipes::PacketHeader {
8181
self.port.header()
8282
}
8383
}
8484

8585
/// Creates a bidirectional stream.
86-
pub fn DuplexStream<T:Owned,U:Owned>()
86+
pub fn DuplexStream<T:Send,U:Send>()
8787
-> (DuplexStream<T, U>, DuplexStream<U, T>)
8888
{
8989
let (p1, c2) = comm::stream();

0 commit comments

Comments
 (0)
Please sign in to comment.