Skip to content

Commit 5cafdf3

Browse files
committed
compatibility
Signed-off-by: Paul-Elliot <[email protected]>
1 parent 6516522 commit 5cafdf3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/odoc/occurrences.ml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
open Or_error
22

3+
(* Copied from ocaml 5.0 String module *)
4+
let string_starts_with ~prefix s =
5+
let open String in
6+
let len_s = length s and len_pre = length prefix in
7+
let rec aux i =
8+
if i = len_pre then true
9+
else if unsafe_get s i <> unsafe_get prefix i then false
10+
else aux (i + 1)
11+
in
12+
len_s >= len_pre && aux 0
13+
314
let handle_file file ~f =
4-
if String.starts_with ~prefix:"src-" (Fpath.filename file) then
15+
if string_starts_with ~prefix:"src-" (Fpath.filename file) then
516
Odoc_file.load file |> function
617
| Error _ as e -> e
718
| Ok unit' -> (

0 commit comments

Comments
 (0)