Skip to content

Commit 31aac9a

Browse files
Merge PR #21852: Cleanup legacy-loading-removed
Reviewed-by: SkySkimmer Co-authored-by: SkySkimmer <SkySkimmer@users.noreply.github.com>
2 parents 7b84f60 + 20013af commit 31aac9a

3 files changed

Lines changed: 12 additions & 54 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- **Removed:**
2+
legacy loading mode for plugins, that was deprecated in Rocq 9.0.
3+
To adapt, change your ``Declare ML Module "legacy:current".``
4+
to ``Declare ML Module "current".``
5+
(`#21852 <https://github.com/rocq-prover/rocq/pull/21852>`_,
6+
by Pierre Roux).

test-suite/bugs/bug_20902_1.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Delimit Scope trunc_scope with trunc.
2828
Global Open Scope trunc_scope.
2929
Global Open Scope type_scope.
3030

31-
Declare ML Module "ltac_plugin:coq-core.plugins.ltac".
31+
Declare ML Module "rocq-runtime.plugins.ltac".
3232

33-
Declare ML Module "number_string_notation_plugin:coq-core.plugins.number_string_notation".
33+
Declare ML Module "rocq-runtime.plugins.number_string_notation".
3434

3535
Global Set Default Proof Mode "Classic".
3636

vernac/mltop.ml

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ module PluginSpec : sig
8181

8282
type t
8383

84-
(* Main constructor, takes the format used in Declare ML Module.
85-
With [usercode:true], warn instead of error on legacy syntax. *)
86-
val of_package : ?usercode:bool -> string -> t
84+
(* Main constructor, takes the format used in Declare ML Module. *)
85+
val of_package : string -> t
8786

8887
val to_package : t -> string
8988

@@ -120,54 +119,7 @@ end = struct
120119
module Set = CSet.Make(Self)
121120
module Map = CMap.Make(Self)
122121

123-
module Errors = struct
124-
125-
let warn_legacy_loading =
126-
CWarnings.create ~name:"legacy-loading-removed" ~category:Deprecation.Version.v9_0
127-
Pp.(fun name ->
128-
str "Legacy loading plugin method has been removed from Rocq, \
129-
and the `:` syntax is deprecated, and its first \
130-
argument ignored; please remove \"" ++
131-
str name ++ str ":\" from your Declare ML")
132-
133-
let plugin_name_invalid_format m =
134-
CErrors.user_err
135-
Pp.(str Format.(asprintf "%s is not a valid plugin name." m) ++ spc () ++
136-
str "It should be a public findlib name, e.g. package-name.foo." ++ spc () ++
137-
str "Legacy names followed by a findlib public name, e.g. "++ spc () ++
138-
str "legacy_plugin:package-name.plugin," ++ spc() ++
139-
str "are not supported anymore.")
140-
141-
let warn_coq_core =
142-
CWarnings.create ~name:"coq-core-plugin" ~category:Deprecation.Version.v9_0
143-
Pp.(fun () -> str "\"coq-core\" has been renamed to \"rocq-runtime\".")
144-
145-
end
146-
147-
(* We would properly load the rocq-runtime cmxs because of the
148-
virtual coq-core findlib package, but we would not initialize the plugin.
149-
eg [Declare ML Module "coq-core.plugins.ltac". Ltac foo := idtac.] would fail
150-
as the grammar for Ltac is not activated. *)
151-
let compat_coq_core lib =
152-
let old_prefix = "coq-core.plugins." in
153-
if CString.is_prefix old_prefix lib
154-
then begin
155-
Errors.warn_coq_core ();
156-
let old_len = String.length old_prefix in
157-
"rocq-runtime.plugins." ^ (CString.sub lib old_len (String.length lib - old_len))
158-
end
159-
else lib
160-
161-
let of_package ?(usercode=false) m =
162-
let lib = match String.split_on_char ':' m with
163-
| [ lib ] -> lib
164-
| [cmxs; lib] when usercode ->
165-
Errors.warn_legacy_loading cmxs;
166-
lib
167-
| _ -> Errors.plugin_name_invalid_format m
168-
in
169-
let lib = if usercode then compat_coq_core lib else lib in
170-
{ lib }
122+
let of_package lib = { lib }
171123

172124
let to_package { lib } = lib
173125

@@ -464,7 +416,7 @@ let inMLModule : ml_module_object -> Libobject.obj =
464416
classify_function = classify_ml_objects }
465417

466418
let declare_ml_modules local mnames =
467-
let mnames = List.map (PluginSpec.of_package ~usercode:true) mnames in
419+
let mnames = List.map PluginSpec.of_package mnames in
468420
if Lib.sections_are_opened()
469421
then CErrors.user_err Pp.(str "Cannot Declare ML Module while sections are opened.");
470422
let mnames = PluginSpec.add_deps mnames in

0 commit comments

Comments
 (0)