Coccinelle for Rust progress report (Collabora blog)
Over on the Collabora blog, Tathagata Roy has an updateon the progress of targeting the Coccinelle toolfor matching and transforming source code to Rust. The Coccinelle for Rustproject, which we covered in a 2024talk by Roy at Kangrejos, is addingthe ability to transform Rust programs and the goal is "
to bringCoccinelle For Rust at par with Coccinelle For C in terms of basicfunctionalities". There is still work to be done to get there, butprogress is being made in various areas.
Computational Tree Logic (CTL) is the heart of Coccinelle, which takes semantic patches and generalizes them over Rust files. Prior to using this engine, CfR used an ad-hoc method for matching patterns of code. This engine is the same as the one used for Coccinelle for C, with a few minor changes. Most of the changes were idiomatic but to the same effect. More information on the engine and its language (CTL-VW) can be found in the POPL Paper. With a standard engine, each step of the matching process can be logged, allowing us to learn and reuse the same design patterns from Coccinelle for C, including critical test cases.