Skip to content

Commit 76f7b04

Browse files
committed
Changes to make rustboot compile on OCaml 3.12
1 parent 0415841 commit 76f7b04

File tree

9 files changed

+46
-46
lines changed

9 files changed

+46
-46
lines changed

src/boot/be/ra.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ let kill_redundant_moves (cx:ctxt) : unit =
132132

133133
let quad_jump_target_labels (q:quad) : Il.label list =
134134
match q.Il.quad_body with
135-
Il.Jmp { Il.jmp_targ = Il.CodeLabel lab } -> [ lab ]
135+
Il.Jmp { Il.jmp_targ = Il.CodeLabel lab; _ } -> [ lab ]
136136
| _ -> []
137137
;;
138138

@@ -172,7 +172,7 @@ let quad_defined_vregs (q:quad) : Il.vreg list =
172172

173173
let quad_is_unconditional_jump (q:quad) : bool =
174174
match q.Il.quad_body with
175-
Il.Jmp { jmp_op = Il.JMP } -> true
175+
Il.Jmp { jmp_op = Il.JMP; _ } -> true
176176
| Il.Ret -> true
177177
| _ -> false
178178
;;

src/boot/llvm/lltrans.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ let trans_crate
110110
: Llvm.llvalue option =
111111
match Session.get_span sess id with
112112
None -> None
113-
| Some {lo=(_, line, col)} ->
113+
| Some {lo=(_, line, col); _} ->
114114
Some (di_location line col scope)
115115
in
116116

@@ -368,9 +368,9 @@ let trans_crate
368368
in
369369
let base_llty = trans_ty ty in
370370
match slot.Ast.slot_mode with
371-
| Ast.MODE_alias _ ->
371+
| Ast.MODE_alias ->
372372
Llvm.pointer_type base_llty
373-
| Ast.MODE_local _ -> base_llty
373+
| Ast.MODE_local -> base_llty
374374
in
375375

