Skip to content

Commit f73e182

Browse files
committed
---
yaml --- r: 149071 b: refs/heads/try2 c: 47ab5d2 h: refs/heads/master i: 149069: 6a84e74 149067: 73ca042 149063: c071740 149055: 9e7ff93 v: v3
1 parent e84225e commit f73e182

Some content is hidden

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

67 files changed

+358
-315
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 06a0c21c91b161781ee1aced0f2a9aed84cb4646
8+
refs/heads/try2: 47ab5d2d42aaf9e04afe6cc5aa84446e523d83ff
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ ifdef TRACE
126126
endif
127127
ifdef CFG_DISABLE_RPATH
128128
# NOTE: make this CFG_RUSTC_FLAGS after stage0 snapshot
129-
RUSTFLAGS_STAGE1 += --no-rpath
130-
RUSTFLAGS_STAGE2 += --no-rpath
131-
RUSTFLAGS_STAGE3 += --no-rpath
129+
RUSTFLAGS_STAGE1 += -C no-rpath
130+
RUSTFLAGS_STAGE2 += -C no-rpath
131+
RUSTFLAGS_STAGE3 += -C no-rpath
132132
endif
133133

134134
# The executables crated during this compilation process have no need to include

branches/try2/src/libarena/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ use std::rc::Rc;
4040
use std::rt::global_heap;
4141
use std::unstable::intrinsics::{TyDesc, get_tydesc};
4242
use std::unstable::intrinsics;
43-
use std::util;
4443
use std::vec;
4544

4645
// The way arena uses arrays is really deeply awful. The arrays are
@@ -404,7 +403,7 @@ impl TypedArenaChunk {
404403
}
405404

406405
// Destroy the next chunk.
407-
let next_opt = util::replace(&mut self.next, None);
406+
let next_opt = mem::replace(&mut self.next, None);
408407
match next_opt {
409408
None => {}
410409
Some(mut next) => {

branches/try2/src/libcollections/dlist.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
// the reverse direction.
2424

2525
use std::cast;
26+
use std::mem::{replace, swap};
2627
use std::ptr;
27-
use std::util;
2828
use std::iter::Rev;
2929
use std::iter;
3030

@@ -102,7 +102,7 @@ impl<T> Rawlink<T> {
102102

103103
/// Return the `Rawlink` and replace with `Rawlink::none()`
104104
fn take(&mut self) -> Rawlink<T> {
105-
util::replace(self, Rawlink::none())
105+
replace(self, Rawlink::none())
106106
}
107107
}
108108

@@ -161,7 +161,7 @@ impl<T> DList<T> {
161161
Some(ref mut head) => {
162162
new_head.prev = Rawlink::none();
163163
head.prev = Rawlink::some(new_head);
164-
util::swap(head, &mut new_head);
164+
swap(head, &mut new_head);
165165
head.next = Some(new_head);
166166
}
167167
}
@@ -319,7 +319,7 @@ impl<T> DList<T> {
319319
/// O(1)
320320
#[inline]
321321
pub fn prepend(&mut self, mut other: DList<T>) {
322-
util::swap(self, &mut other);
322+
swap(self, &mut other);
323323
self.append(other);
324324
}
325325

branches/try2/src/libcollections/list.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,26 @@ pub fn find<T:Clone>(ls: @List<T>, f: |&T| -> bool) -> Option<T> {
6363
};
6464
}
6565

66+
/**
67+
* Returns true if a list contains an element that matches a given predicate
68+
*
69+
* Apply function `f` to each element of `ls`, starting from the first.
70+
* When function `f` returns true then it also returns true. If `f` matches no
71+
* elements then false is returned.
72+
*/
73+
pub fn any<T>(ls: @List<T>, f: |&T| -> bool) -> bool {
74+
let mut ls = ls;
75+
loop {
76+
ls = match *ls {
77+
Cons(ref hd, tl) => {
78+
if f(hd) { return true; }
79+
tl
80+
}
81+
Nil => return false
82+
}
83+
};
84+
}
85+
6686
/// Returns true if a list contains an element with the given value
6787
pub fn has<T:Eq>(ls: @List<T>, elt: T) -> bool {
6888
let mut found = false;
@@ -222,6 +242,15 @@ mod tests {
222242
assert_eq!(list::find(empty, match_), option::None::<int>);
223243
}
224244

245+
#[test]
246+
fn test_any() {
247+
fn match_(i: &int) -> bool { return *i == 2; }
248+
let l = from_vec([0, 1, 2]);
249+
let empty = @list::Nil::<int>;
250+
assert_eq!(list::any(l, match_), true);
251+
assert_eq!(list::any(empty, match_), false);
252+
}
253+
225254
#[test]
226255
fn test_has() {
227256
let l = from_vec([5, 8, 6]);

branches/try2/src/libcollections/priority_queue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#[allow(missing_doc)];
1414

1515
use std::clone::Clone;
16-
use std::mem::{move_val_init, init};
17-
use std::util::{replace, swap};
16+
use std::mem::{move_val_init, init, replace, swap};
1817
use std::vec;
1918

2019
/// A priority queue implemented with a binary heap

branches/try2/src/libcollections/smallintmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#[allow(missing_doc)];
1717

1818
use std::iter::{Enumerate, FilterMap, Rev};
19-
use std::util::replace;
19+
use std::mem::replace;
2020
use std::vec;
2121

2222
#[allow(missing_doc)]

branches/try2/src/libcollections/treemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
//! trees. The only requirement for the types is that the key implements
1313
//! `TotalOrd`.
1414
15-
use std::util::{swap, replace};
1615
use std::iter::{Peekable};
1716
use std::cmp::Ordering;
17+
use std::mem::{replace, swap};
1818
use std::ptr;
1919

2020
use serialize::{Encodable, Decodable, Encoder, Decoder};

branches/try2/src/libextra/num/bigint.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,8 @@ mod bigint_tests {
25922592
#[cfg(test)]
25932593
mod bench {
25942594
use super::*;
2595-
use std::{iter, util};
2595+
use std::iter;
2596+
use std::mem::replace;
25962597
use std::num::{FromPrimitive, Zero, One};
25972598
use extra::test::BenchHarness;
25982599

@@ -2609,7 +2610,7 @@ mod bench {
26092610
let mut f1: BigUint = One::one();
26102611
for _ in range(0, n) {
26112612
let f2 = f0 + f1;
2612-
f0 = util::replace(&mut f1, f2);
2613+
f0 = replace(&mut f1, f2);
26132614
}
26142615
f0
26152616
}

branches/try2/src/libextra/stats.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
use std::cmp;
1414
use std::hashmap;
1515
use std::io;
16+
use std::mem;
1617
use std::num;
17-
use std::util;
1818

1919
// NB: this can probably be rewritten in terms of num::Num
2020
// to be less f64-specific.
@@ -178,7 +178,7 @@ impl<'a> Stats for &'a [f64] {
178178
for i in range(0, partials.len()) {
179179
let mut y = partials[i];
180180
if num::abs(x) < num::abs(y) {
181-
util::swap(&mut x, &mut y);
181+
mem::swap(&mut x, &mut y);
182182
}
183183
// Rounded `x+y` is stored in `hi` with round-off stored in
184184
// `lo`. Together `hi+lo` are exactly equal to `x+y`.

0 commit comments

Comments
 (0)