Skip to content

Commit 01d2665

Browse files
committed
---
yaml --- r: 65037 b: refs/heads/master c: a10974d h: refs/heads/master i: 65035: 91a3569 v: v3
1 parent 8235cdd commit 01d2665

Some content is hidden

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

45 files changed

+158
-613
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: ac74bbec9327ef393041feb544d2468131e1759e
2+
refs/heads/master: a10974da2db2e483f21e337f0c9a8a1e1c4c81ed
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/mk/platform.mk

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -239,32 +239,6 @@ CFG_RUN_arm-linux-androideabi=
239239
CFG_RUN_TARG_arm-linux-androideabi=
240240
RUSTC_FLAGS_arm-linux-androideabi :=--android-cross-path=$(CFG_ANDROID_CROSS_PATH)
241241

242-
# arm-unknown-linux-gnueabihf configuration
243-
CC_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-gcc
244-
CXX_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-g++
245-
CPP_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-gcc -E
246-
AR_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-ar
247-
CFG_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).so
248-
CFG_LIB_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.so
249-
CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
250-
CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabihf := -Wall -g -fPIC
251-
CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabihf := -fno-rtti
252-
CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabihf := -shared -fPIC -g
253-
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=
254-
CFG_GCCISH_PRE_LIB_FLAGS_arm-unknown-linux-gnueabihf := -Wl,-whole-archive
255-
CFG_GCCISH_POST_LIB_FLAGS_arm-unknown-linux-gnueabihf := -Wl,-no-whole-archive
256-
CFG_DEF_SUFFIX_arm-unknown-linux-gnueabihf := .linux.def
257-
CFG_INSTALL_NAME_ar,-unknown-linux-gnueabihf =
258-
CFG_LIBUV_LINK_FLAGS_arm-unknown-linux-gnueabihf =
259-
CFG_EXE_SUFFIX_arm-unknown-linux-gnueabihf :=
260-
CFG_WINDOWSY_arm-unknown-linux-gnueabihf :=
261-
CFG_UNIXY_arm-unknown-linux-gnueabihf := 1
262-
CFG_PATH_MUNGE_arm-unknown-linux-gnueabihf := true
263-
CFG_LDPATH_arm-unknown-linux-gnueabihf :=
264-
CFG_RUN_arm-unknown-linux-gnueabihf=
265-
CFG_RUN_TARG_arm-unknown-linux-gnueabihf=
266-
RUSTC_FLAGS_arm-unknown-linux-gnueabihf := --linker=$(CC_arm-unknown-linux-gnueabihf)
267-
268242
# mips-unknown-linux-gnu configuration
269243
CC_mips-unknown-linux-gnu=mips-linux-gnu-gcc
270244
CXX_mips-unknown-linux-gnu=mips-linux-gnu-g++

trunk/mk/rt.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@
2626
# Hack for passing flags into LIBUV, see below.
2727
LIBUV_FLAGS_i386 = -m32 -fPIC
2828
LIBUV_FLAGS_x86_64 = -m64 -fPIC
29-
ifeq ($(OSTYPE_$(1)), linux-androideabi)
3029
LIBUV_FLAGS_arm = -fPIC -DANDROID -std=gnu99
31-
else
32-
LIBUV_FLAGS_arm = -fPIC -std=gnu99
33-
endif
3430
LIBUV_FLAGS_mips = -fPIC -mips32r2 -msoft-float -mabi=32
3531

3632
# when we're doing a snapshot build, we intentionally degrade as many

trunk/src/libcore/iterator.rs

Lines changed: 0 additions & 262 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ implementing the `Iterator` trait.
1818
*/
1919

2020
use prelude::*;
21-
use num::{Zero, One};
2221

