<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/coccinelle-for-rust-progress-report-dkwhmqo2r" -->

---
title: Coccinelle for Rust progress report | daily.dev
description: Coccinelle for Rust (CfR) is a tool that brings Coccinelle&#x27;s semantic patch capabilities to Rust codebases, originally developed for large-scale C/Linux kernel...
canonical: https://daily.dev/posts/coccinelle-for-rust-progress-report-dkwhmqo2r
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Coccinelle for Rust progress report | daily.dev
og:description: Coccinelle for Rust (CfR) is a tool that brings Coccinelle&#x27;s semantic patch capabilities to Rust codebases, originally developed for large-scale C/Linux kernel...
og:url: https://daily.dev/posts/coccinelle-for-rust-progress-report-dkwhmqo2r
og:image: https://api.daily.dev/og/posts/DKwHMqO2r.png
og:image:alt: Coccinelle for Rust progress report
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Coccinelle for Rust progress report

**[Collabora Blog](https://daily.dev/sources/collabora)** · 5 min read · 0 upvotes · 0 comments

## Summary

Coccinelle for Rust (CfR) is a tool that brings Coccinelle's semantic patch capabilities to Rust codebases, originally developed for large-scale C/Linux kernel transformations. The progress report covers key developments: integration of the Computational Tree Logic (CTL) engine shared with Coccinelle for C, parser improvements that delegate Rust syntax to Rust Analyzer while handling SmPL-specific constructs (ellipses, disjunctions, modifiers), and optimizations like replacing lists with RefCells and hash tables to handle Rust's expression-dominated AST. Practical examples show how semantic patches can automate bulk refactors—like updating 50+ call sites or changing function signatures across a codebase—that would be tedious or error-prone by hand. Macro transformation is supported only for function-call-style macros to avoid ambiguity. The project is available on GitLab and aims to reach feature parity with Coccinelle for C.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.collabora.com/news-and-blog/blog/2025/06/25/coccinelle-for-rust-progress-report>

## Questions this post answers

### What is Coccinelle for Rust and how does it differ from Coccinelle for C?

Coccinelle for Rust (CfR) extends Coccinelle's semantic patch system to Rust codebases. It reuses the same Computational Tree Logic (CTL-VW) engine as Coccinelle for C with minor changes, but must handle Rust's expression-dominated AST differently — blocks can appear anywhere an expression is allowed, making pattern matching more computationally intensive. Optimizations like replacing lists with RefCells and hash tables address this. The SmPL parser delegates Rust syntax to Rust Analyzer rather than reimplementing it.

_Rust developers automating large-scale refactors across kernel or systems codebases follow tools like CfR on daily.dev._

### How does Coccinelle for Rust handle macro transformation in semantic patches?

CfR supports only macros that look like function calls to avoid ambiguity from non-standard macro syntax. For example, foo!(a, b, c) or foo![a; b; c] are supported, but macros with non-comma-separated tokens like foo!(a b c) are not. This restriction prevents discrepancies when matching macro invocations across a codebase.

_Teams maintaining Rust systems code track semantic tooling constraints like these on daily.dev._

## Similar posts on daily.dev

- [Progress toward compiling Linux with gccrs](https://daily.dev/posts/progress-toward-compiling-linux-with-gccrs-nqdzu2re0) · Lobsters · 3 upvotes · 1 comments
- [RFC Patches Posted For Klint Integration With The Linux Kernel: Rust-Based Linting Tool](https://daily.dev/posts/rfc-patches-posted-for-klint-integration-with-the-linux-kernel-rust-based-linting-tool-rgffwztiy) · Phoronix · 0 upvotes · 0 comments
- [Automatically Translating C to Rust – Communications of the ACM](https://daily.dev/posts/automatically-translating-c-to-rust-communications-of-the-acm-o6bpcy6bu) · Hacker News · 5 upvotes · 1 comments
- [Rust Glancer](https://daily.dev/posts/rust-glancer-luznk4gex) · matklad · 21 upvotes · 0 comments

---

Tags: [#linux](https://daily.dev/tags/linux), [#rust](https://daily.dev/tags/rust)

[View this post on daily.dev](https://daily.dev/posts/coccinelle-for-rust-progress-report-dkwhmqo2r)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Coccinelle for Rust progress report","url":"https://daily.dev/posts/coccinelle-for-rust-progress-report-dkwhmqo2r","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/coccinelle-for-rust-progress-report-dkwhmqo2r"},"datePublished":"2026-08-11T08:57:24.179Z","dateModified":"2026-08-11T09:40:54.848Z","description":"Coccinelle for Rust (CfR) is a tool that brings Coccinelle's semantic patch capabilities to Rust codebases, originally developed for large-scale C/Linux kernel...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b6d30fb7c498d327ecb182cd9107ec5a?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b6d30fb7c498d327ecb182cd9107ec5a?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Collabora Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Collabora Blog","logo":"https://media.daily.dev/image/upload/s--ZGZ0FjqS--/f_auto,q_auto/v1786438306/logos/collabora?_a=BAMAMicg0","url":"https://daily.dev/sources/collabora"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/coccinelle-for-rust-progress-report-dkwhmqo2r","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"linux,rust","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Collabora Blog","item":"https://daily.dev/sources/collabora"},{"@type":"ListItem","position":3,"name":"Coccinelle for Rust progress report"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/coccinelle-for-rust-progress-report-dkwhmqo2r#faq","mainEntity":[{"@type":"Question","name":"What is Coccinelle for Rust and how does it differ from Coccinelle for C?","acceptedAnswer":{"@type":"Answer","text":"Coccinelle for Rust (CfR) extends Coccinelle's semantic patch system to Rust codebases. It reuses the same Computational Tree Logic (CTL-VW) engine as Coccinelle for C with minor changes, but must handle Rust's expression-dominated AST differently — blocks can appear anywhere an expression is allowed, making pattern matching more computationally intensive. Optimizations like replacing lists with RefCells and hash tables address this. The SmPL parser delegates Rust syntax to Rust Analyzer rather than reimplementing it. Rust developers automating large-scale refactors across kernel or systems codebases follow tools like CfR on daily.dev."}},{"@type":"Question","name":"How does Coccinelle for Rust handle macro transformation in semantic patches?","acceptedAnswer":{"@type":"Answer","text":"CfR supports only macros that look like function calls to avoid ambiguity from non-standard macro syntax. For example, foo!(a, b, c) or foo![a; b; c] are supported, but macros with non-comma-separated tokens like foo!(a b c) are not. This restriction prevents discrepancies when matching macro invocations across a codebase. Teams maintaining Rust systems code track semantic tooling constraints like these on daily.dev."}}]}
```

