Skip to content

Commit 4cc324e

Browse files
---
yaml --- r: 69599 b: refs/heads/auto c: 2047026 h: refs/heads/master i: 69597: b48d07a 69595: 46d693d 69591: 01af67a 69583: d06db76 69567: 65f9565 v: v3
1 parent 072aad9 commit 4cc324e

File tree

165 files changed

+4005
-1557
lines changed

Some content is hidden

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

165 files changed

+4005
-1557
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: bbcce8d95c582d3f918fe4e978d6a715efd991e9
17+
refs/heads/auto: 2047026fefa38773ecdb046998a65ca1e1dc9cef
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/doc/rust.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2386,8 +2386,9 @@ foreach e in v.iter() {
23862386
An example of a for loop over a series of integers:
23872387

23882388
~~~~
2389+
# use std::uint;
23892390
# fn bar(b:uint) { }
2390-
foreach i in range(0u, 256) {
2391+
for uint::range(0, 256) |i| {
23912392
bar(i);
23922393
}
23932394
~~~~

branches/auto/doc/tutorial-tasks.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ should interleave the output in vaguely random order.
120120
~~~
121121
# use std::io::print;
122122
# use std::task::spawn;
123+
# use std::int;
123124
124-
foreach child_task_number in range(0, 20) {
125+
for int::range(0, 20) |child_task_number| {
125126
do spawn {
126127
print(fmt!("I am child number %d\n", child_task_number));
127128
}
@@ -236,11 +237,12 @@ Instead we can use a `SharedChan`, a type that allows a single
236237
~~~
237238
# use std::task::spawn;
238239
# use std::comm::{stream, SharedChan};
240+
# use std::uint;
239241
240242
let (port, chan) = stream();
241243
let chan = SharedChan::new(chan);
242244
243-
foreach init_val in range(0u, 3) {
245+
for uint::range(0, 3) |init_val| {
244246
// Create a new channel handle to distribute to the child task
245247
let child_chan = chan.clone();
246248
do spawn {
@@ -312,9 +314,10 @@ Here is another example showing how futures allow you to background computations
312314
be distributed on the available cores.
313315
~~~
314316
# use std::vec;
317+
# use std::uint;
315318
fn partial_sum(start: uint) -> f64 {
316319
let mut local_sum = 0f64;
317-
foreach num in range(start*100000, (start+1)*100000) {
320+
for uint::range(start*100000, (start+1)*100000) |num| {
318321
local_sum += (num as f64 + 1.0).pow(&-2.0);
319322
}
320323
local_sum
@@ -346,6 +349,7 @@ Here is a small example showing how to use Arcs. We wish to run concurrently sev
346349
a single large vector of floats. Each task needs the full vector to perform its duty.
347350
~~~
348351
# use std::vec;
352+
# use std::uint;
349353
# use std::rand;
350354
use extra::arc::Arc;
351355
@@ -359,7 +363,7 @@ fn main() {
359363
360364
let numbers_arc = Arc::new(numbers);
361365
362-
foreach num in range(1u, 10) {
366+
for uint::range(1,10) |num| {
363367
let (port, chan) = stream();
364368
chan.send(numbers_arc.clone());
365369

branches/auto/src/compiletest/runtest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use util::logv;
2323
use std::io;
2424
use std::os;
2525
use std::str;
26+
use std::uint;
2627
use std::vec;
2728

2829
use extra::test::MetricMap;
@@ -413,7 +414,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
413414
}
414415
}
415416

416-
foreach i in range(0u, found_flags.len()) {
417+
for uint::range(0u, found_flags.len()) |i| {
417418
if !found_flags[i] {
418419
let ee = &expected_errors[i];
419420
fatal_ProcRes(fmt!("expected %s on line %u not found: %s",

branches/auto/src/libextra/arc.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ mod tests {
566566
use std::cell::Cell;
567567
use std::comm;
568568
use std::task;
569+
use std::uint;
569570
570571
#[test]
571572
fn manually_share_arc() {
@@ -850,7 +851,7 @@ mod tests {
850851
*state = 31337;
851852
// FIXME: #7372: hits type inference bug with iterators
852853
// send to other readers
853-
foreach i in range(0u, reader_convos.len()) {
854+
for uint::range(0, reader_convos.len()) |i| {
854855
match reader_convos[i] {
855856
(ref rc, _) => rc.send(()),
856857
}
@@ -860,7 +861,7 @@ mod tests {
860861
do (&read_mode).read |state| {
861862
// FIXME: #7372: hits type inference bug with iterators
862863
// complete handshake with other readers
863-
foreach i in range(0u, reader_convos.len()) {
864+
for uint::range(0, reader_convos.len()) |i| {
864865
match reader_convos[i] {
865866
(_, ref rp) => rp.recv(),
866867
}

branches/auto/src/libextra/arena.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ impl Arena {
277277
#[test]
278278
fn test_arena_destructors() {
279279
let arena = Arena();
280-
foreach i in range(0u, 10) {
280+
for uint::range(0, 10) |i| {
281281
// Arena allocate something with drop glue to make sure it
282282
// doesn't leak.
283283
do arena.alloc { @i };
@@ -293,7 +293,7 @@ fn test_arena_destructors() {
293293
fn test_arena_destructors_fail() {
294294
let arena = Arena();
295295
// Put some stuff in the arena.
296-
foreach i in range(0u, 10) {
296+
for uint::range(0, 10) |i| {
297297
// Arena allocate something with drop glue to make sure it
298298
// doesn't leak.
299299
do arena.alloc { @i };

branches/auto/src/libextra/bitv.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use std::ops;
1919
use std::uint;
2020
use std::vec;
2121

22+
2223
#[deriving(Clone)]
2324
struct SmallBitv {
2425
/// only the lowest nbits of this value are used. the rest is undefined.
@@ -145,7 +146,7 @@ impl BigBitv {
145146
let len = b.storage.len();
146147
assert_eq!(self.storage.len(), len);
147148
let mut changed = false;
148-
foreach i in range(0, len) {
149+
for uint::range(0, len) |i| {
149150
let mask = big_mask(nbits, i);
150151
let w0 = self.storage[i] & mask;
151152
let w1 = b.storage[i] & mask;
@@ -160,7 +161,7 @@ impl BigBitv {
160161

161162
#[inline]
162163
pub fn each_storage(&mut self, op: &fn(v: &mut uint) -> bool) -> bool {
163-
range(0u, self.storage.len()).advance(|i| op(&mut self.storage[i]))
164+
uint::range(0, self.storage.len(), |i| op(&mut self.storage[i]))
164165
}
165166

166167
#[inline]
@@ -510,7 +511,7 @@ impl Bitv {
510511
}
511512

512513
pub fn ones(&self, f: &fn(uint) -> bool) -> bool {
513-
range(0u, self.nbits).advance(|i| !self.get(i) || f(i))
514+
uint::range(0, self.nbits, |i| !self.get(i) || f(i))
514515
}
515516

516517
}
@@ -541,7 +542,7 @@ pub fn from_bools(bools: &[bool]) -> Bitv {
541542
*/
542543
pub fn from_fn(len: uint, f: &fn(index: uint) -> bool) -> Bitv {
543544
let mut bitv = Bitv::new(len, false);
544-
foreach i in range(0u, len) {
545+
for uint::range(0, len) |i| {
545546
bitv.set(i, f(i));
546547
}
547548
bitv
@@ -558,7 +559,7 @@ fn iterate_bits(base: uint, bits: uint, f: &fn(uint) -> bool) -> bool {
558559
if bits == 0 {
559560
return true;
560561
}
561-
foreach i in range(0u, uint::bits) {
562+
for uint::range(0, uint::bits) |i| {
562563
if bits & (1 << i) != 0 {
563564
if !f(base + i) {
564565
return false;
@@ -673,7 +674,7 @@ impl BitvSet {
673674
fn other_op(&mut self, other: &BitvSet, f: &fn(uint, uint) -> uint) {
674675
fn nbits(mut w: uint) -> uint {
675676
let mut bits = 0;
676-
foreach _ in range(0u, uint::bits) {
677+
for uint::range(0, uint::bits) |_| {
677678
if w == 0 {
678679
break;
679680
}
@@ -1282,12 +1283,12 @@ mod tests {
12821283
#[test]
12831284
fn test_equal_sneaky_big() {
12841285
let mut a = bitv::Bitv::new(100, false);
1285-
foreach i in range(0u, 100) {
1286+
for uint::range(0, 100) |i| {
12861287
a.set(i, true);
12871288
}
12881289
12891290
let mut b = bitv::Bitv::new(100, true);
1290-
foreach i in range(0u, 100) {
1291+
for uint::range(0, 100) |i| {
12911292
b.set(i, true);
12921293
}
12931294

branches/auto/src/libextra/container.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ pub trait Deque<T> : Mutable {
4141

4242
#[cfg(test)]
4343
mod bench {
44+
4445
use std::container::MutableMap;
45-
use std::{vec, rand};
46+
use std::{vec,rand,uint};
4647
use std::rand::RngUtil;
4748
use test::BenchHarness;
4849

@@ -53,7 +54,7 @@ mod bench {
5354
let mut rng = rand::XorShiftRng::new();
5455

5556
map.clear();
56-
foreach _ in range(0, n) {
57+
for uint::range(0,n) |_i| {
5758
map.insert(rng.gen::<uint>() % n, 1);
5859
}
5960

@@ -70,7 +71,7 @@ mod bench {
7071
bh: &mut BenchHarness) {
7172
// setup
7273
map.clear();
73-
foreach i in range(0u, n) {
74+
for uint::range(0, n) |i| {
7475
map.insert(i*2, 1);
7576
}
7677

@@ -108,7 +109,7 @@ mod bench {
108109
map: &mut M,
109110
bh: &mut BenchHarness) {
110111
// setup
111-
foreach i in range(0u, n) {
112+
for uint::range(0, n) |i| {
112113
map.insert(i, 1);
113114
}
114115

@@ -119,4 +120,4 @@ mod bench {
119120
i = (i + 1) % n;
120121
}
121122
}
122-
}
123+
}

branches/auto/src/libextra/crypto/sha2.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
12+
use std::uint;
13+
1114
use digest::Digest;
1215

1316
// BitCounter is a specialized structure intended simply for counting the
@@ -166,7 +169,7 @@ impl Engine512 {
166169
((x << 45) | (x >> 19)) ^ ((x << 3) | (x >> 61)) ^ (x >> 6)
167170
}
168171

169-
foreach t in range(16u, 80) {
172+
for uint::range(16, 80) |t| {
170173
self.W[t] = sigma1(self.W[t - 2]) + self.W[t - 7] + sigma0(self.W[t - 15]) +
171174
self.W[t - 16];
172175
}
@@ -181,7 +184,7 @@ impl Engine512 {
181184
let mut h = self.H7;
182185

183186
let mut t = 0;
184-
foreach _ in range(0u, 10) {
187+
for uint::range(0, 10) |_| {
185188
h += sum1(e) + ch(e, f, g) + K64[t] + self.W[t];
186189
d += h;
187190
h += sum0(a) + maj(a, b, c);
@@ -251,7 +254,7 @@ impl Engine512 {
251254

252255
// add length
253256
if (self.W_idx > 14) {
254-
foreach _ in range(self.W_idx, 16) {
257+
for uint::range(self.W_idx, 16) |_| {
255258
self.process_word(0);
256259
}
257260
}
@@ -449,7 +452,7 @@ impl Engine256 {
449452
((x >> 17) | (x << 15)) ^ ((x >> 19) | (x << 13)) ^ (x >> 10)
450453
}
451454

452-
foreach t in range(16u, 64) {
455+
for uint::range(16, 64) |t| {
453456
self.W[t] = sigma1(self.W[t - 2]) + self.W[t - 7] + sigma0(self.W[t - 15]) +
454457
self.W[t - 16];
455458
}
@@ -464,7 +467,7 @@ impl Engine256 {
464467
let mut h = self.H7;
465468

466469
let mut t = 0;
467-
foreach _ in range(0u, 8) {
470+
for uint::range(0, 8) |_| {
468471
h += sum1(e) + ch(e, f, g) + K32[t] + self.W[t];
469472
d += h;
470473
h += sum0(a) + maj(a, b, c);
@@ -533,7 +536,7 @@ impl Engine256 {
533536

534537
// add length
535538
if (self.W_idx > 14) {
536-
foreach _ in range(self.W_idx, 16) {
539+
for uint::range(self.W_idx, 16) |_| {
537540
self.process_word(0);
538541
}
539542
}

branches/auto/src/libextra/dlist.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ pub fn check_links<T>(list: &DList<T>) {
607607
mod tests {
608608
use super::*;
609609
use std::rand;
610+
use std::int;
610611
use extra::test;
611612

612613
#[test]
@@ -943,7 +944,7 @@ mod tests {
943944
fn fuzz_test(sz: int) {
944945
let mut m = DList::new::<int>();
945946
let mut v = ~[];
946-
foreach i in range(0, sz) {
947+
for int::range(0i, sz) |i| {
947948
check_links(&m);
948949
let r: u8 = rand::random();
949950
match r % 6 {

branches/auto/src/libextra/fileinput.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ mod test {
596596
input.next_file(); // skip the rest of 1
597597
598598
// read all lines from 1 (but don't read any from 2),
599-
foreach i in range(1u, 4) {
599+
for uint::range(1, 4) |i| {
600600
assert_eq!(input.read_line(), fmt!("1 %u", i));
601601
}
602602
// 1 is finished, but 2 hasn't been started yet, so this will

0 commit comments

Comments
 (0)