Skip to content

Commit 3a1e6b0

Browse files
committed
---
yaml --- r: 72695 b: refs/heads/dist-snap c: 44c1e46 h: refs/heads/master i: 72693: 4c7cca0 72691: 3b5fe47 72687: 45c9845 v: v3
1 parent beda6b1 commit 3a1e6b0

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: 24de5bb649434fc57e1c06bbbe74bbc4662526ce
10+
refs/heads/dist-snap: 44c1e46ef5bb78b61e4aec28c0b8cef312404d18
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libcore/stackwalk.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,32 @@ fn test_simple_deep() {
6464
if i == 0 { return }
6565

6666
for walk_stack |_frame| {
67-
// Would be nice to test something here...
67+
breakpoint();
6868
}
6969
run(i - 1);
7070
}
7171

7272
run(10);
7373
}
7474

75+
fn breakpoint() {
76+
unsafe {
77+
rustrt::rust_dbg_breakpoint()
78+
}
79+
}
80+
7581
fn frame_address(f: &fn(x: *u8)) {
7682
unsafe {
7783
rusti::frame_address(f)
7884
}
7985
}
8086

87+
pub mod rustrt {
88+
pub extern {
89+
pub unsafe fn rust_dbg_breakpoint();
90+
}
91+
}
92+
8193
pub mod rusti {
8294
#[abi = "rust-intrinsic"]
8395
pub extern "rust-intrinsic" {

branches/dist-snap/src/libcore/vec.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ pub fn connect<T:Copy>(v: &[~[T]], sep: &T) -> ~[T] {
991991
* ~~~
992992
*
993993
*/
994-
pub fn foldl<T, U>(z: T, v: &[U], p: &fn(t: T, u: &U) -> T) -> T {
994+
pub fn foldl<'a, T, U>(z: T, v: &'a [U], p: &fn(t: T, u: &'a U) -> T) -> T {
995995
let mut accum = z;
996996
let mut i = 0;
997997
let l = v.len();
@@ -1023,12 +1023,13 @@ pub fn foldl<T, U>(z: T, v: &[U], p: &fn(t: T, u: &U) -> T) -> T {
10231023
* ~~~
10241024
*
10251025
*/
1026-
pub fn foldr<T, U: Copy>(v: &[T], z: U, p: &fn(t: &T, u: U) -> U) -> U {
1027-
let mut accum = z;
1028-
for v.each_reverse |elt| {
1029-
accum = p(elt, accum);
1026+
pub fn foldr<'a, T, U>(v: &'a [T], mut z: U, p: &fn(t: &'a T, u: U) -> U) -> U {
1027+
let mut i = v.len();
1028+
while i > 0 {
1029+
i -= 1;
1030+
z = p(&v[i], z);
10301031
}
1031-
accum
1032+
return z;
10321033
}
10331034
10341035
/**
@@ -1851,7 +1852,7 @@ pub trait ImmutableVector<'self, T> {
18511852
fn last_opt(&self) -> Option<&'self T>;
18521853
fn each_reverse(&self, blk: &fn(&T) -> bool);
18531854
fn eachi_reverse(&self, blk: &fn(uint, &T) -> bool);
1854-
fn foldr<U: Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U;
1855+
fn foldr<'a, U>(&'a self, z: U, p: &fn(t: &'a T, u: U) -> U) -> U;
18551856
fn map<U>(&self, f: &fn(t: &T) -> U) -> ~[U];
18561857
fn mapi<U>(&self, f: &fn(uint, t: &T) -> U) -> ~[U];
18571858
fn map_r<U>(&self, f: &fn(x: &T) -> U) -> ~[U];
@@ -1924,7 +1925,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
19241925

19251926
/// Reduce a vector from right to left
19261927
#[inline]
1927-
fn foldr<U:Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U {
1928+
fn foldr<'a, U>(&'a self, z: U, p: &fn(t: &'a T, u: U) -> U) -> U {
19281929
foldr(*self, z, p)
19291930
}
19301931

0 commit comments

Comments
 (0)