aboutsummaryrefslogtreecommitdiff
path: root/src/boot/util
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2010-12-21 15:58:17 -0800
committerPatrick Walton <[email protected]>2010-12-21 15:59:14 -0800
commitd7cbeba731716f176f4c116cfe92f3ec246e1396 (patch)
tree6f4693f2689e63f5beeb46cc0b6854833ea4aad8 /src/boot/util
parentAdd std.sort, with a simple mergesort. (diff)
downloadrust-d7cbeba731716f176f4c116cfe92f3ec246e1396.tar.xz
rust-d7cbeba731716f176f4c116cfe92f3ec246e1396.zip
rustboot: Only bottom out at opaque IL types after finding two cycles. DON'T ASK ME WHY THIS WORKS.
Diffstat (limited to 'src/boot/util')
-rw-r--r--src/boot/util/common.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/boot/util/common.ml b/src/boot/util/common.ml
index 7a95573c..f9b18246 100644
--- a/src/boot/util/common.ml
+++ b/src/boot/util/common.ml
@@ -380,6 +380,13 @@ let rec list_drop n ls =
else list_drop (n-1) (List.tl ls)
;;
+let rec list_count elem lst =
+ match lst with
+ [] -> 0
+ | h::t when h = elem -> 1 + (list_count elem t)
+ | _::t -> list_count elem t
+;;
+
(*
* Auxiliary pair functions.