From 7601ddc3500cae2da39883b339951205be19c41d Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Thu, 23 Feb 2017 03:48:50 +0100 Subject: [safe_string] library/nameops We add a more convenient API to create identifiers from mutable strings. We cannot solve the `String.copy` deprecation problem until we enable `-safe-string`. --- kernel/names.ml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'kernel/names.ml') diff --git a/kernel/names.ml b/kernel/names.ml index 1f138581cc..831b6ad46e 100644 --- a/kernel/names.ml +++ b/kernel/names.ml @@ -50,6 +50,11 @@ struct | None -> true | Some _ -> false + let of_bytes s = + let s = Bytes.to_string s in + check_soft s; + String.hcons s + let of_string s = let () = check_soft s in let s = String.copy s in -- cgit v1.2.3 From 5e2574cbef1ba132aacc73b4a079cc0b5584f589 Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Thu, 23 Feb 2017 14:57:59 +0100 Subject: [safe-string] Enable -safe-string ! We now build Coq with `-safe-string`, which enforces functional use of the `string` datatype. Coq was pretty safe in these regard so only a few tweaks were needed. - coq_makefile: build plugins with -safe-string too. - `names.ml`: we remove `String.copy` uses, as they are not needed. --- kernel/names.ml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'kernel/names.ml') diff --git a/kernel/names.ml b/kernel/names.ml index 831b6ad46e..ee8d838da1 100644 --- a/kernel/names.ml +++ b/kernel/names.ml @@ -57,15 +57,13 @@ struct let of_string s = let () = check_soft s in - let s = String.copy s in String.hcons s let of_string_soft s = let () = check_soft ~warn:false s in - let s = String.copy s in String.hcons s - let to_string id = String.copy id + let to_string id = id let print id = str id -- cgit v1.2.3