Skip to content

Commit 2995379

Browse files
committed
---
yaml --- r: 77295 b: refs/heads/snap-stage3 c: eafa63f h: refs/heads/master i: 77293: 6a064b4 77291: 2929ca0 77287: 24956c5 77279: 20f8442 v: v3
1 parent 70649ab commit 2995379

File tree

141 files changed

+1779
-3052
lines changed

Some content is hidden

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

141 files changed

+1779
-3052
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: f1132496dddbdd88f321a7919eec3d65136b3f75
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2bd46e767c0fe5b6188df61cb9daf8f2e65a3ed0
4+
refs/heads/snap-stage3: eafa63f787d04857268743e3941e7caa8c128bc4
55
refs/heads/try: ebfe63cd1c0b5d23f7ea60c69b4fde2e30cfd42a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/crypto/cryptoutil.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,6 @@ mod test {
420420
#[test]
421421
#[should_fail]
422422
fn test_add_bytes_to_bits_tuple_overflow2() {
423-
let value: u64 = Bounded::max_value();
424-
add_bytes_to_bits_tuple::<u64>((value - 1, 0), 0x8000000000000000);
423+
add_bytes_to_bits_tuple::<u64>((Bounded::max_value::<u64>() - 1, 0), 0x8000000000000000);
425424
}
426425
}

