AI Services Market
AI Services Market › Use cases › Software & DevOps
Software & DevOpsDone with Claude Nov 13, 2026

Rewrite Rust compiler code in bulk with a query-driven tool

The author has Claude build a mass static code rewriting tool that finds and rewrites compiler code (like LOCAL_CRATE_ID uses) to speed up Rust builds. · Nov 13, 2026

Rewrite Rust compiler code in bulk with a query-driven tool preview
What They Did
Rather than having an agent hunt through rustc for every place LOCAL_CRATE_ID is defined and used, the author had Claude build a mass static code rewriting tool. A query locates the code and its surroundings, and rewrite rules target those matches. The rewrites can be reviewed and debated ahead of time, then rerun on main or nightly.
How It Went
The work is unfinished and the author has no enticing numbers yet. It's also unclear whether big changes like all crates in one process or dropping memory are worth it.
Worth Knowing
Rewrites can be rerun on current main and applied to other people's open PRs, so you avoid maintaining a stale hard fork, though it takes some coordination with the compiler team.
Try it yourself with Claude

In my Rust codebase at [path to repo], find every place that uses [pattern or identifier, e.g. a specific constant or function call] and rewrite each one to [new form or approach]. Build a small reusable tool that finds matches with a structural query and applies the rewrite in bulk, rather than editing by hand. Run it on a copy first, then show me the diff summary and the build and test results before applying changes to the main branch. You're done when the project compiles, tests pass, and no old-pattern uses remain.

Read the original ↗