Module Hax_engine.Phases

include sig ... end
module Simplify_question_marks = Phase_simplify_question_marks.Make

In THIR, there are no construct for question marks. Instead, Rustc desugars `e?` into the following:

module Local_mutation = Phase_local_mutation.Make
module Specialize = Phase_specialize.Make

This phase specializes certain specific method applications (according to their name and the type it is being used on) into plain functions.

module Newtype_as_refinement = Phase_newtype_as_refinement.Make

This phase transforms annotated struct definitions into (refined) type aliases.

module Traits_specs = Phase_traits_specs.Make

This phase adds specification to traits. For each method `f` in a trait, we add a `f_pre` and a `f_post`.

module Reconstruct_while_loops = Phase_reconstruct_while_loops.Make
module Functionalize_loops = Phase_functionalize_loops.Make
module Drop_needless_returns = Phase_drop_needless_returns.Make

This phase transforms `return e` expressions into `e` when `return e` is on an exit position.

module Simplify_match_return = Phase_simplify_match_return.Make

This phase rewrites `let pat = match ... ... => ..., ... => return ... ; e` into `match ... ... => let pat = ...; e`.

module Simplify_hoisting = Phase_simplify_hoisting.Make

This phase rewrites `let pat = match ... ... => ..., ... => return ... ; e` into `match ... ... => let pat = ...; e`.

module Rewrite_control_flow = Phase_rewrite_control_flow.Make

This phase finds control flow expression (`if` or `match`) with a `return` expression in one of the branches. We replace them by replicating what comes after in all the branches. This allows the `return` to be eliminated by `drop_needless_returns`. This phase should come after `phase_local_mutation`.

module Drop_match_guards = Phase_drop_match_guards.Make
module Drop_references = Phase_drop_references.Make
module Hoist_disjunctive_patterns = Phase_hoist_disjunctive_patterns.Make

This phase eliminates nested disjunctive patterns (leaving only shallow disjunctions). It moves the disjunctions up to the top-level pattern.

module Drop_sized_trait = Phase_drop_sized_trait.Make

This phase remove any occurence to the `core::marker::sized` trait. This trait appears a lot, but is generally not very useful in our backends.

module Reconstruct_for_loops = Phase_reconstruct_for_loops.Make
module Reconstruct_question_marks = Phase_reconstruct_question_marks.Make

In THIR, there are no construct for question marks. Instead, Rustc desugars `e?` into the following:

module Reconstruct_asserts = Phase_reconstruct_asserts.Make

This phase recognizes desugared `assert!(...)` to rewrite into `hax_lib::assert(..)`.

module And_mut_defsite = Phase_and_mut_defsite.Make
module Drop_blocks = Phase_drop_blocks.Make
module Trivialize_assign_lhs = Phase_trivialize_assign_lhs.Make
module Cf_into_monads = Phase_cf_into_monads.Make
module Reconstruct_for_index_loops = Phase_reconstruct_for_index_loops.Make
module Direct_and_mut = Phase_direct_and_mut.Make
module Transform_hax_lib_inline = Phase_transform_hax_lib_inline.Make

This phase transforms nodes like:

module Reject = Phase_reject