2322
pub trait Iterator<A> {
2423
/// Advance the iterator and return the next value. Return `None` when the end is reached.
@@ -35,7 +34,6 @@ pub trait IteratorUtil<A> {
3534
// FIXME: #5898: should be called map
3635
fn transform<'r, B>(self, f: &'r fn(A) -> B) -> MapIterator<'r, A, B, Self>;
3736
fn filter<'r>(self, predicate: &'r fn(&A) -> bool) -> FilterIterator<'r, A, Self>;
38-
fn filter_map<'r, B>(self, f: &'r fn(A) -> Option<B>) -> FilterMapIterator<'r, A, B, Self>;
3937
fn enumerate(self) -> EnumerateIterator<Self>;
4038
fn skip_while<'r>(self, predicate: &'r fn(&A) -> bool) -> SkipWhileIterator<'r, A, Self>;
4139
fn take_while<'r>(self, predicate: &'r fn(&A) -> bool) -> TakeWhileIterator<'r, A, Self>;
@@ -47,14 +45,6 @@ pub trait IteratorUtil<A> {
4745
fn advance(&mut self, f: &fn(A) -> bool);
4846
#[cfg(not(stage0))]
4947
fn advance(&mut self, f: &fn(A) -> bool) -> bool;
50-
fn to_vec(self) -> ~[A];
51-
fn nth(&mut self, n: uint) -> A;
52-
fn first(&mut self) -> A;
53-
fn last(&mut self) -> A;
54-
fn fold<B>(&mut self, start: B, f: &fn(B, A) -> B) -> B;
55-
fn count(&mut self) -> uint;
56-
fn all(&mut self, f: &fn(&A) -> bool) -> bool;
57-
fn any(&mut self, f: &fn(&A) -> bool) -> bool;
5848
}
5949

6050
/// Iterator adaptors provided for every `Iterator` implementation. The adaptor objects are also
@@ -83,11 +73,6 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
8373
FilterIterator{iter: self, predicate: predicate}
8474
}
8575

86-
#[inline(always)]
87-
fn filter_map<'r, B>(self, f: &'r fn(A) -> Option<B>) -> FilterMapIterator<'r, A, B, T> {
88-
FilterMapIterator { iter: self, f: f }
89-
}
90-
9176
#[inline(always)]
9277
fn enumerate(self) -> EnumerateIterator<T> {
9378
EnumerateIterator{iter: self, count: 0}
@@ -146,123 +131,6 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
146131
}
147132
}
148133
}
149-
150-
#[inline(always)]
151-
fn to_vec(self) -> ~[A] {
152-
let mut v = ~[];
153-
let mut it = self;
154-
for it.advance() |x| { v.push(x); }
155-
return v;
156-
}
157-
158-
/// Get `n`th element of an iterator.
159-
#[inline(always)]
160-
fn nth(&mut self, n: uint) -> A {
161-
let mut i = n;
162-
loop {
163-
match self.next() {
164-
Some(x) => { if i == 0 { return x; }}
165-
None => { fail!("cannot get %uth element", n) }
166-
}
167-
i -= 1;
168-
}
169-
}
170-
171-
// Get first elemet of an iterator.
172-
#[inline(always)]
173-
fn first(&mut self) -> A {
174-
match self.next() {
175-
Some(x) => x ,
176-
None => fail!("cannot get first element")
177-
}
178-
}
179-
180-
// Get last element of an iterator.
181-
//
182-
// If the iterator have an infinite length, this method won't return.
183-
#[inline(always)]
184-
fn last(&mut self) -> A {
185-
let mut elm = match self.next() {
186-
Some(x) => x,
187-
None => fail!("cannot get last element")
188-
};
189-
for self.advance |e| { elm = e; }
190-
return elm;
191-
}
192-
193-
/// Reduce an iterator to an accumulated value
194-
#[inline]
195-
fn fold<B>(&mut self, init: B, f: &fn(B, A) -> B) -> B {
196-
let mut accum = init;
197-
loop {
198-
match self.next() {
199-
Some(x) => { accum = f(accum, x); }
200-
None => { break; }
201-
}
202-
}
203-
return accum;
204-
}
205-
206-
/// Count the number of an iterator elemenrs
207-
#[inline(always)]
208-
fn count(&mut self) -> uint { self.fold(0, |cnt, _x| cnt + 1) }
209-
210-
#[inline(always)]
211-
fn all(&mut self, f: &fn(&A) -> bool) -> bool {
212-
for self.advance |x| { if !f(&x) { return false; } }
213-
return true;
214-
}
215-
216-
#[inline(always)]
217-
fn any(&mut self, f: &fn(&A) -> bool) -> bool {
218-
for self.advance |x| { if f(&x) { return true; } }
219-
return false;
220-
}
221-
}
222-
223-
pub trait AdditiveIterator<A> {
224-
fn sum(&mut self) -> A;
225-
}
226-
227-
impl<A: Add<A, A> + Zero, T: Iterator<A>> AdditiveIterator<A> for T {
228-
#[inline(always)]
229-
fn sum(&mut self) -> A { self.fold(Zero::zero::<A>(), |s, x| s + x) }
230-
}
231-
232-
pub trait MultiplicativeIterator<A> {
233-
fn product(&mut self) -> A;
234-
}
235-
236-
impl<A: Mul<A, A> + One, T: Iterator<A>> MultiplicativeIterator<A> for T {
237-
#[inline(always)]
238-
fn product(&mut self) -> A { self.fold(One::one::<A>(), |p, x| p * x) }
239-
}
240-
241-
pub trait OrdIterator<A> {
242-
fn max(&mut self) -> Option<A>;
243-
fn min(&mut self) -> Option<A>;
244-
}
245-
246-
impl<A: Ord, T: Iterator<A>> OrdIterator<A> for T {
247-
#[inline(always)]
248-
fn max(&mut self) -> Option<A> {
249-
self.fold(None, |max, x| {
250-
match max {
251-
None => Some(x),
252-
Some(y) => Some(cmp::max(x, y))
253-
}
254-
})
255-
}
256-
257-
#[inline(always)]
258-
fn min(&mut self) -> Option<A> {
259-
self.fold(None, |min, x| {
260-
match min {
261-
None => Some(x),
262-
Some(y) => Some(cmp::min(x, y))
263-
}
264-
})
265-
}
266134
}
267135

