@@ -54,6 +54,9 @@ use std::kinds::marker;
54
54
use std:: sync:: arc:: UnsafeArc ;
55
55
use std:: task;
56
56
57
+ #[ cfg( stage0) ]
58
+ use std:: kinds:: Share ;
59
+
57
60
/// As sync::condvar, a mechanism for unlock-and-descheduling and
58
61
/// signaling, for use with the Arc types.
59
62
pub struct ArcCondvar < ' a > {
@@ -122,7 +125,7 @@ pub struct Arc<T> { priv x: UnsafeArc<T> }
122
125
* Access the underlying data in an atomically reference counted
123
126
* wrapper.
124
127
*/
125
- impl < T : Freeze + Send > Arc < T > {
128
+ impl < T : Share + Send > Arc < T > {
126
129
/// Create an atomically reference counted wrapper.
127
130
#[ inline]
128
131
pub fn new ( data : T ) -> Arc < T > {
@@ -135,7 +138,7 @@ impl<T:Freeze+Send> Arc<T> {
135
138
}
136
139
}
137
140
138
- impl < T : Freeze + Send > Clone for Arc < T > {
141
+ impl < T : Share + Send > Clone for Arc < T > {
139
142
/**
140
143
* Duplicate an atomically reference counted wrapper.
141
144
*
@@ -295,19 +298,21 @@ struct RWArcInner<T> { lock: RWLock, failed: bool, data: T }
295
298
pub struct RWArc < T > {
296
299
priv x: UnsafeArc < RWArcInner < T > > ,
297
300
priv marker : marker:: NoFreeze ,
301
+ priv marker1 : marker:: NoShare ,
298
302
}
299
303
300
- impl < T : Freeze + Send > Clone for RWArc < T > {
304
+ impl < T : Share + Send > Clone for RWArc < T > {
301
305
/// Duplicate a rwlock-protected Arc. See arc::clone for more details.
302
306
#[ inline]
303
307
fn clone ( & self ) -> RWArc < T > {
304
308
RWArc { x : self . x . clone ( ) ,
305
- marker : marker:: NoFreeze , }
309
+ marker : marker:: NoFreeze ,
310
+ marker1 : marker:: NoShare , }
306
311
}
307
312
308
313
}
309
314
310
- impl < T : Freeze + Send > RWArc < T > {
315
+ impl < T : Share + Send > RWArc < T > {
311
316
/// Create a reader/writer Arc with the supplied data.
312
317
pub fn new ( user_data : T ) -> RWArc < T > {
313
318
RWArc :: new_with_condvars ( user_data, 1 )
@@ -323,7 +328,8 @@ impl<T:Freeze + Send> RWArc<T> {
323
328
failed : false , data : user_data
324
329
} ;
325
330
RWArc { x : UnsafeArc :: new ( data) ,
326
- marker : marker:: NoFreeze , }
331
+ marker : marker:: NoFreeze ,
332
+ marker1 : marker:: NoShare , }
327
333
}
328
334
329
335
/**
@@ -454,7 +460,7 @@ impl<T:Freeze + Send> RWArc<T> {
454
460
// lock it. This wraps the unsafety, with the justification that the 'lock'
455
461
// field is never overwritten; only 'failed' and 'data'.
456
462
#[ doc( hidden) ]
457
- fn borrow_rwlock < T : Freeze + Send > ( state : * mut RWArcInner < T > ) -> * RWLock {
463
+ fn borrow_rwlock < T : Share + Send > ( state : * mut RWArcInner < T > ) -> * RWLock {
458
464
unsafe { cast:: transmute ( & ( * state) . lock ) }
459
465
}
460
466
@@ -471,7 +477,7 @@ pub struct RWReadMode<'a, T> {
471
477
priv token : sync:: RWLockReadMode < ' a > ,
472
478
}
473
479
474
- impl < ' a , T : Freeze + Send > RWWriteMode < ' a , T > {
480
+ impl < ' a , T : Share + Send > RWWriteMode < ' a , T > {
475
481
/// Access the pre-downgrade RWArc in write mode.
476
482
pub fn write < U > ( & mut self , blk: |x: & mut T | -> U ) -> U {
477
483
match * self {
@@ -510,7 +516,7 @@ impl<'a, T:Freeze + Send> RWWriteMode<'a, T> {
510
516
}
511
517
}
512
518
513
- impl < ' a , T : Freeze + Send > RWReadMode < ' a , T > {
519
+ impl < ' a , T : Share + Send > RWReadMode < ' a , T > {
514
520
/// Access the post-downgrade rwlock in read mode.
515
521
pub fn read < U > ( & self , blk: |x: & T | -> U ) -> U {
516
522
match * self {
@@ -534,7 +540,7 @@ pub struct CowArc<T> { priv x: UnsafeArc<T> }
534
540
/// mutation of the contents if there is only a single reference to
535
541
/// the data. If there are multiple references the data is automatically
536
542
/// cloned and the task modifies the cloned data in place of the shared data.
537
- impl < T : Clone + Send + Freeze > CowArc < T > {
543
+ impl < T : Clone + Send + Share > CowArc < T > {
538
544
/// Create a copy-on-write atomically reference counted wrapper
539
545
#[ inline]
540
546
pub fn new ( data : T ) -> CowArc < T > {
@@ -558,7 +564,7 @@ impl<T:Clone+Send+Freeze> CowArc<T> {
558
564
}
559
565
}
560
566
561
- impl < T : Clone + Send + Freeze > Clone for CowArc < T > {
567
+ impl < T : Clone + Send + Share > Clone for CowArc < T > {
562
568
/// Duplicate a Copy-on-write Arc. See arc::clone for more details.
563
569
fn clone ( & self ) -> CowArc < T > {
564
570
CowArc { x : self . x . clone ( ) }
0 commit comments