Skip to content

Commit f6beec6

Browse files
committed
stdlib: Do tail calls in std::list. Remove FIXMEs
1 parent bac68e4 commit f6beec6

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/lib/list.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,12 @@ fn foldl[T,U](&list[T] ls, &U u, fn(&T t, &U u) -> U f) -> U {
2525
alt(ls) {
2626
case (cons[T](?hd, ?tl)) {
2727
auto u_ = f(hd, u);
28-
// FIXME: should use 'be' here, not 'ret'. But parametric
29-
// tail calls currently don't work.
30-
ret foldl[T,U](*tl, u_, f);
28+
be foldl[T,U](*tl, u_, f);
3129
}
3230
case (nil[T]) {
3331
ret u;
3432
}
3533
}
36-
3734
fail; // TODO: remove me when exhaustiveness checking works
3835
}
3936

@@ -43,9 +40,7 @@ fn find[T,U](&list[T] ls,
4340
case (cons[T](?hd, ?tl)) {
4441
alt (f(hd)) {
4542
case (none[U]) {
46-
// FIXME: should use 'be' here, not 'ret'. But parametric
47-
// tail calls currently don't work.
48-
ret find[T,U](*tl, f);
43+
be find[T,U](*tl, f);
4944
}
5045
case (some[U](?res)) {
5146
ret some[U](res);

0 commit comments

Comments
 (0)