From 52121bc609b378fd9586251b6bfdba66e1f8022b Mon Sep 17 00:00:00 2001
From: Thibault Martin <thi.martin.pro@pm.me>
Date: Wed, 3 Jul 2024 16:38:04 +0200
Subject: [PATCH] [kernel] Remove deprecated Integer functions

---
 src/libraries/stdlib/integer.ml  | 12 +++---------
 src/libraries/stdlib/integer.mli | 21 ---------------------
 2 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/src/libraries/stdlib/integer.ml b/src/libraries/stdlib/integer.ml
index 7cd8055eaee..4aac7d3b501 100644
--- a/src/libraries/stdlib/integer.ml
+++ b/src/libraries/stdlib/integer.ml
@@ -105,12 +105,6 @@ let to_int_exn = Z.to_int
 let to_int64_exn = Z.to_int64
 let to_int32_exn = Z.to_int32
 
-(* These functions are deprecated (renamed to *_exn) and will be removed
-   in a future version. *)
-let to_int = to_int_exn
-let to_int64 = to_int64_exn
-let to_int32 = to_int32_exn
-
 let wrap to_int i = try Some (to_int i) with Z.Overflow -> None
 let to_int_opt = wrap Z.to_int
 let to_int64_opt = wrap Z.to_int64
@@ -202,9 +196,9 @@ let pretty_hex fmt v =
     if gt v two_power_60 then
       let quo, rem = Z.ediv_rem v two_power_60 in
       aux quo;
-      Format.fprintf fmt "%015LX" (to_int64 rem)
+      Format.fprintf fmt "%015LX" (to_int64_exn rem)
     else
-      Format.fprintf fmt "%LX" (to_int64 v)
+      Format.fprintf fmt "%LX" (to_int64_exn v)
   in
   if equal v zero then Format.pp_print_string fmt "0"
   else if gt v zero then (Format.pp_print_string fmt "0x"; aux v)
@@ -229,7 +223,7 @@ let length u v = succ (sub v u)
 let extract_bits ~start ~stop v =
   assert (ge start zero && ge stop start);
   (*Format.printf "%a[%a..%a]@\n" pretty v pretty start pretty stop;*)
-  let r = Z.extract v (to_int start) (to_int (length start stop)) in
+  let r = Z.extract v (to_int_exn start) (to_int_exn (length start stop)) in
   (*Format.printf "%a[%a..%a]=%a@\n" pretty v pretty start pretty stop pretty r;*)
   r
 
diff --git a/src/libraries/stdlib/integer.mli b/src/libraries/stdlib/integer.mli
index 73bab403765..43df286f2ab 100644
--- a/src/libraries/stdlib/integer.mli
+++ b/src/libraries/stdlib/integer.mli
@@ -124,27 +124,6 @@ val of_int : int -> t
 val of_int64 : Int64.t -> t
 val of_int32 : Int32.t -> t
 
-(**
-   @raise Z.Overflow if too big
-   @deprecated 24.0-Chromium Renamed to [to_int_exn].
-                           Also consider using [to_int_opt].
-*)
-val to_int : t -> int [@@deprecated]
-
-(**
-   @raise Z.Overflow if too big
-   @deprecated 24.0-Chromium Renamed to [to_int64_exn].
-                           Also consider using [to_int64_opt].
-*)
-val to_int64 : t -> int64 [@@deprecated]
-
-(**
-   @raise Z.Overflow if too big
-   @deprecated 24.0-Chromium Renamed to [to_int32_exn].
-                           Also consider using [to_int32_opt].
-*)
-val to_int32 : t -> int32 [@@deprecated]
-
 (**
    @raise Z.Overflow if too big
    @since 24.0-Chromium
-- 
GitLab