branches/snap-stage3/src/libextra/dlist.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ mod tests {
661661

662662
#[test]
663663
fn test_basic() {
664-
let mut m: DList<~int> = DList::new();
664+
let mut m = DList::new::<~int>();
665665
assert_eq!(m.pop_front(), None);
666666
assert_eq!(m.pop_back(), None);
667667
assert_eq!(m.pop_front(), None);
@@ -768,7 +768,7 @@ mod tests {
768768

769769
#[test]
770770
fn test_rotate() {
771-
let mut n: DList<int> = DList::new();
771+
let mut n = DList::new::<int>();
772772
n.rotate_backward(); check_links(&n);
773773
assert_eq!(n.len(), 0);
774774
n.rotate_forward(); check_links(&n);
@@ -1033,7 +1033,7 @@ mod tests {
10331033

10341034
#[cfg(test)]
10351035
fn fuzz_test(sz: int) {
1036-
let mut m: DList<int> = DList::new();
1036+
let mut m = DList::new::<int>();
10371037
let mut v = ~[];
10381038
for i in range(0, sz) {
10391039
check_links(&m);
@@ -1078,23 +1078,23 @@ mod tests {
10781078

10791079
#[bench]
10801080
fn bench_push_front(b: &mut test::BenchHarness) {
1081-
let mut m: DList<int> = DList::new();
1081+
let mut m = DList::new::<int>();
10821082
do b.iter {
10831083
m.push_front(0);
10841084
}
10851085
}
10861086

10871087
#[bench]
10881088
fn bench_push_back(b: &mut test::BenchHarness) {
1089-
let mut m: DList<int> = DList::new();
1089+
let mut m = DList::new::<int>();
10901090
do b.iter {
10911091
m.push_back(0);
10921092
}
10931093
}
10941094

10951095
#[bench]
10961096
fn bench_push_back_pop_back(b: &mut test::BenchHarness) {
1097-
let mut m: DList<int> = DList::new();
1097+
let mut m = DList::new::<int>();
10981098
do b.iter {
10991099
m.push_back(0);
11001100
m.pop_back();
@@ -1103,7 +1103,7 @@ mod tests {
11031103

11041104
#[bench]
11051105
fn bench_push_front_pop_front(b: &mut test::BenchHarness) {
1106-
let mut m: DList<int> = DList::new();
1106+
let mut m = DList::new::<int>();
11071107
do b.iter {
11081108
m.push_front(0);
11091109
m.pop_front();
@@ -1112,7 +1112,7 @@ mod tests {
11121112

11131113
#[bench]
11141114
fn bench_rotate_forward(b: &mut test::BenchHarness) {
1115-
let mut m: DList<int> = DList::new();
1115+
let mut m = DList::new::<int>();
11161116
m.push_front(0);
11171117
m.push_front(1);
11181118
do b.iter {
@@ -1122,7 +1122,7 @@ mod tests {
11221122

11231123
#[bench]
11241124
fn bench_rotate_backward(b: &mut test::BenchHarness) {
1125-
let mut m: DList<int> = DList::new();
1125+
let mut m = DList::new::<int>();
11261126
m.push_front(0);
11271127
m.push_front(1);
11281128
do b.iter {

branches/snap-stage3/src/libextra/flate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ pub mod rustrt {
2525

2626
#[link_name = "rustrt"]
2727
extern {
28-
pub fn tdefl_compress_mem_to_heap(psrc_buf: *c_void,
28+
pub fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
2929
src_buf_len: size_t,
3030
pout_len: *mut size_t,
3131
flags: c_int)
3232
-> *c_void;
3333

34-
pub fn tinfl_decompress_mem_to_heap(psrc_buf: *c_void,
34+
pub fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
3535
src_buf_len: size_t,
3636
pout_len: *mut size_t,
3737
flags: c_int)

branches/snap-stage3/src/libextra/num/bigint.rs

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ impl Integer for BigUint {
359359

360360
fn div_mod_floor_inner(a: BigUint, b: BigUint) -> (BigUint, BigUint) {
361361
let mut m = a;
362-
let mut d: BigUint = Zero::zero();
362+
let mut d = Zero::zero::<BigUint>();
363363
let mut n = 1;
364364
while m >= b {
365365
let (d0, d_unit, b_unit) = div_estimate(&m, &b, n);
@@ -411,9 +411,8 @@ impl Integer for BigUint {
411411
if shift == 0 {
412412
return (BigUint::new(d), One::one(), (*b).clone());
413413
}
414-
let one: BigUint = One::one();
415414
return (BigUint::from_slice(d).shl_unit(shift),
416-
one.shl_unit(shift),
415+
One::one::<BigUint>().shl_unit(shift),
417416
b.shl_unit(shift));
418417
}
419418
}
@@ -1446,18 +1445,11 @@ mod biguint_tests {
14461445

14471446
#[test]
14481447
fn test_is_even() {
1449-
let one: Option<BigUint> = FromStr::from_str("1");
1450-
let two: Option<BigUint> = FromStr::from_str("2");
1451-
let thousand: Option<BigUint> = FromStr::from_str("1000");
1452-
let big: Option<BigUint> =
1453-
FromStr::from_str("1000000000000000000000");
1454-
let bigger: Option<BigUint> =
1455-
FromStr::from_str("1000000000000000000001");
1456-
assert!(one.unwrap().is_odd());
1457-
assert!(two.unwrap().is_even());
1458-
assert!(thousand.unwrap().is_even());
1459-
assert!(big.unwrap().is_even());
1460-
assert!(bigger.unwrap().is_odd());
1448+
assert!(FromStr::from_str::<BigUint>("1").unwrap().is_odd());
1449+
assert!(FromStr::from_str::<BigUint>("2").unwrap().is_even());
1450+
assert!(FromStr::from_str::<BigUint>("1000").unwrap().is_even());
1451+
assert!(FromStr::from_str::<BigUint>("1000000000000000000000").unwrap().is_even());
1452+
assert!(FromStr::from_str::<BigUint>("1000000000000000000001").unwrap().is_odd());
14611453
assert!((BigUint::from_uint(1) << 64).is_even());
14621454
assert!(((BigUint::from_uint(1) << 64) + BigUint::from_uint(1)).is_odd());
14631455
}
@@ -1542,19 +1534,15 @@ mod biguint_tests {
15421534
}
15431535
}
15441536

1545-
let zed: Option<BigUint> = FromStrRadix::from_str_radix("Z", 10);
1546-
assert_eq!(zed, None);
1547-
let blank: Option<BigUint> = FromStrRadix::from_str_radix("_", 2);
1548-
assert_eq!(blank, None);
1549-
let minus_one: Option<BigUint> = FromStrRadix::from_str_radix("-1",
1550-
10);
1551-
assert_eq!(minus_one, None);
1537+
assert_eq!(FromStrRadix::from_str_radix::<BigUint>("Z", 10), None);
1538+
assert_eq!(FromStrRadix::from_str_radix::<BigUint>("_", 2), None);
1539+
assert_eq!(FromStrRadix::from_str_radix::<BigUint>("-1", 10), None);
15521540
}
15531541

15541542
#[test]
15551543
fn test_factor() {
15561544
fn factor(n: uint) -> BigUint {
1557-
let mut f: BigUint = One::one();
1545+
let mut f= One::one::<BigUint>();
15581546
for i in range(2, n + 1) {
15591547
// FIXME(#6102): Assignment operator for BigInt causes ICE
15601548
// f *= BigUint::from_uint(i);
@@ -1951,24 +1939,17 @@ mod bigint_tests {
19511939

19521940
#[test]
19531941
fn test_abs_sub() {
1954-
let zero: BigInt = Zero::zero();
1955-
let one: BigInt = One::one();
1956-
assert_eq!((-one).abs_sub(&one), zero);
1957-
let one: BigInt = One::one();
1958-
let zero: BigInt = Zero::zero();
1959-
assert_eq!(one.abs_sub(&one), zero);
1960-
let one: BigInt = One::one();
1961-
let zero: BigInt = Zero::zero();
1962-
assert_eq!(one.abs_sub(&zero), one);
1963-
let one: BigInt = One::one();
1964-
assert_eq!(one.abs_sub(&-one), IntConvertible::from_int(2));
1942+
assert_eq!((-One::one::<BigInt>()).abs_sub(&One::one()), Zero::zero());
1943+
assert_eq!(One::one::<BigInt>().abs_sub(&One::one()), Zero::zero());
1944+
assert_eq!(One::one::<BigInt>().abs_sub(&Zero::zero()), One::one());
1945+
assert_eq!(One::one::<BigInt>().abs_sub(&-One::one::<BigInt>()),
1946+
IntConvertible::from_int(2));
19651947
}
19661948

19671949
#[test]
19681950
fn test_to_str_radix() {
19691951
fn check(n: int, ans: &str) {
1970-
let n: BigInt = IntConvertible::from_int(n);
1971-
assert!(ans == n.to_str_radix(10));
1952+
assert!(ans == IntConvertible::from_int::<BigInt>(n).to_str_radix(10));
19721953
}
19731954
check(10, "10");
19741955
check(1, "1");
@@ -1981,10 +1962,7 @@ mod bigint_tests {
19811962
#[test]
19821963
fn test_from_str_radix() {
19831964
fn check(s: &str, ans: Option<int>) {
1984-
let ans = ans.map_move(|n| {
1985-
let x: BigInt = IntConvertible::from_int(n);
1986-
x
1987-
});
1965+
let ans = ans.map_move(|n| IntConvertible::from_int::<BigInt>(n));
19881966
assert_eq!(FromStrRadix::from_str_radix(s, 10), ans);
19891967
}
19901968
check("10", Some(10));
@@ -2002,8 +1980,7 @@ mod bigint_tests {
20021980
BigInt::new(Minus, ~[1, 1, 1]));
20031981
assert!(-BigInt::new(Minus, ~[1, 1, 1]) ==
20041982
BigInt::new(Plus, ~[1, 1, 1]));
2005-
let zero: BigInt = Zero::zero();
2006-
assert_eq!(-zero, zero);
1983+
assert_eq!(-Zero::zero::<BigInt>(), Zero::zero::<BigInt>());
20071984
}
20081985
}
20091986

branches/snap-stage3/src/libextra/num/rational.rs

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,9 @@ impl<T: FromStr + Clone + Integer + Ord>
269269
/// Parses `numer/denom`.
270270
fn from_str(s: &str) -> Option<Ratio<T>> {
271271
let split: ~[&str] = s.splitn_iter('/', 1).collect();
272-
if split.len() < 2 {
273-
return None
274-
}
275-
let a_option: Option<T> = FromStr::from_str(split[0]);
276-
do a_option.chain |a| {
277-
let b_option: Option<T> = FromStr::from_str(split[1]);
278-
do b_option.chain |b| {
272+
if split.len() < 2 { return None; }
273+
do FromStr::from_str::<T>(split[0]).chain |a| {
274+
do FromStr::from_str::<T>(split[1]).chain |b| {
279275
Some(Ratio::new(a.clone(), b.clone()))
280276
}
281277
}
@@ -286,15 +282,10 @@ impl<T: FromStrRadix + Clone + Integer + Ord>
286282
/// Parses `numer/denom` where the numbers are in base `radix`.
287283
fn from_str_radix(s: &str, radix: uint) -> Option<Ratio<T>> {
288284
let split: ~[&str] = s.splitn_iter('/', 1).collect();
289-
if split.len() < 2 {
290-
None
291-
} else {
292-
let a_option: Option<T> = FromStrRadix::from_str_radix(split[0],
293-
radix);
294-
do a_option.chain |a| {
295-
let b_option: Option<T> =
296-
FromStrRadix::from_str_radix(split[1], radix);
297-
do b_option.chain |b| {
285+
if split.len() < 2 { None }
286+
else {
287+
do FromStrRadix::from_str_radix::<T>(split[0], radix).chain |a| {
288+
do FromStrRadix::from_str_radix::<T>(split[1], radix).chain |b| {
298289
Some(Ratio::new(a.clone(), b.clone()))
299290
}
300291
}
@@ -505,8 +496,7 @@ mod test {
505496
#[test]
506497
fn test_from_str_fail() {
507498
fn test(s: &str) {
508-
let rational: Option<Rational> = FromStr::from_str(s);
509-
assert_eq!(rational, None);
499+
assert_eq!(FromStr::from_str::<Rational>(s), None);
510500
}
511501

512502
let xs = ["0 /1", "abc", "", "1/", "--1/2","3/2/1"];
@@ -546,8 +536,7 @@ mod test {
546536
#[test]
547537
fn test_from_str_radix_fail() {
548538
fn test(s: &str) {
549-
let radix: Option<Rational> = FromStrRadix::from_str_radix(s, 3);
550-
assert_eq!(radix, None);
539+
assert_eq!(FromStrRadix::from_str_radix::<Rational>(s, 3), None);
551540
}
552541

553542
let xs = ["0 /1", "abc", "", "1/", "--1/2","3/2/1", "3/2"];

branches/snap-stage3/src/libextra/priority_queue.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -338,36 +338,27 @@ mod tests {
338338

339339
#[test]
340340
#[should_fail]
341-
fn test_empty_pop() {
342-
let mut heap: PriorityQueue<int> = PriorityQueue::new();
343-
heap.pop();
344-
}
341+
fn test_empty_pop() { let mut heap = PriorityQueue::new::<int>(); heap.pop(); }
345342

346343
#[test]
347344
fn test_empty_maybe_pop() {
348-
let mut heap: PriorityQueue<int> = PriorityQueue::new();
345+
let mut heap = PriorityQueue::new::<int>();
349346
assert!(heap.maybe_pop().is_none());
350347
}
351348

352349
#[test]
353350
#[should_fail]
354-
fn test_empty_top() {
355-
let empty: PriorityQueue<int> = PriorityQueue::new();
356-
empty.top();
357-
}
351+
fn test_empty_top() { let empty = PriorityQueue::new::<int>(); empty.top(); }
358352

359353
#[test]
360354
fn test_empty_maybe_top() {
361-
let empty: PriorityQueue<int> = PriorityQueue::new();
355+
let empty = PriorityQueue::new::<int>();
362356
assert!(empty.maybe_top().is_none());
363357
}
364358

365359
#[test]
366360
#[should_fail]
367-
fn test_empty_replace() {
368-
let mut heap: PriorityQueue<int> = PriorityQueue::new();
369-
heap.replace(5);
370-
}
361+
fn test_empty_replace() { let mut heap = PriorityQueue::new(); heap.replace(5); }
371362

372363
#[test]
373364
fn test_from_iter() {

branches/snap-stage3/src/libextra/ringbuf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ mod tests {
483483
#[bench]
484484
fn bench_new(b: &mut test::BenchHarness) {
485485
do b.iter {
486-
let _: RingBuf<u64> = RingBuf::new();
486+
let _ = RingBuf::new::<u64>();
487487
}
488488
}
489489

branches/snap-stage3/src/libextra/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ pub fn write_boxplot(w: @io::Writer, s: &Summary, width_hint: uint) {
368368
/// Returns a HashMap with the number of occurrences of every element in the
369369
/// sequence that the iterator exposes.
370370
pub fn freq_count<T: Iterator<U>, U: Eq+Hash>(mut iter: T) -> hashmap::HashMap<U, uint> {
371-
let mut map: hashmap::HashMap<U,uint> = hashmap::HashMap::new();
371+
let mut map = hashmap::HashMap::new::<U, uint>();
372372
for elem in iter {
373373
map.insert_or_update_with(elem, 1, |_, count| *count += 1);
374374
}

branches/snap-stage3/src/libextra/treemap.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,7 @@ mod test_treemap {
879879

880880
#[test]
881881
fn find_empty() {
882-
let m: TreeMap<int,int> = TreeMap::new();
883-
assert!(m.find(&5) == None);
882+
let m = TreeMap::new::<int, int>(); assert!(m.find(&5) == None);
884883
}
885884

886885
#[test]
@@ -1007,7 +1006,7 @@ mod test_treemap {
10071006

10081007
#[test]
10091008
fn test_rand_int() {
1010-
let mut map: TreeMap<int,int> = TreeMap::new();
1009+
let mut map = TreeMap::new::<int, int>();
10111010
let mut ctrl = ~[];
10121011

10131012
check_equal(ctrl, &map);

0 commit comments

Comments
 (0)