Skip to content

Commit 11e92f3

Browse files
committed
Remove uses of binary move - <- - from tests and libraries
1 parent 804c608 commit 11e92f3

Some content is hidden

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

69 files changed

+151
-136
lines changed

src/fuzzer/ivec_fuzz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Idea: provide functions for 'exhaustive' and 'random' modification of vecs.
44
5-
two functions, "return all edits" and "return a random edit" <--
5+
two functions, "return all edits" and "return a random edit" = move-
66
leaning toward this model or two functions, "return the number of
77
possible edits" and "return edit #n"
88

src/libcore/dvec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn from_vec<A>(v: ~[A]) -> DVec<A> {
7272

7373
/// Consumes the vector and returns its contents
7474
pub fn unwrap<A>(d: DVec<A>) -> ~[A] {
75-
let DVec_({data: v}) <- d;
75+
let DVec_({data: v}) = move d;
7676
move v
7777
}
7878

@@ -150,13 +150,13 @@ impl<A> DVec<A> {
150150
/// Overwrite the current contents
151151
fn set(w: ~[A]) {
152152
self.check_not_borrowed();
153-
self.data <- w;
153+
self.data = move w;
154154
}
155155

156156
/// Remove and return the last element
157157
fn pop() -> A {
158158
do self.check_out |v| {
159-
let mut v <- v;
159+
let mut v = move v;
160160
let result = v.pop();
161161
self.give_back(move v);
162162
move result
@@ -171,7 +171,7 @@ impl<A> DVec<A> {
171171
let data_ptr: *() = cast::reinterpret_cast(&data);
172172
if data_ptr.is_null() { fail ~"Recursive use of dvec"; }
173173
log(error, ~"a");
174-
self.data <- ~[move t];
174+
self.data = move ~[move t];
175175
self.data.push_all_move(move data);
176176
log(error, ~"b");
177177
}
@@ -235,7 +235,7 @@ impl<A: Copy> DVec<A> {
235235
/// Appends elements from `from_idx` to `to_idx` (exclusive)
236236
fn push_slice(ts: &[const A], from_idx: uint, to_idx: uint) {
237237
do self.swap |v| {
238-
let mut v <- v;
238+
let mut v = move v;
239239
let new_len = vec::len(v) + to_idx - from_idx;
240240
vec::reserve(&mut v, new_len);
241241
let mut i = from_idx;
@@ -260,7 +260,7 @@ impl<A: Copy> DVec<A> {
260260
none { v }
261261
Some(h) {
262262
let len = v.len() + h;
263-
let mut v <- v;
263+
let mut v = move v;
264264
vec::reserve(v, len);
265265
v
266266
}

src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ pub struct BytesWriter {
698698
impl BytesWriter: Writer {
699699
fn write(v: &[const u8]) {
700700
do self.bytes.swap |bytes| {
701-
let mut bytes <- bytes;
701+
let mut bytes = move bytes;
702702
let v_len = v.len();
703703
let bytes_len = bytes.len();
704704

src/libcore/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub pure fn flat_map_to_vec<A:Copy,B:Copy,IA:BaseIter<A>,IB:BaseIter<B>>(
128128
pub pure fn foldl<A,B,IA:BaseIter<A>>(self: &IA, b0: B,
129129
blk: fn(&B, &A) -> B)
130130
-> B {
131-
let mut b <- b0;
131+
let mut b = move b0;
132132
for self.each |a| {
133133
b = blk(&b, a);
134134
}

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub pure fn or<T>(opta: Option<T>, optb: Option<T>) -> Option<T> {
149149
pub pure fn while_some<T>(x: Option<T>, blk: fn(v: T) -> Option<T>) {
150150
//! Applies a function zero or more times until the result is none.
151151
152-
let mut opt <- x;
152+
let mut opt = move x;
153153
while opt.is_some() {
154154
opt = blk(unwrap(move opt));
155155
}

src/libcore/pipes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ use option::unwrap;
8686
const SPIN_COUNT: uint = 0;
8787

8888
macro_rules! move_it (
89-
{ $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); move y } }
89+
{ $x:expr } => { unsafe { let y = move *ptr::addr_of(&($x)); move y } }
9090
)
9191

9292
#[doc(hidden)]
@@ -363,7 +363,7 @@ pub fn send<T: Send, Tbuffer: Send>(p: SendPacketBuffered<T, Tbuffer>,
363363
let p = unsafe { &*p_ };
364364
assert ptr::addr_of(&(p.header)) == header;
365365
assert p.payload.is_none();
366-
p.payload <- Some(move payload);
366+
p.payload = move Some(move payload);
367367
let old_state = swap_state_rel(&mut p.header.state, Full);
368368
match old_state {
369369
Empty => {
@@ -708,7 +708,7 @@ pub fn select<T: Send, Tb: Send>(endpoints: ~[RecvPacketBuffered<T, Tb>])
708708
-> (uint, Option<T>, ~[RecvPacketBuffered<T, Tb>])
709709
{
710710
let ready = wait_many(endpoints.map(|p| p.header()));
711-
let mut remaining <- endpoints;
711+
let mut remaining = move endpoints;
712712
let port = remaining.swap_remove(ready);
713713
let result = try_recv(move port);
714714
(ready, move result, move remaining)

src/libcore/private.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,9 @@ impl<T: Send> Exclusive<T> {
562562

563563
// FIXME(#3724) make this a by-move method on the exclusive
564564
pub fn unwrap_exclusive<T: Send>(arc: Exclusive<T>) -> T {
565-
let Exclusive { x: x } <- arc;
565+
let Exclusive { x: x } = move arc;
566566
let inner = unsafe { unwrap_shared_mutable_state(move x) };
567-
let ExData { data: data, _ } <- inner;
567+
let ExData { data: data, _ } = move inner;
568568
move data
569569
}
570570

src/libcore/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub fn push_str(lhs: &mut ~str, rhs: &str) {
176176
/// Concatenate two strings together
177177
#[inline(always)]
178178
pub pure fn append(lhs: ~str, rhs: &str) -> ~str {
179-
let mut v <- lhs;
179+
let mut v = move lhs;
180180
unsafe {
181181
push_str_no_overallocate(&mut v, rhs);
182182
}

src/libcore/task/spawn.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use rt::rust_task;
6767
use rt::rust_closure;
6868

6969
macro_rules! move_it (
70-
{ $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); move y } }
70+
{ $x:expr } => { unsafe { let y = move *ptr::addr_of(&($x)); move y } }
7171
)
7272

7373
type TaskSet = send_map::linear::LinearMap<*rust_task,()>;
@@ -168,10 +168,10 @@ fn each_ancestor(list: &mut AncestorList,
168168
if coalesce_this.is_some() {
169169
// Needed coalesce. Our next ancestor becomes our old
170170
// ancestor's next ancestor. ("next = old_next->next;")
171-
*list <- option::unwrap(move coalesce_this);
171+
*list = move option::unwrap(move coalesce_this);
172172
} else {
173173
// No coalesce; restore from tmp. ("next = old_next;")
174-
*list <- tmp_list;
174+
*list = move tmp_list;
175175
}
176176
return early_break;
177177
}
@@ -265,7 +265,7 @@ fn each_ancestor(list: &mut AncestorList,
265265
// If this trips, more likely the problem is 'blk' failed inside.
266266
let tmp_arc = option::swap_unwrap(parent_group);
267267
let result = do access_group(&tmp_arc) |tg_opt| { blk(tg_opt) };
268-
*parent_group <- Some(move tmp_arc);
268+
*parent_group = move Some(move tmp_arc);
269269
move result
270270
}
271271
}
@@ -480,7 +480,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
480480
if tmp.is_some() {
481481
let ancestor_arc = option::unwrap(move tmp);
482482
let result = ancestor_arc.clone();
483-
**ancestors <- Some(move ancestor_arc);
483+
**ancestors = move Some(move ancestor_arc);
484484
AncestorList(Some(move result))
485485
} else {
486486
AncestorList(None)

src/libcore/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
5151
*/
5252
#[inline(always)]
5353
pub fn replace<T>(dest: &mut T, src: T) -> T {
54-
let mut tmp <- src;
54+
let mut tmp = move src;
5555
swap(dest, &mut tmp);
5656
move tmp
5757
}

src/libcore/vec.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,10 @@ pub fn shift<T>(v: &mut ~[T]) -> T {
399399
let mut rr;
400400
{
401401
let vv = raw::to_ptr(vv);
402-
rr <- *vv;
402+
rr = move *vv;
403403

404404
for uint::range(1, ln) |i| {
405-
let r <- *ptr::offset(vv, i);
405+
let r = move *ptr::offset(vv, i);
406406
v.push(move r);
407407
}
408408
}
@@ -424,7 +424,7 @@ pub fn consume<T>(v: ~[T], f: fn(uint, v: T)) unsafe {
424424

425425
do as_imm_buf(v) |p, ln| {
426426
for uint::range(0, ln) |i| {
427-
let x <- *ptr::offset(p, i);
427+
let x = move *ptr::offset(p, i);
428428
f(i, move x);
429429
}
430430
}
@@ -515,7 +515,7 @@ pub fn push_all_move<T>(v: &mut ~[T], rhs: ~[T]) {
515515
unsafe {
516516
do as_imm_buf(rhs) |p, len| {
517517
for uint::range(0, len) |i| {
518-
let x <- *ptr::offset(p, i);
518+
let x = move *ptr::offset(p, i);
519519
push(v, move x);
520520
}
521521
}
@@ -530,7 +530,7 @@ pub fn truncate<T>(v: &mut ~[T], newlen: uint) {
530530
unsafe {
531531
// This loop is optimized out for non-drop types.
532532
for uint::range(newlen, oldlen) |i| {
533-
let _dropped <- *ptr::offset(p, i);
533+
let _dropped = move *ptr::offset(p, i);
534534
}
535535
raw::set_len(v, newlen);
536536
}
@@ -553,12 +553,12 @@ pub fn dedup<T: Eq>(v: &mut ~[T]) unsafe {
553553
// last_written < next_to_read < ln
554554
if *ptr::mut_offset(p, next_to_read) ==
555555
*ptr::mut_offset(p, last_written) {
556-
let _dropped <- *ptr::mut_offset(p, next_to_read);
556+
let _dropped = move *ptr::mut_offset(p, next_to_read);
557557
} else {
558558
last_written += 1;
559559
// last_written <= next_to_read < ln
560560
if next_to_read != last_written {
561-
*ptr::mut_offset(p, last_written) <-
561+
*ptr::mut_offset(p, last_written) = move
562562
*ptr::mut_offset(p, next_to_read);
563563
}
564564
}
@@ -575,7 +575,7 @@ pub fn dedup<T: Eq>(v: &mut ~[T]) unsafe {
575575
// Appending
576576
#[inline(always)]
577577
pub pure fn append<T: Copy>(lhs: ~[T], rhs: &[const T]) -> ~[T] {
578-
let mut v <- lhs;
578+
let mut v = move lhs;
579579
unsafe {
580580
v.push_all(rhs);
581581
}
@@ -584,7 +584,7 @@ pub pure fn append<T: Copy>(lhs: ~[T], rhs: &[const T]) -> ~[T] {
584584

585585
#[inline(always)]
586586
pub pure fn append_one<T>(lhs: ~[T], x: T) -> ~[T] {
587-
let mut v <- lhs;
587+
let mut v = move lhs;
588588
unsafe { v.push(move x); }
589589
move v
590590
}
@@ -1052,9 +1052,9 @@ pub fn swap<T>(v: &[mut T], a: uint, b: uint) {
10521052

10531053
/// Reverse the order of elements in a vector, in place
10541054
pub fn reverse<T>(v: &[mut T]) {
1055-
let mut i: uint = 0u;
1055+
let mut i: uint = 0;
10561056
let ln = len::<T>(v);
1057-
while i < ln / 2u { v[i] <-> v[ln - i - 1u]; i += 1u; }
1057+
while i < ln / 2 { v[i] <-> v[ln - i - 1]; i += 1; }
10581058
}
10591059

10601060
/// Returns a vector with the order of elements reversed

src/libstd/arc.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn clone<T: Const Send>(rc: &ARC<T>) -> ARC<T> {
9999
* guaranteed to deadlock.
100100
*/
101101
fn unwrap<T: Const Send>(rc: ARC<T>) -> T {
102-
let ARC { x: x } <- rc;
102+
let ARC { x: x } = move rc;
103103
unsafe { unwrap_shared_mutable_state(move x) }
104104
}
105105

@@ -192,9 +192,9 @@ impl<T: Send> &MutexARC<T> {
192192
*/
193193
// FIXME(#3724) make this a by-move method on the arc
194194
pub fn unwrap_mutex_arc<T: Send>(arc: MutexARC<T>) -> T {
195-
let MutexARC { x: x } <- arc;
195+
let MutexARC { x: x } = move arc;
196196
let inner = unsafe { unwrap_shared_mutable_state(move x) };
197-
let MutexARCInner { failed: failed, data: data, _ } <- inner;
197+
let MutexARCInner { failed: failed, data: data, _ } = move inner;
198198
if failed {
199199
fail ~"Can't unwrap poisoned MutexARC - another task failed inside!"
200200
}
@@ -347,7 +347,7 @@ impl<T: Const Send> &RWARC<T> {
347347
fn downgrade(token: RWWriteMode/&a<T>) -> RWReadMode/&a<T> {
348348
// The rwlock should assert that the token belongs to us for us.
349349
let state = unsafe { get_shared_immutable_state(&self.x) };
350-
let RWWriteMode((data, t, _poison)) <- token;
350+
let RWWriteMode((data, t, _poison)) = move token;
351351
// Let readers in
352352
let new_token = (&state.lock).downgrade(move t);
353353
// Whatever region the input reference had, it will be safe to use
@@ -370,9 +370,9 @@ impl<T: Const Send> &RWARC<T> {
370370
*/
371371
// FIXME(#3724) make this a by-move method on the arc
372372
pub fn unwrap_rw_arc<T: Const Send>(arc: RWARC<T>) -> T {
373-
let RWARC { x: x, _ } <- arc;
373+
let RWARC { x: x, _ } = move arc;
374374
let inner = unsafe { unwrap_shared_mutable_state(move x) };
375-
let RWARCInner { failed: failed, data: data, _ } <- inner;
375+
let RWARCInner { failed: failed, data: data, _ } = move inner;
376376
if failed {
377377
fail ~"Can't unwrap poisoned RWARC - another task failed inside!"
378378
}

src/libstd/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub mod chained {
173173
entry.next = new_chains[idx];
174174
new_chains[idx] = Some(entry);
175175
}
176-
self.chains <- new_chains;
176+
self.chains = move new_chains;
177177
}
178178

179179
pure fn each_entry(blk: fn(@Entry<K,V>) -> bool) {

0 commit comments

Comments
 (0)