Skip to content

Commit

Permalink
stdlib: update to latest changes in OCaml 5.3 (#1203)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro authored Oct 28, 2024
1 parent 7693cec commit c7e7948
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 24 deletions.
6 changes: 3 additions & 3 deletions jscomp/stdlib/bytes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ val ends_with :
This section describes unsafe, low-level conversion functions
between [bytes] and [string]. They do not copy the internal data;
used improperly, they can break the immutability invariant on
strings provided by the [-safe-string] option. They are available for
expert library authors, but for most purposes you should use the
always-correct {!to_string} and {!of_string} instead.
strings. They are available for expert library authors, but for
most purposes you should use the always-correct {!to_string} and
{!of_string} instead.
*)

val unsafe_to_string : bytes -> string
Expand Down
6 changes: 3 additions & 3 deletions jscomp/stdlib/bytesLabels.mli
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ val ends_with :
This section describes unsafe, low-level conversion functions
between [bytes] and [string]. They do not copy the internal data;
used improperly, they can break the immutability invariant on
strings provided by the [-safe-string] option. They are available for
expert library authors, but for most purposes you should use the
always-correct {!to_string} and {!of_string} instead.
strings. They are available for expert library authors, but for
most purposes you should use the always-correct {!to_string} and
{!of_string} instead.
*)

val unsafe_to_string : bytes -> string
Expand Down
11 changes: 6 additions & 5 deletions jscomp/stdlib/hashtbl.mli
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ type (!'a, !'b) t

val create : ?random: (* thwart tools/sync_stdlib_docs *) bool ->
int -> ('a, 'b) t
(** [Hashtbl.create n] creates a new, empty hash table, with
initial size [n]. For best results, [n] should be on the
order of the expected number of elements that will be in
the table. The table grows as needed, so [n] is just an
initial guess.
(** [Hashtbl.create n] creates a new, empty hash table, with initial
size greater or equal to the suggested size [n]. For best results,
[n] should be on the order of the expected number of elements that
will be in the table. The table grows as needed, so [n] is just an
initial guess. If [n] is very small or negative then it is
disregarded and a small default size is used.
The optional [~random] parameter (a boolean) controls whether
the internal organization of the hash table is randomized at each
Expand Down
9 changes: 6 additions & 3 deletions jscomp/stdlib/lexing.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,13 @@ let from_channel ?with_positions ic =
from_function ?with_positions (fun buf n -> input ic buf 0 n)

let from_string ?(with_positions = true) s =
(* We can't use [Bytes.unsafe_of_string] here,
[lex_buffer] is exported in the mli, one can mutate
it outside this module. *)
let lex_buffer = Bytes.of_string s in
{ refill_buff = (fun lexbuf -> lexbuf.lex_eof_reached <- true);
lex_buffer = Bytes.of_string s; (* have to make a copy for compatibility
with unsafe-string mode *)
lex_buffer_len = String.length s;
lex_buffer;
lex_buffer_len = Bytes.length lex_buffer;
lex_abs_pos = 0;
lex_start_pos = 0;
lex_curr_pos = 0;
Expand Down
11 changes: 6 additions & 5 deletions jscomp/stdlib/moreLabels.mli
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ module Hashtbl : sig

val create : ?random: (* thwart tools/sync_stdlib_docs *) bool ->
int -> ('a, 'b) t
(** [Hashtbl.create n] creates a new, empty hash table, with
initial size [n]. For best results, [n] should be on the
order of the expected number of elements that will be in
the table. The table grows as needed, so [n] is just an
initial guess.
(** [Hashtbl.create n] creates a new, empty hash table, with initial
size greater or equal to the suggested size [n]. For best results,
[n] should be on the order of the expected number of elements that
will be in the table. The table grows as needed, so [n] is just an
initial guess. If [n] is very small or negative then it is
disregarded and a small default size is used.
The optional [~random] parameter (a boolean) controls whether
the internal organization of the hash table is randomized at each
Expand Down
3 changes: 1 addition & 2 deletions jscomp/stdlib/string.mli
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ val rindex_opt : string -> char -> int option

val to_seq : t -> char Seq.t
(** [to_seq s] is a sequence made of the string's characters in
increasing order. In ["unsafe-string"] mode, modifications of the string
during iteration will be reflected in the sequence.
increasing order.
@since 4.07 *)

Expand Down
3 changes: 1 addition & 2 deletions jscomp/stdlib/stringLabels.mli
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ val rindex_opt : string -> char -> int option

val to_seq : t -> char Seq.t
(** [to_seq s] is a sequence made of the string's characters in
increasing order. In ["unsafe-string"] mode, modifications of the string
during iteration will be reflected in the sequence.
increasing order.
@since 4.07 *)

Expand Down
3 changes: 2 additions & 1 deletion jscomp/stdlib/sys.cppo.mli
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ external runtime_parameters : unit -> string = "caml_runtime_parameters"
#else
external poll_actions : unit -> unit = "%poll"
(** Run any pending runtime actions, such as minor collections, major
GC slices, signal handlers, finalizers, or memprof callbacks. *)
GC slices, signal handlers, finalizers, or memprof callbacks.
@since 5.3 *)
#endif


Expand Down

0 comments on commit c7e7948

Please sign in to comment.