Skip to content

Commit d7cbeba

Browse files
committed
rustboot: Only bottom out at opaque IL types after finding two cycles. DON'T ASK ME WHY THIS WORKS.
1 parent 6443179 commit d7cbeba

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/boot/me/semant.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2425,7 +2425,7 @@ and referent_type
24252425
Some parent_tags
24262426
when boxed
24272427
&& parent_tags <> []
2428-
&& List.mem ttag parent_tags
2428+
&& (list_count ttag parent_tags) > 1
24292429
&& is_back_edge ttag (List.hd parent_tags) ->
24302430
Il.StructTy [| word; Il.OpaqueTy |]
24312431
| _ -> tag ttag

src/boot/util/common.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,13 @@ let rec list_drop n ls =
380380
else list_drop (n-1) (List.tl ls)
381381
;;
382382

383+
let rec list_count elem lst =
384+
match lst with
385+
[] -> 0
386+
| h::t when h = elem -> 1 + (list_count elem t)
387+
| _::t -> list_count elem t
388+
;;
389+
383390

384391
(*
385392
* Auxiliary pair functions.

0 commit comments

Comments
 (0)