Module finish_translation

Source
Expand description

Passes that finish translation, i.e. required for the output to be a valid output.

Modules§

duplicate_defaulted_methods
Add missing methods to trait impls by duplicating the default method.
filter_invisible_trait_impls
We cannot filter trait impls by name before translating them, because we need to know the trait/type pair that is being implemented. We therefore filter them in a post-processing pass.
insert_assign_return_unit
When the function’s return type is unit, the generated MIR doesn’t set the return value to (). This can be a concern: in the case of AENEAS, it means the return variable contains ⊥ upon returning. For this reason, when the function has return type unit, we insert an extra assignment just before returning.
insert_ptr_metadata
insert_storage_lives
Add missing StorageLives – in MIR, some locals are considered “always” initialised, and have no StorageLive and StorageDead instructions associated; this always includes the arguments and the return value, but also sometimes includes other locals. We make sure these additional locals get initialised at the start of the function if they’re used anywhere.
remove_unused_methods
Remove the trait/impl methods that were not translated.