376376
let get_element_ptr
@@ -585,7 +585,7 @@ let trans_crate
585585
(name:Ast.ident)
586586
mod_item
587587
: unit =
588-
let { node = { Ast.decl_item = (item:Ast.mod_item') }; id = id } =
588+
let { node = { Ast.decl_item = (item:Ast.mod_item'); _ }; id = id } =
589589
mod_item in
590590
let full_name = Semant.item_str sem_cx id in
591591
let (filename, line_num) =
@@ -621,7 +621,7 @@ let trans_crate
621621
let trans_fn
622622
({
623623
Ast.fn_input_slots = (header_slots:Ast.header_slots);
624-
Ast.fn_body = (body:Ast.block)
624+
Ast.fn_body = (body:Ast.block); _
625625
}:Ast.fn)
626626
(fn_id:node_id)
627627
: unit =
@@ -654,7 +654,7 @@ let trans_crate
654654
let build_arg idx llargval =
655655
if idx >= n_implicit_args
656656
then
657-
let ({ id = id }, ident) = header_slots.(idx - 2) in
657+
let ({ id = id; _ }, ident) = header_slots.(idx - 2) in
658658
Llvm.set_value_name ident llargval;
659659
let llarg =
660660
let llty = Llvm.type_of llargval in
@@ -754,7 +754,7 @@ let trans_crate
754754
let rec trans_lval (lval:Ast.lval) : (Llvm.llvalue * Ast.ty) =
755755
iflog (fun _ -> log sem_cx "trans_lval: %a" Ast.sprintf_lval lval);
756756
match lval with
757-
Ast.LVAL_base { id = base_id } ->
757+
Ast.LVAL_base { id = base_id; _ } ->
758758
set_debug_loc base_id;
759759
let defn_id = lval_base_defn_id sem_cx lval in
760760
begin
@@ -813,7 +813,7 @@ let trans_crate
813813
let trans_atom (atom:Ast.atom) : Llvm.llvalue =
814814
iflog (fun _ -> log sem_cx "trans_atom: %a" Ast.sprintf_atom atom);
815815
match atom with
816-
Ast.ATOM_literal { node = lit } -> trans_literal lit
816+
Ast.ATOM_literal { node = lit; _ } -> trans_literal lit
817817
| Ast.ATOM_lval lval ->
818818
Llvm.build_load (fst (trans_lval lval)) (anon_llid "tmp")
819819
llbuilder
@@ -1081,7 +1081,7 @@ let trans_crate
10811081
(name:Ast.ident)
10821082
mod_item
10831083
: unit =
1084-
let { node = { Ast.decl_item = (item:Ast.mod_item') }; id = id } =
1084+
let { node = { Ast.decl_item = (item:Ast.mod_item'); _ }; id = id } =
10851085
mod_item in
10861086
match item with
10871087
Ast.MOD_ITEM_type _ ->

src/boot/me/dead.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ let dead_code_visitor
4444
if Hashtbl.mem must_exit block.id then
4545
Hashtbl.add must_exit s.id ()
4646

47-
| Ast.STMT_while { Ast.while_body = body }
48-
| Ast.STMT_do_while { Ast.while_body = body }
49-
| Ast.STMT_for_each { Ast.for_each_body = body }
50-
| Ast.STMT_for { Ast.for_body = body } ->
47+
| Ast.STMT_while { Ast.while_body = body; _ }
48+
| Ast.STMT_do_while { Ast.while_body = body; _ }
49+
| Ast.STMT_for_each { Ast.for_each_body = body; _ }
50+
| Ast.STMT_for { Ast.for_body = body; _ } ->
5151
if (Hashtbl.mem must_exit body.id) then
5252
Hashtbl.add must_exit s.id ()
5353

54-
| Ast.STMT_if { Ast.if_then = b1; Ast.if_else = Some b2 } ->
54+
| Ast.STMT_if { Ast.if_then = b1; Ast.if_else = Some b2; _ } ->
5555
if (Hashtbl.mem must_exit b1.id) && (Hashtbl.mem must_exit b2.id)
5656
then Hashtbl.add must_exit s.id ()
5757

@@ -61,16 +61,16 @@ let dead_code_visitor
6161
| Ast.STMT_be _ ->
6262
Hashtbl.add must_exit s.id ()
6363

64-
| Ast.STMT_alt_tag { Ast.alt_tag_arms = arms } ->
64+
| Ast.STMT_alt_tag { Ast.alt_tag_arms = arms; _ } ->
6565
let arm_ids =
66-
Array.map (fun { node = (_, block) } -> block.id) arms
66+
Array.map (fun { node = (_, block); _ } -> block.id) arms
6767
in
6868
if all_must_exit arm_ids
6969
then Hashtbl.add must_exit s.id ()
7070

7171
| Ast.STMT_alt_type { Ast.alt_type_arms = arms;
72-
Ast.alt_type_else = alt_type_else } ->
73-
let arm_ids = Array.map (fun { node = ((_, _), block) } ->
72+
Ast.alt_type_else = alt_type_else; _ } ->
73+
let arm_ids = Array.map (fun { node = ((_, _), block); _ } ->
7474
block.id) arms in
7575
let else_ids =
7676
begin

src/boot/me/resolve.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ let stmt_collecting_visitor
113113
visit_for_block f.Ast.for_slot f.Ast.for_body.id
114114
| Ast.STMT_for_each f ->
115115
visit_for_block f.Ast.for_each_slot f.Ast.for_each_head.id
116-
| Ast.STMT_alt_tag { Ast.alt_tag_arms = arms } ->
116+
| Ast.STMT_alt_tag { Ast.alt_tag_arms = arms; _ } ->
117117
let rec resolve_pat block pat =
118118
match pat with
119-
Ast.PAT_slot ({ id = slot_id }, ident) ->
119+
Ast.PAT_slot ({ id = slot_id; _ }, ident) ->
120120
let slots = Hashtbl.find cx.ctxt_block_slots block.id in
121121
let key = Ast.KEY_ident ident in
122122
htab_put slots key slot_id;
@@ -125,7 +125,7 @@ let stmt_collecting_visitor
125125
| Ast.PAT_lit _
126126
| Ast.PAT_wild -> ()
127127
in
128-
Array.iter (fun { node = (p, b) } -> resolve_pat b p) arms
128+
Array.iter (fun { node = (p, b); _ } -> resolve_pat b p) arms
129129
| _ -> ()
130130
end;
131131
inner.Walk.visit_stmt_pre stmt
@@ -236,8 +236,8 @@ let lookup_type_node_by_name
236236
None -> err None "unknown name: %a" Ast.sprintf_name name
237237
| Some (_, id) ->
238238
match htab_search cx.ctxt_all_defns id with
239-
Some (DEFN_item { Ast.decl_item = Ast.MOD_ITEM_type _ })
240-
| Some (DEFN_item { Ast.decl_item = Ast.MOD_ITEM_obj _ })
239+
Some (DEFN_item { Ast.decl_item = Ast.MOD_ITEM_type _; _ })
240+
| Some (DEFN_item { Ast.decl_item = Ast.MOD_ITEM_obj _; _ })
241241
| Some (DEFN_ty_param _) -> id
242242
| _ ->
243243
err None "Found non-type binding for %a"
@@ -645,8 +645,8 @@ let lval_base_resolving_visitor
645645
let reference_any_name lv =
646646
let rec lval_is_name lv =
647647
match lv with
648-
Ast.LVAL_base {node = Ast.BASE_ident _}
649-
| Ast.LVAL_base {node = Ast.BASE_app _} -> true
648+
Ast.LVAL_base {node = Ast.BASE_ident _; _}
649+
| Ast.LVAL_base {node = Ast.BASE_app _; _} -> true
650650
| Ast.LVAL_ext (lv', Ast.COMP_named (Ast.COMP_ident _))
651651
| Ast.LVAL_ext (lv', Ast.COMP_named (Ast.COMP_app _))
652652
-> lval_is_name lv'
@@ -749,7 +749,7 @@ let pattern_resolving_visitor
749749
end
750750
in
751751

752-
let resolve_arm { node = arm } =
752+
let resolve_arm { node = arm; _ } =
753753
match fst arm with
754754
Ast.PAT_tag (lval, pats) ->
755755
let lval_nm = lval_to_name lval in

src/boot/me/semant.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ let slot_ty (s:Ast.slot) : Ast.ty =
546546

547547
let fn_output_ty (fn_ty:Ast.ty) : Ast.ty =
548548
match fn_ty with
549-
Ast.TY_fn ({ Ast.sig_output_slot = slot }, _) ->
549+
Ast.TY_fn ({ Ast.sig_output_slot = slot; _ }, _) ->
550550
begin
551551
match slot.Ast.slot_ty with
552552
Some ty -> ty
@@ -579,8 +579,8 @@ let defn_is_static (d:defn) : bool =
579579

580580
let defn_is_callable (d:defn) : bool =
581581
match d with
582-
DEFN_slot { Ast.slot_ty = Some Ast.TY_fn _ }
583-
| DEFN_item { Ast.decl_item = (Ast.MOD_ITEM_fn _ ) } -> true
582+
DEFN_slot { Ast.slot_ty = Some Ast.TY_fn _; _ }
583+
| DEFN_item { Ast.decl_item = (Ast.MOD_ITEM_fn _ ); _ } -> true
584584
| _ -> false
585585
;;
586586

@@ -637,7 +637,7 @@ let atoms_to_names (atoms:Ast.atom array)
637637

638638
let rec lval_to_name (lv:Ast.lval) : Ast.name =
639639
match lv with
640-
Ast.LVAL_base { node = nb } ->
640+
Ast.LVAL_base { node = nb; _ } ->
641641
Ast.NAME_base nb
642642
| Ast.LVAL_ext (lv, lv_comp) ->
643643
let comp =
@@ -655,7 +655,7 @@ let rec plval_to_name (pl:Ast.plval) : Ast.name =
655655
match pl with
656656
Ast.PLVAL_base nb ->
657657
Ast.NAME_base nb
658-
| Ast.PLVAL_ext_name ({node = Ast.PEXP_lval pl}, nc) ->
658+
| Ast.PLVAL_ext_name ({node = Ast.PEXP_lval pl; _}, nc) ->
659659
Ast.NAME_ext (plval_to_name pl, nc)
660660
| _ -> bug () "plval_to_name with plval that contains non-name components"
661661
;;
@@ -1878,7 +1878,7 @@ let get_mod_item
18781878
(node:node_id)
18791879
: (Ast.mod_view * Ast.mod_items) =
18801880
match get_item cx node with
1881-
{ Ast.decl_item = Ast.MOD_ITEM_mod md } -> md
1881+
{ Ast.decl_item = Ast.MOD_ITEM_mod md; _ } -> md
18821882
| _ -> bugi cx node "defn is not a mod"
18831883
;;
18841884

src/boot/me/trans.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ let trans_visitor
13681368
and get_obj_vtbl (id:node_id) : Il.operand =
13691369
let obj =
13701370
match Hashtbl.find cx.ctxt_all_defns id with
1371-
DEFN_item { Ast.decl_item=Ast.MOD_ITEM_obj obj} -> obj
1371+
DEFN_item { Ast.decl_item=Ast.MOD_ITEM_obj obj; _} -> obj
13721372
| _ -> bug () "Trans.get_obj_vtbl on non-obj referent"
13731373
in
13741374
trans_crate_rel_data_operand (DATA_obj_vtbl id)
@@ -4755,8 +4755,8 @@ let trans_visitor
47554755
match lval with
47564756
Ast.LVAL_ext (_, (Ast.COMP_named (Ast.COMP_ident id)))
47574757
| Ast.LVAL_ext (_, (Ast.COMP_named (Ast.COMP_app (id, _))))
4758-
| Ast.LVAL_base { node = Ast.BASE_ident id }
4759-
| Ast.LVAL_base { node = Ast.BASE_app (id, _) } -> id
4758+
| Ast.LVAL_base { node = Ast.BASE_ident id; _ }
4759+
| Ast.LVAL_base { node = Ast.BASE_app (id, _); _ } -> id
47604760
| _ -> bug cx "expected lval ending in ident"
47614761
in
47624762
let ttag =

src/boot/me/type.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,11 +1261,11 @@ let process_crate (cx:Semant.ctxt) (crate:Ast.crate) : unit =
12611261
if cx.Semant.ctxt_main_name = Some path_name then
12621262
try
12631263
match Hashtbl.find cx.Semant.ctxt_all_item_types item_id with
1264-
Ast.TY_fn ({ Ast.sig_input_slots = [| |] }, _)
1264+
Ast.TY_fn ({ Ast.sig_input_slots = [| |]; _ }, _)
12651265
| Ast.TY_fn ({ Ast.sig_input_slots = [| {
12661266
Ast.slot_mode = Ast.MODE_local;
12671267
Ast.slot_ty = Some (Ast.TY_vec Ast.TY_str)
1268-
} |] }, _) ->
1268+
} |]; _}, _) ->
12691269
()
12701270
| _ -> Common.err (Some item_id) "main fn has bad type signature"
12711271
with Not_found ->
@@ -1327,7 +1327,7 @@ let process_crate (cx:Semant.ctxt) (crate:Ast.crate) : unit =
13271327
let obj_ty = Hashtbl.find cx.Semant.ctxt_all_item_types obj.Common.id in
13281328
match obj_ty with
13291329
Ast.TY_fn ({ Ast.sig_output_slot =
1330-
{ Ast.slot_ty = Some (Ast.TY_obj (_, methods)) } }, _) ->
1330+
{ Ast.slot_ty = Some (Ast.TY_obj (_, methods)); _ }; _ }, _) ->
13311331
push_fn_ctx_of_ty_fn (Hashtbl.find methods ident)
13321332
| _ ->
13331333
Common.bug ()

src/boot/me/typestate.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ let condition_assigning_visitor
714714

715715
| Ast.STMT_alt_tag at ->
716716
let precond = slot_inits (lval_slots cx at.Ast.alt_tag_lval) in
717-
let visit_arm { node = (pat, block) } =
717+
let visit_arm { node = (pat, block); _ } =
718718
(* FIXME (issue #34): propagate tag-carried constrs here. *)
719719
let rec get_slots pat =
720720
match pat with
@@ -1048,7 +1048,7 @@ let graph_special_block_structure_building_visitor
10481048
let graph = ts.ts_graph in
10491049
let dsts = Hashtbl.find graph s.id in
10501050
let arm_blocks =
1051-
let arm_block_id { node = (_, block) } = block.id in
1051+
let arm_block_id { node = (_, block); _ } = block.id in
10521052
Array.to_list (Array.map arm_block_id at.Ast.alt_tag_arms)
10531053
in
10541054
let succ_stmts =
@@ -1470,7 +1470,7 @@ let lifecycle_visitor
14701470
iflog cx (fun _ -> log cx "entering a loop");
14711471
Stack.push (Some (Stack.create ())) loop_blocks;
14721472

1473-
| Ast.STMT_alt_tag { Ast.alt_tag_arms = arms } ->
1473+
| Ast.STMT_alt_tag { Ast.alt_tag_arms = arms; _ } ->
14741474
let note_slot block slot_id =
14751475
log cx
14761476
"noting implicit init for slot %d in pattern-alt block %d"
@@ -1479,7 +1479,7 @@ let lifecycle_visitor
14791479
in
14801480
let rec all_pat_slot_ids block pat =
14811481
match pat with
1482-
Ast.PAT_slot ({ id = slot_id }, _) ->
1482+
Ast.PAT_slot ({ id = slot_id; _ }, _) ->
14831483
[ slot_id ]
14841484
| Ast.PAT_tag (_, pats) ->
14851485
List.concat
@@ -1490,7 +1490,7 @@ let lifecycle_visitor
14901490
in
14911491
Array.iter
14921492
begin
1493-
fun { node = (pat, block) } ->
1493+
fun { node = (pat, block); _ } ->
14941494
let slot_ids = all_pat_slot_ids block pat in
14951495
List.iter (note_slot block) slot_ids;
14961496
htab_put implicit_init_block_slots

src/boot/me/walk.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ and walk_stmt
517517
| Ast.STMT_alt_tag
518518
{ Ast.alt_tag_lval = lval; Ast.alt_tag_arms = arms } ->
519519
walk_lval v lval;
520-
let walk_arm { node = (pat, block) } =
520+
let walk_arm { node = (pat, block); _ } =
521521
walk_pat v pat;
522522
walk_block v block
523523
in

0 commit comments

Comments
 (0)