Vtable Support for Closures #16
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is to contribute to AeneasVerif#762 to add vtable support for closures.
Basically, the required changes are:
translate_rvaluein filetranslate_bodies.rs.translate_trait_objects.rsto add the vtable instance support.TraitImplReffor the vtable instance, referring to the translated closure impl.call,call_once&call_mutwhen required.compute_vtable_metadata.rs) works correctly for also the closures case.For the first phase, the mechanism should be closely related to the current mechanism of translating closures in
translate_closures.rsand the calls to this module. More importantly, to make sure that it works well with the second phase of implementing vtable instance, the registration should put something whose FullDef is ahax::FullDefKind::Closure.For the last case for the vtable metadata pass. If the
Dropis automatically implemented & extracted for the closures, this is straightfoward and needs no extra handling. Otherwise, if the drop shim is to implement by hand, this involves a similar mechanism like theTuplecase.