Module simplify_output

Source
Expand description

Passes that make the output simpler/easier to consume.

Modules§

hide_allocator_param
hide_marker_traits
index_intermediate_assigns
This micro-pass introduces intermediate assignments in preparation of crate::transform::simplify_output::index_to_function_calls, so as to avoid borrow-checking errors.
index_to_function_calls
Desugar array/slice index operations to function calls.
inline_promoted_consts
lift_associated_item_clauses
Move clauses on non-gat associated types to be parent clauses. The distinction is not semantically meaningful. We should ideally to this directly when translating but this is currently difficult; instead we do this as a post-processing pass.
ops_to_function_calls
Desugar some unary/binary operations and the array repeats to function calls. For instance, we desugar ArrayToSlice from an unop to a function call. This allows a more uniform treatment later on. TODO: actually transform all the unops and binops to function calls?
remove_nops
Remove the useless no-ops.
remove_unit_locals
remove_unused_locals
Remove the locals (which are not used for the input arguments) which are never used in the function bodies. This is useful to remove the locals with type Never. We actually check that there are no such local variables remaining afterwards.
remove_unused_self_clause
We have added an explicit Self: Trait clause to the function and global items that correspond to a trait method/associated const declaration. This pass removes the clause in question if it is not used by the item.
simplify_constants
The MIR constant expressions lead to a lot of duplication: there are for instance constant ADTs which duplicate the “regular” aggregated ADTs in the operands, constant references, etc. This reduces the number of cases to handle and eases the function translation in Aeneas.
unbind_item_vars
Replace variables bound at the top-level with Free vars. This is for convenience for consumers of the charon ast.
update_block_indices
Update the block indices to make sure they are consecutive