<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/c-to-rust-migration-by-luca-palmieri-from-mainmatter-rmmgwzjbp" -->

---
title: C++ to Rust Migration: By Luca Palmieri from Mainmatter
description: C and C++ to Rust migrations are increasingly practical, with more teams adopting Rust for memory safety, maintainability, and performance. Luca Palmieri from...
canonical: https://daily.dev/posts/c-to-rust-migration-by-luca-palmieri-from-mainmatter-rmmgwzjbp
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: C++ to Rust Migration: By Luca Palmieri from Mainmatter | daily.dev
og:description: C and C++ to Rust migrations are increasingly practical, with more teams adopting Rust for memory safety, maintainability, and performance. Luca Palmieri from...
og:url: https://daily.dev/posts/c-to-rust-migration-by-luca-palmieri-from-mainmatter-rmmgwzjbp
og:image: https://api.daily.dev/og/posts/RmMgwZjbp.png
og:image:alt: C++ to Rust Migration: By Luca Palmieri from Mainmatter
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.

# C++ to Rust Migration: By Luca Palmieri from Mainmatter

**[JetBrains](https://daily.dev/sources/jetbrains)** · 11 min read · 4 upvotes · 0 comments

## Summary

C and C++ to Rust migrations are increasingly practical, with more teams adopting Rust for memory safety, maintainability, and performance. Luca Palmieri from Mainmatter outlines when migration makes sense (performance-sensitive, concurrent, security-critical, or high-scale systems) and two main strategies: full rewrites (suitable for small, well-tested codebases with stable APIs) and incremental migration (safer for large, active, or customer-deployed systems). The recommended incremental approach starts from leaf modules in the dependency graph to solve build, linking, FFI, and CI integration problems early before tackling complex components. Rust FFI boundaries require careful ownership discipline — whoever allocates memory should free it — and unsafe code must be treated as a first-class design surface, not throwaway glue. Vertical slices through the stack are an alternative that shows business value faster but introduces more complexity upfront.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.jetbrains.com/rust/2026/07/27/cpp-to-rust-migration>

## Questions this post answers

### Should I do a full rewrite or an incremental migration when moving a C++ codebase to Rust?

Incremental migration is safer for most large, active, or customer-deployed systems, while full rewrites only make sense for small codebases with an exhaustive black-box test suite, a stable API surface, and a controlled deployment environment where shadow traffic and gradual rollout are possible. Incremental migration starts with isolated, dependency-free modules and expands gradually as confidence builds.

_daily.dev surfaces migration strategy debates like rewrite versus incremental for teams weighing a C++ to Rust move._

### Where should a team start when migrating a C or C++ codebase to Rust module by module?

Start from the leaves of the module dependency graph: modules with no or few dependencies on the rest of the system, so the first Rust code only needs to be callable from existing C or C++ code rather than calling into it. This lets a team solve build system, linking, sanitizer, and CI integration problems on a low-complexity module before tackling harder parts.

_Developers planning a leaf-first Rust migration can track this approach and related patterns on daily.dev._

### What is the safest ownership rule for handling memory across a Rust and C FFI boundary?

Whoever allocates memory should be responsible for freeing it. Avoid allocating in C and freeing in Rust, or vice versa, unless the boundary is designed very carefully, since crossing raw pointers between Rust and C removes the compiler's borrow-checking safety net and forces the programmer to manually track pointer lifetime, aliasing, and ownership.

_daily.dev helps engineers navigating tricky Rust FFI ownership rules keep up with real-world migration lessons._

## Similar posts on daily.dev

- [Rewriting the world in Rust — Bitfield Consulting](https://daily.dev/posts/rewriting-the-world-in-rust-bitfield-consulting-vxpqrwzmv) · Bitfield Consulting · 69 upvotes · 8 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
- [Rewriting in Rust: Performance, Failures, 2026 Reality Check](https://daily.dev/posts/rewriting-in-rust-performance-failures-2026-reality-check-pzp9w9mws) · JetBrains · 5 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/c-to-rust-migration-by-luca-palmieri-from-mainmatter-rmmgwzjbp)

```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":"C++ to Rust Migration: By Luca Palmieri from Mainmatter","url":"https://daily.dev/posts/c-to-rust-migration-by-luca-palmieri-from-mainmatter-rmmgwzjbp","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/c-to-rust-migration-by-luca-palmieri-from-mainmatter-rmmgwzjbp"},"datePublished":"2026-07-27T13:03:11.933Z","dateModified":"2026-09-14T08:46:52.668Z","description":"C and C++ to Rust migrations are increasingly practical, with more teams adopting Rust for memory safety, maintainability, and performance. Luca Palmieri from...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d07d5b5d15c72f29d24e8d54be82a591?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d07d5b5d15c72f29d24e8d54be82a591?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"JetBrains","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":"JetBrains","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/53ecf0c676f34b3896ee109609d91efa","url":"https://daily.dev/sources/jetbrains"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/c-to-rust-migration-by-luca-palmieri-from-mainmatter-rmmgwzjbp","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"rust,c++","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"JetBrains","item":"https://daily.dev/sources/jetbrains"},{"@type":"ListItem","position":3,"name":"C++ to Rust Migration: By Luca Palmieri from Mainmatter"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/c-to-rust-migration-by-luca-palmieri-from-mainmatter-rmmgwzjbp#faq","mainEntity":[{"@type":"Question","name":"Should I do a full rewrite or an incremental migration when moving a C++ codebase to Rust?","acceptedAnswer":{"@type":"Answer","text":"Incremental migration is safer for most large, active, or customer-deployed systems, while full rewrites only make sense for small codebases with an exhaustive black-box test suite, a stable API surface, and a controlled deployment environment where shadow traffic and gradual rollout are possible. Incremental migration starts with isolated, dependency-free modules and expands gradually as confidence builds. daily.dev surfaces migration strategy debates like rewrite versus incremental for teams weighing a C++ to Rust move."}},{"@type":"Question","name":"Where should a team start when migrating a C or C++ codebase to Rust module by module?","acceptedAnswer":{"@type":"Answer","text":"Start from the leaves of the module dependency graph: modules with no or few dependencies on the rest of the system, so the first Rust code only needs to be callable from existing C or C++ code rather than calling into it. This lets a team solve build system, linking, sanitizer, and CI integration problems on a low-complexity module before tackling harder parts. Developers planning a leaf-first Rust migration can track this approach and related patterns on daily.dev."}},{"@type":"Question","name":"What is the safest ownership rule for handling memory across a Rust and C FFI boundary?","acceptedAnswer":{"@type":"Answer","text":"Whoever allocates memory should be responsible for freeing it. Avoid allocating in C and freeing in Rust, or vice versa, unless the boundary is designed very carefully, since crossing raw pointers between Rust and C removes the compiler's borrow-checking safety net and forces the programmer to manually track pointer lifetime, aliasing, and ownership. daily.dev helps engineers navigating tricky Rust FFI ownership rules keep up with real-world migration lessons."}}]}
```

