Skip to content

Commit

Permalink
Filter assumed definitions in MiniRust
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kM committed Feb 11, 2025
1 parent 387741b commit 58a7ffb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/OptimizeMiniRust.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1297,4 +1297,12 @@ let simplify_minirust files =
have introduced unit statements *)
let files = map_funs remove_trailing_unit#visit_expr files in
let files = add_derives (compute_derives files) files in

(* Remove Assumed definitions, and filter empty files to avoid spurious code generation *)
let files = List.filter_map (fun (x, l) ->
(* Filter out assumed declarations *)
match List.filter (function | Assumed _ -> false | _ -> true) l with
| [] -> None (* No declaration left, we do not keep this file *)
| l -> Some (x, l)
) files in
files

0 comments on commit 58a7ffb

Please sign in to comment.