Skip to content

Commit d1f2661

Browse files
committed
---
yaml --- r: 60409 b: refs/heads/master c: c2baaa8 h: refs/heads/master i: 60407: 0f05b31 v: v3
1 parent e3f181d commit d1f2661

File tree

5 files changed

+4
-111
lines changed

5 files changed

+4
-111
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: 08ef229a65cd7b8de27a5844eee3dce8c69aa846
2+
refs/heads/master: c2baaa8d8432c8d7320e928e7ad706f225430bb3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589

trunk/src/libcore/iter.rs

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ much easier to implement.
4343
#[cfg(not(stage0))] use cmp::Ord;
4444
#[cfg(not(stage0))] use option::{Option, Some, None};
4545
#[cfg(not(stage0))] use vec::OwnedVector;
46-
#[cfg(not(stage0))] use num::{One, Zero};
47-
#[cfg(not(stage0))] use ops::{Add, Mul};
4846

4947
#[cfg(stage0)]
5048
pub trait Times {
@@ -214,81 +212,6 @@ pub fn min<T: Ord>(iter: &fn(f: &fn(T) -> bool) -> bool) -> Option<T> {
214212
result
215213
}
216214

217-
/**
218-
* Reduce an iterator to an accumulated value.
219-
*
220-
* # Example:
221-
*
222-
* ~~~~
223-
* assert_eq!(fold(0i, |f| int::range(1, 5, f), |a, x| *a += x), 10);
224-
* ~~~~
225-
*/
226-
#[cfg(not(stage0))]
227-
#[inline]
228-
pub fn fold<T, U>(start: T, iter: &fn(f: &fn(U) -> bool) -> bool, f: &fn(&mut T, U)) -> T {
229-
let mut result = start;
230-
for iter |x| {
231-
f(&mut result, x);
232-
}
233-
result
234-
}
235-
236-
/**
237-
* Reduce an iterator to an accumulated value.
238-
*
239-
* `fold_ref` is usable in some generic functions where `fold` is too lenient to type-check, but it
240-
* forces the iterator to yield borrowed pointers.
241-
*
242-
* # Example:
243-
*
244-
* ~~~~
245-
* fn product<T: One + Mul<T, T>>(iter: &fn(f: &fn(&T) -> bool) -> bool) -> T {
246-
* fold_ref(One::one::<T>(), iter, |a, x| *a = a.mul(x))
247-
* }
248-
* ~~~~
249-
*/
250-
#[cfg(not(stage0))]
251-
#[inline]
252-
pub fn fold_ref<T, U>(start: T, iter: &fn(f: &fn(&U) -> bool) -> bool, f: &fn(&mut T, &U)) -> T {
253-
let mut result = start;
254-
for iter |x| {
255-
f(&mut result, x);
256-
}
257-
result
258-
}
259-
260-
/**
261-
* Return the sum of the items yielding by an iterator.
262-
*
263-
* # Example:
264-
*
265-
* ~~~~
266-
* let xs: ~[int] = ~[1, 2, 3, 4];
267-
* assert_eq!(do sum |f| { xs.each(f) }, 10);
268-
* ~~~~
269-
*/
270-
#[cfg(not(stage0))]
271-
#[inline(always)]
272-
pub fn sum<T: Zero + Add<T, T>>(iter: &fn(f: &fn(&T) -> bool) -> bool) -> T {
273-
fold_ref(Zero::zero::<T>(), iter, |a, x| *a = a.add(x))
274-
}
275-
276-
/**
277-
* Return the product of the items yielded by an iterator.
278-
*
279-
* # Example:
280-
*
281-
* ~~~~
282-
* let xs: ~[int] = ~[1, 2, 3, 4];
283-
* assert_eq!(do product |f| { xs.each(f) }, 24);
284-
* ~~~~
285-
*/
286-
#[cfg(not(stage0))]
287-
#[inline(always)]
288-
pub fn product<T: One + Mul<T, T>>(iter: &fn(f: &fn(&T) -> bool) -> bool) -> T {
289-
fold_ref(One::one::<T>(), iter, |a, x| *a = a.mul(x))
290-
}
291-
292215
#[cfg(test)]
293216
mod tests {
294217
use super::*;
@@ -331,33 +254,4 @@ mod tests {
331254
let xs = ~[8, 2, 3, 1, -5, 9, 11, 15];
332255
assert_eq!(min(|f| xs.each(f)).unwrap(), &-5);
333256
}
334-
335-
#[test]
336-
fn test_fold() {
337-
assert_eq!(fold(0i, |f| int::range(1, 5, f), |a, x| *a += x), 10);
338-
}
339-
340-
#[test]
341-
fn test_sum() {
342-
let xs: ~[int] = ~[1, 2, 3, 4];
343-
assert_eq!(do sum |f| { xs.each(f) }, 10);
344-
}
345-
346-
#[test]
347-
fn test_empty_sum() {
348-
let xs: ~[int] = ~[];
349-
assert_eq!(do sum |f| { xs.each(f) }, 0);
350-
}
351-
352-
#[test]
353-
fn test_product() {
354-
let xs: ~[int] = ~[1, 2, 3, 4];
355-
assert_eq!(do product |f| { xs.each(f) }, 24);
356-
}
357-
358-
#[test]
359-
fn test_empty_product() {
360-
let xs: ~[int] = ~[];
361-
assert_eq!(do product |f| { xs.each(f) }, 1);
362-
}
363257
}

trunk/src/libcore/rt/stack.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ pub impl StackSegment {
3131

3232
/// Point one word beyond the high end of the allocated stack
3333
fn end(&self) -> *uint {
34-
unsafe {
35-
vec::raw::to_ptr(self.buf).offset(self.buf.len()) as *uint
36-
}
34+
vec::raw::to_ptr(self.buf).offset(self.buf.len()) as *uint
3735
}
3836
}
3937

trunk/src/libcore/rt/uv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ pub type Buf = uvll::uv_buf_t;
362362
363363
/// Borrow a slice to a Buf
364364
pub fn slice_to_uv_buf(v: &[u8]) -> Buf {
365-
let data = unsafe { vec::raw::to_ptr(v) };
365+
let data = vec::raw::to_ptr(v);
366366
unsafe { uvll::buf_init(data, v.len()) }
367367
}
368368

trunk/src/librustc/util/enum_set.rs

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

11+
#[cfg(stage0)]
1112
use core;
1213

1314
#[deriving(Eq, IterBytes)]

0 commit comments

Comments
 (0)