268136
pub struct ChainIterator<T, U> {
@@ -336,28 +204,6 @@ impl<'self, A, T: Iterator<A>> Iterator<A> for FilterIterator<'self, A, T> {
336204
}
337205
}
338206

339-
pub struct FilterMapIterator<'self, A, B, T> {
340-
priv iter: T,
341-
priv f: &'self fn(A) -> Option<B>
342-
}
343-
344-
impl<'self, A, B, T: Iterator<A>> Iterator<B> for FilterMapIterator<'self, A, B, T> {
345-
#[inline]
346-
fn next(&mut self) -> Option<B> {
347-
loop {
348-
match self.iter.next() {
349-
None => { return None; }
350-
Some(a) => {
351-
match (self.f)(a) {
352-
Some(b) => { return Some(b); }
353-
None => { loop; }
354-
}
355-
}
356-
}
357-
}
358-
}
359-
}
360-
361207
pub struct EnumerateIterator<T> {
362208
priv iter: T,
363209
priv count: uint
@@ -577,13 +423,6 @@ mod tests {
577423
assert_eq!(i, expected.len());
578424
}
579425

580-
#[test]
581-
fn test_filter_map() {
582-
let it = Counter::new(0u, 1u).take(10)
583-
.filter_map(|x: uint| if x.is_even() { Some(x*x) } else { None });
584-
assert_eq!(it.to_vec(), ~[0*0, 2*2, 4*4, 6*6, 8*8]);
585-
}
586-
587426
#[test]
588427
fn test_iterator_enumerate() {
589428
let xs = [0u, 1, 2, 3, 4, 5];
@@ -684,105 +523,4 @@ mod tests {
684523
}
685524
assert_eq!(i, 10);
686525
}
687-
688-
#[test]
689-
fn test_iterator_nth() {
690-
let v = &[0, 1, 2, 3, 4];
691-
for uint::range(0, v.len()) |i| {
692-
assert_eq!(v.iter().nth(i), &v[i]);
693-
}
694-
}
695-
696-
#[test]
697-
#[should_fail]
698-
fn test_iterator_nth_fail() {
699-
let v = &[0, 1, 2, 3, 4];
700-
v.iter().nth(5);
701-
}
702-
703-
#[test]
704-
fn test_iterator_first() {
705-
let v = &[0, 1, 2, 3, 4];
706-
assert_eq!(v.iter().first(), &0);
707-
assert_eq!(v.slice(2, 5).iter().first(), &2);
708-
}
709-
710-
#[test]
711-
#[should_fail]
712-
fn test_iterator_first_fail() {
713-
let v: &[uint] = &[];
714-
v.iter().first();
715-
}
716-
717-
#[test]
718-
fn test_iterator_last() {
719-
let v = &[0, 1, 2, 3, 4];
720-
assert_eq!(v.iter().last(), &4);
721-
assert_eq!(v.slice(0, 1).iter().last(), &0);
722-
}
723-
724-
#[test]
725-
#[should_fail]
726-
fn test_iterator_last_fail() {
727-
let v: &[uint] = &[];
728-
v.iter().last();
729-
}
730-
731-
#[test]
732-
fn test_iterator_count() {
733-
let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
734-
assert_eq!(v.slice(0, 4).iter().count(), 4);
735-
assert_eq!(v.slice(0, 10).iter().count(), 10);
736-
assert_eq!(v.slice(0, 0).iter().count(), 0);
737-
}
738-
739-
#[test]
740-
fn test_iterator_sum() {
741-
let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
742-
assert_eq!(v.slice(0, 4).iter().transform(|&x| x).sum(), 6);
743-
assert_eq!(v.iter().transform(|&x| x).sum(), 55);
744-
assert_eq!(v.slice(0, 0).iter().transform(|&x| x).sum(), 0);
745-
}
746-
747-
#[test]
748-
fn test_iterator_product() {
749-
let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
750-
assert_eq!(v.slice(0, 4).iter().transform(|&x| x).product(), 0);
751-
assert_eq!(v.slice(1, 5).iter().transform(|&x| x).product(), 24);
752-
assert_eq!(v.slice(0, 0).iter().transform(|&x| x).product(), 1);
753-
}
754-
755-
#[test]
756-
fn test_iterator_max() {
757-
let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
758-
assert_eq!(v.slice(0, 4).iter().transform(|&x| x).max(), Some(3));
759-
assert_eq!(v.iter().transform(|&x| x).max(), Some(10));
760-
assert_eq!(v.slice(0, 0).iter().transform(|&x| x).max(), None);
761-
}
762-
763-
#[test]
764-
fn test_iterator_min() {
765-
let v = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
766-
assert_eq!(v.slice(0, 4).iter().transform(|&x| x).min(), Some(0));
767-
assert_eq!(v.iter().transform(|&x| x).min(), Some(0));
768-
assert_eq!(v.slice(0, 0).iter().transform(|&x| x).min(), None);
769-
}
770-
771-
#[test]
772-
fn test_all() {
773-
let v = ~&[1, 2, 3, 4, 5];
774-
assert!(v.iter().all(|&x| *x < 10));
775-
assert!(!v.iter().all(|&x| x.is_even()));
776-
assert!(!v.iter().all(|&x| *x > 100));
777-
assert!(v.slice(0, 0).iter().all(|_| fail!()));
778-
}
779-
780-
#[test]
781-
fn test_any() {
782-
let v = ~&[1, 2, 3, 4, 5];
783-
assert!(v.iter().any(|&x| *x < 10));
784-
assert!(v.iter().any(|&x| x.is_even()));
785-
assert!(!v.iter().any(|&x| *x > 100));
786-
assert!(!v.slice(0, 0).iter().any(|_| fail!()));
787-
}
788526
}

