Skip to content

Commit 5e92795

Browse files
committed
Make rustboot fn/obj drops generic; cuts 300kb size, 10s compile time off rustc.
1 parent 34643ee commit 5e92795

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/boot/me/trans.ml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,6 +1936,22 @@ let trans_visitor
19361936
and get_drop_glue
19371937
(ty:Ast.ty)
19381938
: fixup =
1939+
1940+
(* obj and fn glue delegates to the body, so is always 'generic'. *)
1941+
let ty =
1942+
match ty with
1943+
Ast.TY_obj _ -> Ast.TY_obj (Ast.LAYER_value, Hashtbl.create 0)
1944+
| Ast.TY_fn _ ->
1945+
Ast.TY_fn ({ Ast.sig_input_slots = [| |];
1946+
Ast.sig_input_constrs = [| |];
1947+
Ast.sig_output_slot =
1948+
{ Ast.slot_mode = Ast.MODE_local;
1949+
Ast.slot_ty = Some Ast.TY_nil }; },
1950+
{ Ast.fn_is_iter = false;
1951+
Ast.fn_effect = Ast.EFF_pure })
1952+
| _ -> ty
1953+
in
1954+
19391955
let g = GLUE_drop ty in
19401956
let inner _ (args:Il.cell) =
19411957
let ty_params = deref (get_element_ptr args 0) in

0 commit comments

Comments
 (0)