Skip to content

Commit

Permalink
Add "Coccinelle for Rust" page
Browse files Browse the repository at this point in the history
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Miguel Ojeda <[email protected]>
  • Loading branch information
JuliaLawall authored and ojeda committed Nov 3, 2023
1 parent 88605ef commit c8cd08e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

## Tools

- [Coccinelle for Rust](Coccinelle-for-Rust.md)

## Users

- [NVMe Driver](NVMe-driver.md)
Expand Down
37 changes: 37 additions & 0 deletions src/Coccinelle-for-Rust.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Coccinelle for Rust

Coccinelle is a tool for automatic program matching and transformation that
was originally developed for making large scale changes to the Linux kernel
source code (ie, C code). Matches and transformations are driven by
user-specific transformation rules having the form of abstracted patches,
referred to as semantic patches. As the Linux kernel, and systems software
more generally, is starting to adopt Rust, we are developing Coccinelle for
Rust, to make the power of Coccinelle available to Rust codebases.

## Examples

Changing a method call sequence in the Rust implementation:

![Changing a method call sequence in the Rust implementation](Coccinelle-for-Rust/tcx.png)

Merging some lifetimes in tokio:

![Merging some lifetimes in tokio](Coccinelle-for-Rust/tokio.png)

## Current status

Coccinelle for Rust is currently a prototype. It relies on Rust Analyzer
for parsing and rustfmt for pretty printing. It mainly supports matching
and transformation of expressions and types, but reasoning about control
flow is not yet supported.

## Availability

[Coccinelle for Rust](https://gitlab.inria.fr/coccinelle/coccinelleforrust.git)

[A recent talk about Coccinelle for Rust](https://gitlab.inria.fr/coccinelle/coccinelleforrust/-/blob/main/talks/rfl.pdf)

## Contact

- Julia Lawall: [[email protected]](mailto:[email protected])
- Tathagata Roy: [[email protected]](mailto:[email protected])
Binary file added src/Coccinelle-for-Rust/tcx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Coccinelle-for-Rust/tokio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c8cd08e

Please sign in to comment.