trunk/src/libcore/num/f32.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,27 @@ impl Orderable for f32 {
248248
if self.is_NaN() || other.is_NaN() { Float::NaN() } else { fmax(*self, *other) }
249249
}
250250

251-
/// Returns the number constrained within the range `mn <= self <= mx`.
252-
/// If any of the numbers are `NaN` then `NaN` is returned.
251+
#[cfg(stage0)]
253252
#[inline(always)]
254253
fn clamp(&self, mn: &f32, mx: &f32) -> f32 {
255254
if self.is_NaN() { *self }
256255
else if !(*self <= *mx) { *mx }
257256
else if !(*self >= *mn) { *mn }
258257
else { *self }
259258
}
259+
260+
/// Returns the number constrained within the range `mn <= self <= mx`.
261+
/// If any of the numbers are `NaN` then `NaN` is returned.
262+
#[cfg(not(stage0))]
263+
#[inline(always)]
264+
fn clamp(&self, mn: &f32, mx: &f32) -> f32 {
265+
cond!(
266+
(self.is_NaN()) { *self }
267+
(!(*self <= *mx)) { *mx }
268+
(!(*self >= *mn)) { *mn }
269+
_ { *self }
270+
)
271+
}
260272
}
261273

262274
impl Zero for f32 {

0 commit comments

Comments
 (0)