@@ -81,7 +81,7 @@ struct ARC<T> { x: SharedMutableState<T> }
81
81
82
82
/// Create an atomically reference counted wrapper.
83
83
pub fn ARC < T : Const Owned > ( data : T ) -> ARC < T > {
84
- ARC { x : unsafe { shared_mutable_state ( move data) } }
84
+ ARC { x : unsafe { shared_mutable_state ( data) } }
85
85
}
86
86
87
87
/**
@@ -113,8 +113,8 @@ pub fn clone<T: Const Owned>(rc: &ARC<T>) -> ARC<T> {
113
113
* guaranteed to deadlock.
114
114
*/
115
115
pub fn unwrap < T : Const Owned > ( rc : ARC < T > ) -> T {
116
- let ARC { x : x } = move rc;
117
- unsafe { unwrap_shared_mutable_state ( move x) }
116
+ let ARC { x : x } = rc;
117
+ unsafe { unwrap_shared_mutable_state ( x) }
118
118
}
119
119
120
120
impl < T : Const Owned > Clone for ARC < T > {
@@ -134,7 +134,7 @@ struct MutexARC<T> { x: SharedMutableState<MutexARCInner<T>> }
134
134
135
135
/// Create a mutex-protected ARC with the supplied data.
136
136
pub fn MutexARC < T : Owned > ( user_data : T ) -> MutexARC < T > {
137
- mutex_arc_with_condvars ( move user_data, 1 )
137
+ mutex_arc_with_condvars ( user_data, 1 )
138
138
}
139
139
/**
140
140
* Create a mutex-protected ARC with the supplied data and a specified number
@@ -144,8 +144,8 @@ pub fn mutex_arc_with_condvars<T: Owned>(user_data: T,
144
144
num_condvars : uint ) -> MutexARC < T > {
145
145
let data =
146
146
MutexARCInner { lock : mutex_with_condvars ( num_condvars) ,
147
- failed : false , data : move user_data } ;
148
- MutexARC { x : unsafe { shared_mutable_state ( move data) } }
147
+ failed : false , data : user_data } ;
148
+ MutexARC { x : unsafe { shared_mutable_state ( data) } }
149
149
}
150
150
151
151
impl < T : Owned > Clone for MutexARC < T > {
@@ -220,13 +220,13 @@ impl<T: Owned> &MutexARC<T> {
220
220
*/
221
221
// FIXME(#3724) make this a by-move method on the arc
222
222
pub fn unwrap_mutex_arc< T : Owned > ( arc : MutexARC < T > ) -> T {
223
- let MutexARC { x : x } = move arc;
224
- let inner = unsafe { unwrap_shared_mutable_state ( move x) } ;
225
- let MutexARCInner { failed : failed, data : data, _ } = move inner;
223
+ let MutexARC { x : x } = arc;
224
+ let inner = unsafe { unwrap_shared_mutable_state ( x) } ;
225
+ let MutexARCInner { failed : failed, data : data, _ } = inner;
226
226
if failed {
227
227
fail ! ( ~"Can ' t unwrap poisoned MutexARC - another task failed inside!")
228
228
}
229
- move data
229
+ data
230
230
}
231
231
232
232
// Common code for {mutex.access,rwlock.write}{,_cond}.
@@ -284,7 +284,7 @@ struct RWARC<T> {
284
284
285
285
/// Create a reader/writer ARC with the supplied data.
286
286
pub fn RWARC<T: Const Owned>(user_data: T) -> RWARC<T> {
287
- rw_arc_with_condvars(move user_data, 1)
287
+ rw_arc_with_condvars(user_data, 1)
288
288
}
289
289
/**
290
290
* Create a reader/writer ARC with the supplied data and a specified number
@@ -296,8 +296,8 @@ pub fn rw_arc_with_condvars<T: Const Owned>(
296
296
{
297
297
let data =
298
298
RWARCInner { lock: rwlock_with_condvars(num_condvars),
299
- failed: false, data: move user_data };
300
- RWARC { x: unsafe { shared_mutable_state(move data) }, cant_nest: () }
299
+ failed: false, data: user_data };
300
+ RWARC { x: unsafe { shared_mutable_state(data) }, cant_nest: () }
301
301
}
302
302
303
303
impl<T: Const Owned> RWARC<T> {
@@ -386,7 +386,7 @@ impl<T: Const Owned> &RWARC<T> {
386
386
do (*borrow_rwlock(state)).write_downgrade |write_mode| {
387
387
check_poison(false, (*state).failed);
388
388
blk(RWWriteMode((&mut (*state).data,
389
- move write_mode,
389
+ write_mode,
390
390
PoisonOnFail(&mut (*state).failed))))
391
391
}
392
392
}
@@ -396,17 +396,17 @@ impl<T: Const Owned> &RWARC<T> {
396
396
fn downgrade(token: RWWriteMode/&a<T>) -> RWReadMode/&a<T> {
397
397
// The rwlock should assert that the token belongs to us for us.
398
398
let state = unsafe { get_shared_immutable_state(&self.x) };
399
- let RWWriteMode((data, t, _poison)) = move token;
399
+ let RWWriteMode((data, t, _poison)) = token;
400
400
// Let readers in
401
- let new_token = (&state.lock).downgrade(move t);
401
+ let new_token = (&state.lock).downgrade(t);
402
402
// Whatever region the input reference had, it will be safe to use
403
403
// the same region for the output reference. (The only 'unsafe' part
404
404
// of this cast is removing the mutability.)
405
405
let new_data = unsafe { cast::transmute_immut(data) };
406
406
// Downgrade ensured the token belonged to us. Just a sanity check.
407
407
assert ptr::ref_eq(&state.data, new_data);
408
408
// Produce new token
409
- RWReadMode((new_data, move new_token))
409
+ RWReadMode((new_data, new_token))
410
410
}
411
411
}
412
412
@@ -419,13 +419,13 @@ impl<T: Const Owned> &RWARC<T> {
419
419
*/
420
420
// FIXME(#3724) make this a by-move method on the arc
421
421
pub fn unwrap_rw_arc<T: Const Owned>(arc: RWARC<T>) -> T {
422
- let RWARC { x: x, _ } = move arc;
423
- let inner = unsafe { unwrap_shared_mutable_state(move x) };
424
- let RWARCInner { failed: failed, data: data, _ } = move inner;
422
+ let RWARC { x: x, _ } = arc;
423
+ let inner = unsafe { unwrap_shared_mutable_state(x) };
424
+ let RWARCInner { failed: failed, data: data, _ } = inner;
425
425
if failed {
426
426
fail!(~" Can ' t unwrap poisoned RWARC - another task failed inside!")
427
427
}
428
- move data
428
+ data
429
429
}
430
430
431
431
// Borrowck rightly complains about immutably aliasing the rwlock in order to
@@ -509,7 +509,7 @@ mod tests {
509
509
510
510
let ( p, c) = pipes:: stream( ) ;
511
511
512
- do task:: spawn( ) |move c | {
512
+ do task:: spawn( ) || {
513
513
let p = pipes:: PortSet ( ) ;
514
514
c. send( p. chan( ) ) ;
515
515
@@ -532,8 +532,8 @@ mod tests {
532
532
let arc = ~MutexARC ( false ) ;
533
533
let arc2 = ~arc. clone( ) ;
534
534
let ( p, c) = pipes:: oneshot( ) ;
535
- let ( c, p) = ( ~mut Some ( move c) , ~mut Some ( move p) ) ;
536
- do task:: spawn |move arc2 , move p | {
535
+ let ( c, p) = ( ~mut Some ( c) , ~mut Some ( p) ) ;
536
+ do task:: spawn || {
537
537
// wait until parent gets in
538
538
pipes:: recv_one( option:: swap_unwrap( p) ) ;
539
539
do arc2. access_cond |state, cond| {
@@ -555,7 +555,7 @@ mod tests {
555
555
let arc2 = ~arc. clone( ) ;
556
556
let ( p, c) = pipes:: stream( ) ;
557
557
558
- do task:: spawn_unlinked |move arc2 , move p | {
558
+ do task:: spawn_unlinked || {
559
559
let _ = p. recv( ) ;
560
560
do arc2. access_cond |one, cond| {
561
561
cond. signal( ) ;
@@ -574,7 +574,7 @@ mod tests {
574
574
pub fn test_mutex_arc_poison( ) {
575
575
let arc = ~MutexARC ( 1 ) ;
576
576
let arc2 = ~arc. clone( ) ;
577
- do task:: try |move arc2 | {
577
+ do task:: try || {
578
578
do arc2. access |one| {
579
579
assert * one == 2 ;
580
580
}
@@ -588,21 +588,21 @@ mod tests {
588
588
let arc = MutexARC ( 1 ) ;
589
589
let arc2 = ~( & arc) . clone( ) ;
590
590
let ( p, c) = pipes:: stream( ) ;
591
- do task:: spawn |move c , move arc2 | {
591
+ do task:: spawn || {
592
592
do arc2. access |one| {
593
593
c. send( ( ) ) ;
594
594
assert * one == 2 ;
595
595
}
596
596
}
597
597
let _ = p. recv( ) ;
598
- let one = unwrap_mutex_arc( move arc) ;
598
+ let one = unwrap_mutex_arc( arc) ;
599
599
assert one == 1 ;
600
600
}
601
601
#[ test] #[ should_fail] #[ ignore( cfg( windows) ) ]
602
602
pub fn test_rw_arc_poison_wr( ) {
603
603
let arc = ~RWARC ( 1 ) ;
604
604
let arc2 = ~arc. clone( ) ;
605
- do task:: try |move arc2 | {
605
+ do task:: try || {
606
606
do arc2. write |one| {
607
607
assert * one == 2 ;
608
608
}
@@ -615,7 +615,7 @@ mod tests {
615
615
pub fn test_rw_arc_poison_ww( ) {
616
616
let arc = ~RWARC ( 1 ) ;
617
617
let arc2 = ~arc. clone( ) ;
618
- do task:: try |move arc2 | {
618
+ do task:: try || {
619
619
do arc2. write |one| {
620
620
assert * one == 2 ;
621
621
}
@@ -628,7 +628,7 @@ mod tests {
628
628
pub fn test_rw_arc_poison_dw( ) {
629
629
let arc = ~RWARC ( 1 ) ;
630
630
let arc2 = ~arc. clone( ) ;
631
- do task:: try |move arc2 | {
631
+ do task:: try || {
632
632
do arc2. write_downgrade |write_mode| {
633
633
do ( & write_mode) . write |one| {
634
634
assert * one == 2 ;
@@ -643,7 +643,7 @@ mod tests {
643
643
pub fn test_rw_arc_no_poison_rr( ) {
644
644
let arc = ~RWARC ( 1 ) ;
645
645
let arc2 = ~arc. clone( ) ;
646
- do task:: try |move arc2 | {
646
+ do task:: try || {
647
647
do arc2. read |one| {
648
648
assert * one == 2 ;
649
649
}
@@ -656,7 +656,7 @@ mod tests {
656
656
pub fn test_rw_arc_no_poison_rw( ) {
657
657
let arc = ~RWARC ( 1 ) ;
658
658
let arc2 = ~arc. clone( ) ;
659
- do task:: try |move arc2 | {
659
+ do task:: try || {
660
660
do arc2. read |one| {
661
661
assert * one == 2 ;
662
662
}
@@ -669,9 +669,9 @@ mod tests {
669
669
pub fn test_rw_arc_no_poison_dr( ) {
670
670
let arc = ~RWARC ( 1 ) ;
671
671
let arc2 = ~arc. clone( ) ;
672
- do task:: try |move arc2 | {
672
+ do task:: try || {
673
673
do arc2. write_downgrade |write_mode| {
674
- let read_mode = arc2. downgrade( move write_mode) ;
674
+ let read_mode = arc2. downgrade( write_mode) ;
675
675
do ( & read_mode) . read |one| {
676
676
assert * one == 2 ;
677
677
}
@@ -687,7 +687,7 @@ mod tests {
687
687
let arc2 = ~arc. clone( ) ;
688
688
let ( p, c) = pipes:: stream( ) ;
689
689
690
- do task:: spawn |move arc2 , move c | {
690
+ do task:: spawn || {
691
691
do arc2. write |num| {
692
692
for 10 . times {
693
693
let tmp = * num;
@@ -703,8 +703,8 @@ mod tests {
703
703
let mut children = ~[ ] ;
704
704
for 5 . times {
705
705
let arc3 = ~arc. clone( ) ;
706
- do task:: task( ) . future_result( |+r| children. push( move r) ) . spawn
707
- |move arc3 | {
706
+ do task:: task( ) . future_result( |+r| children. push( r) ) . spawn
707
+ || {
708
708
do arc3. read |num| {
709
709
assert * num >= 0 ;
710
710
}
@@ -732,9 +732,9 @@ mod tests {
732
732
let mut reader_convos = ~[ ] ;
733
733
for 10 . times {
734
734
let ( ( rp1, rc1) , ( rp2, rc2) ) = ( pipes:: stream( ) , pipes:: stream( ) ) ;
735
- reader_convos. push( ( move rc1, move rp2) ) ;
735
+ reader_convos. push( ( rc1, rp2) ) ;
736
736
let arcn = ~arc. clone( ) ;
737
- do task:: spawn |move rp1 , move rc2 , move arcn | {
737
+ do task:: spawn || {
738
738
rp1. recv( ) ; // wait for downgrader to give go-ahead
739
739
do arcn. read |state| {
740
740
assert * state == 31337 ;
@@ -746,7 +746,7 @@ mod tests {
746
746
// Writer task
747
747
let arc2 = ~arc. clone( ) ;
748
748
let ( ( wp1, wc1) , ( wp2, wc2) ) = ( pipes:: stream( ) , pipes:: stream( ) ) ;
749
- do task:: spawn |move arc2 , move wc2 , move wp1 | {
749
+ do task:: spawn || {
750
750
wp1. recv( ) ;
751
751
do arc2. write_cond |state, cond| {
752
752
assert * state == 0 ;
@@ -779,7 +779,7 @@ mod tests {
779
779
}
780
780
}
781
781
}
782
- let read_mode = arc. downgrade( move write_mode) ;
782
+ let read_mode = arc. downgrade( write_mode) ;
783
783
do ( & read_mode) . read |state| {
784
784
// complete handshake with other readers
785
785
for vec:: each( reader_convos) |x| {
0 commit comments