Skip to content

Commit b15f901

Browse files
authored
Merge pull request #317 from mtzguido/fix
pulse2rust: update after F* change
2 parents f493dee + ba21014 commit b15f901

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

pulse2rust/src/Pulse2Rust.Deps.fst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ let decl_reachable (reachable_defs:reachable_defs) (mname:string) (d:S.mlmodule1
175175
let rec topsort (d:dict) (grey:list string) (black:list string) (root:string)
176176
: (list string & list string) = // grey and black
177177
let grey = root::grey in
178-
let deps = root |> smap_try_find d |> must |> (fun (deps, _, _) -> deps) in
179-
let deps = deps |> List.filter (fun f -> List.mem f (smap_keys d) && not (f = root)) in
178+
let deps = root |> SMap.try_find d |> must |> (fun (deps, _, _) -> deps) in
179+
let deps = deps |> List.filter (fun f -> List.mem f (SMap.keys d) && not (f = root)) in
180180
if List.existsb (fun d -> List.mem d grey) deps
181181
then failwith (format1 "cyclic dependency: %s" root);
182182
let deps = deps |> List.filter (fun f -> not (List.mem f black)) in
@@ -188,10 +188,10 @@ let rec topsort (d:dict) (grey:list string) (black:list string) (root:string)
188188
let rec topsort_all (d:dict) (black:list string)
189189
: list string =
190190

191-
if List.for_all (fun f -> List.contains f black) (smap_keys d)
191+
if List.for_all (fun f -> List.contains f black) (SMap.keys d)
192192
then black
193193
else
194-
let rem = List.filter (fun f -> not (List.contains f black)) (smap_keys d) in
194+
let rem = List.filter (fun f -> not (List.contains f black)) (SMap.keys d) in
195195
let root = List.nth rem (List.length rem - 1) in
196196
let grey, black = topsort d [] black root in
197197
if List.length grey <> 0

pulse2rust/src/Pulse2Rust.Env.fsti

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type reachable_defs = RBSet.t string
4242

4343
val reachable_defs_to_string (d:reachable_defs) : string
4444

45-
type dict = smap (list string & list UEnv.binding & S.mlmodule)
45+
type dict = SMap.t (list string & list UEnv.binding & S.mlmodule)
4646

4747
type env = {
4848
external_libs : list string;

pulse2rust/src/Pulse2Rust.Extract.fst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ let lookup_datacon_in_module1 (s:S.mlident) (m:S.mlmodule1) : option S.mlsymbol
6767
| _ -> None
6868
6969
let lookup_datacon (g:env) (s:S.mlident) : option (list string & S.mlsymbol) =
70-
let d_keys = smap_keys g.d in
70+
let d_keys = SMap.keys g.d in
7171
find_map d_keys (fun k ->
72-
let (_, _, decls) = smap_try_find g.d k |> must in
72+
let (_, _, decls) = SMap.try_find g.d k |> must in
7373
let ropt = find_map decls (lookup_datacon_in_module1 s) in
7474
match ropt with
7575
| None -> None

pulse2rust/src/Pulse2Rust.fst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,28 +106,28 @@ let file_to_module_name (f:string) : string =
106106
replace_chars s '_' "."
107107
108108
let read_all_ast_files (files:list string) : dict =
109-
let d = smap_create 100 in
109+
let d = SMap.create 100 in
110110
files |> List.iter (fun f ->
111111
let contents : (list string & list UEnv.binding & S.mlmodule) =
112112
match load_value_from_file f with
113113
| Some r -> r
114114
| None -> failwith (format1 "Could not load file %s" f) in
115-
smap_add d (file_to_module_name f) contents);
115+
SMap.add d (file_to_module_name f) contents);
116116
d
117117
118-
let build_decls_dict (d:dict) : smap S.mlmodule1 =
119-
let dd = smap_create 100 in
120-
smap_iter d (fun module_nm (_, _, decls) ->
118+
let build_decls_dict (d:dict) : SMap.t S.mlmodule1 =
119+
let dd = SMap.create 100 in
120+
SMap.iter d (fun module_nm (_, _, decls) ->
121121
List.iter (fun (decl:S.mlmodule1) ->
122122
List.iter (fun decl_nm ->
123-
smap_add dd (module_nm ^ "." ^ decl_nm) decl
123+
SMap.add dd (module_nm ^ "." ^ decl_nm) decl
124124
) (mlmodule1_name decl)
125125
) decls
126126
);
127127
dd
128128
129129
let rec collect_reachable_defs_aux
130-
(dd:smap S.mlmodule1)
130+
(dd:SMap.t S.mlmodule1)
131131
(worklist:reachable_defs)
132132
(reachable_defs:reachable_defs) =
133133
@@ -138,7 +138,7 @@ let rec collect_reachable_defs_aux
138138
// print1 "Adding %s to reachable_defs\n" hd;
139139
let reachable_defs = add hd reachable_defs in
140140
let worklist =
141-
let hd_decl = smap_try_find dd hd in
141+
let hd_decl = SMap.try_find dd hd in
142142
match hd_decl with
143143
| None -> worklist
144144
| Some hd_decl ->
@@ -153,7 +153,7 @@ let rec collect_reachable_defs_aux
153153
154154
let collect_reachable_defs (d:dict) (root_module:string) : reachable_defs =
155155
let dd = build_decls_dict d in
156-
let root_decls = smap_try_find d root_module |> must |> (fun (_, _, decls) -> decls) in
156+
let root_decls = SMap.try_find d root_module |> must |> (fun (_, _, decls) -> decls) in
157157
let worklist = List.fold_left (fun worklist decl ->
158158
addn
159159
(decl |> mlmodule1_name |> List.map (fun s -> root_module ^ "." ^ s))
@@ -186,7 +186,7 @@ let extract (files:list string) (odir:string) (libs:string) : unit =
186186
let g = empty_env external_libs d all_modules reachable_defs in
187187
let _, all_rust_files = List.fold_left (fun (g, all_rust_files) f ->
188188
// print1 "Extracting file: %s\n" f;
189-
let (_, bs, ds) = smap_try_find d f |> must in
189+
let (_, bs, ds) = SMap.try_find d f |> must in
190190
let s, g = extract_one g f bs ds in
191191
let rust_fname = concat_dir_filename odir (rust_file_name f) in
192192
let rust_f = open_file_for_writing rust_fname in

0 commit comments

Comments
 (0)