From 497e1113c9a8dfa7db6c647d856da9e97e4cc076 Mon Sep 17 00:00:00 2001 From: Matyas Susits Date: Tue, 14 Jul 2026 17:28:08 +0200 Subject: [PATCH 1/5] add Relink Don't Rebuild goal --- src/2026/relink-dont-rebuild.md | 67 +++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/2026/relink-dont-rebuild.md diff --git a/src/2026/relink-dont-rebuild.md b/src/2026/relink-dont-rebuild.md new file mode 100644 index 00000000..7056a4b4 --- /dev/null +++ b/src/2026/relink-dont-rebuild.md @@ -0,0 +1,67 @@ +# Relink Don't Rebuild + +| Metadata | | +| :--------------- | -------------------------------------------------------------------------------- | +| Point of contact | @susitsm | +| Status | Proposed | +| What and why | Massive speedup | +| Roadmap | Fast Builds | +| Tracking issue | | +| Other tracking issues | [https://github.com/rust-lang/rust/issues/158844] | +| Zulip channel | [https://rust-lang.zulipchat.com/#narrow/channel/604410-t-compiler.2Frelink-dont-rebuild] | + +## Summary + +Implement the MCP [Relink Don't Rebuild](https://github.com/rust-lang/compiler-team/issues/790), which can give large speedups on [certain edits](https://github.com/rust-lang/cargo/issues/14604#issuecomment-4371471225) when rebuilding large projects with many crates. + +There is an existing implementation waiting for review. The first goal is to get that through the review process, integrate with cargo and get it to nightly users. + + +## Motivation + + +### The status quo + +For a long time, the preferred method for speeding up compilation of large projects was to split them into smaller crates. Today, large projects consist of many crates with a complex dependency graph. When a crate is edited, it causes all dependents to recompile, leading to slow compile times even when the edited crate is small. + +### What we propose to do about it + +Calculate the public API hash of crates and only recompile dependents when it changes, greatly improving iteration speed for edits not changing the public API of a crate. This is similar to how C compilers only recompile the edited `.c` file then relink the final binary. Other code will not get recompiled unless the header file changes. + +The largest concern of adding such public API hash is maintainability: adding new language features should automatically get added to the public API hash, otherwise RDR can quickly become riddled with silent miscompiles. The proposed implementation solves this problem by building on the metadata ("header") files produced by rustc, automatically integrating any new data added to it. + +### Work items over the next year + +#### Usable implementation in nightly, with limitations. +| Task | Owner(s) | Notes | +| ----------- | -------- | ----- | +| Split up the existing implementation into smaller PRs, review | @susitsm, reviewer | | +| Cargo integration | @susitsm | | +| Add a mode that ignores spans | @susitsm | | + +#### Stabilization +| Task | Owner(s) | Notes | +| ----------- | -------- | ----- | +| Restore compiler diagnostics | @susitsm | | +| Optimize the implementation | @susitsm | | +| Add an "update spans" mode to rustc | @susitsm | | +| Integrate with rustdoc | @susitsm | | + +## Team asks + +| Team | Support level | Notes | +| ---------- | ------------- | --------------------------------------- | +| [cargo] | Small | review cargo integration | +| [compiler] | Medium | dedicated reviewer | +| [compiler] | Large | Only for "update spans" mode. It would need to change how spans are stored in diagnostics | + +## Funding + +| Purpose | Cost | Funded | Sponsor(s) | +|---------|------|--------|------------| +| Contributor - Nightly implementation - 3 months: cargo integration 1 month. Split up, review, ignore spans 2 months | Ask | No | | +| Reviewer - Nightly implementation | Ask | No | | +| Contributor - Stabilization - 9 months: optimize 2 months, restore diagnostics 1 month, "update spans" mode 5 months, rustdoc 1 month | Ask | No | | + + +## Frequently asked questions From de8b33a7f1c7a4c8ed1dc950ea5bb5bd7cc39332 Mon Sep 17 00:00:00 2001 From: Matyas Susits Date: Wed, 15 Jul 2026 11:32:12 +0200 Subject: [PATCH 2/5] Update src/2026/relink-dont-rebuild.md Co-authored-by: Nurzhan Saken --- src/2026/relink-dont-rebuild.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/2026/relink-dont-rebuild.md b/src/2026/relink-dont-rebuild.md index 7056a4b4..b79ddcac 100644 --- a/src/2026/relink-dont-rebuild.md +++ b/src/2026/relink-dont-rebuild.md @@ -4,7 +4,7 @@ | :--------------- | -------------------------------------------------------------------------------- | | Point of contact | @susitsm | | Status | Proposed | -| What and why | Massive speedup | +| What and why | Massive speedup of rebuilds in large multi-crate projects | | Roadmap | Fast Builds | | Tracking issue | | | Other tracking issues | [https://github.com/rust-lang/rust/issues/158844] | From 9a5e994693f80fe1cf5f800d0cf60d3cf247207e Mon Sep 17 00:00:00 2001 From: Matyas Susits Date: Wed, 15 Jul 2026 11:34:52 +0200 Subject: [PATCH 3/5] RDR: remove second compiler team ask --- src/2026/relink-dont-rebuild.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/2026/relink-dont-rebuild.md b/src/2026/relink-dont-rebuild.md index b79ddcac..9e7306aa 100644 --- a/src/2026/relink-dont-rebuild.md +++ b/src/2026/relink-dont-rebuild.md @@ -53,7 +53,6 @@ The largest concern of adding such public API hash is maintainability: adding ne | ---------- | ------------- | --------------------------------------- | | [cargo] | Small | review cargo integration | | [compiler] | Medium | dedicated reviewer | -| [compiler] | Large | Only for "update spans" mode. It would need to change how spans are stored in diagnostics | ## Funding From baddcc717d462a48fc501e83b8858bebf5d0376d Mon Sep 17 00:00:00 2001 From: Matyas Susits Date: Wed, 15 Jul 2026 12:54:07 +0200 Subject: [PATCH 4/5] RDR: move time estimates to work item notes, expand on the benefits of each subgoal in the funding section --- src/2026/relink-dont-rebuild.md | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/2026/relink-dont-rebuild.md b/src/2026/relink-dont-rebuild.md index 9e7306aa..c48e1992 100644 --- a/src/2026/relink-dont-rebuild.md +++ b/src/2026/relink-dont-rebuild.md @@ -35,17 +35,17 @@ The largest concern of adding such public API hash is maintainability: adding ne #### Usable implementation in nightly, with limitations. | Task | Owner(s) | Notes | | ----------- | -------- | ----- | -| Split up the existing implementation into smaller PRs, review | @susitsm, reviewer | | -| Cargo integration | @susitsm | | -| Add a mode that ignores spans | @susitsm | | +| Split up the existing implementation into smaller PRs, review | @susitsm, reviewer | 2 months | +| Cargo integration | @susitsm | 1 month | +| Add a mode that ignores spans | @susitsm | | #### Stabilization | Task | Owner(s) | Notes | | ----------- | -------- | ----- | -| Restore compiler diagnostics | @susitsm | | -| Optimize the implementation | @susitsm | | -| Add an "update spans" mode to rustc | @susitsm | | -| Integrate with rustdoc | @susitsm | | +| Restore compiler diagnostics | @susitsm | 1 month | +| Optimize the implementation | @susitsm | 2 months | +| Add an "update spans" mode to rustc | @susitsm | 5 months | +| Integrate with rustdoc | @susitsm | 1 month | ## Team asks @@ -56,11 +56,21 @@ The largest concern of adding such public API hash is maintainability: adding ne ## Funding +The duration of the project is 12 months. With distinct subgoals which can be funded independently. + +- Month 1-3 (Usable implementation in nightly) + - This stage could already provide benefits for nightly users, at the cost of possibly incorrect line info in diagnostics and debuginfo of dependents. This would greatly help `cargo check` runs in IDE-s, since debuginfo is not a concern there. + - Some diagnostics will not be available + - Lot of the work is already done, needs review. +- Month 4-12 (Stabilization) + - Performance optimizations + - Fixing the holes required for a stable release + | Purpose | Cost | Funded | Sponsor(s) | |---------|------|--------|------------| -| Contributor - Nightly implementation - 3 months: cargo integration 1 month. Split up, review, ignore spans 2 months | Ask | No | | +| Contributor - Nightly implementation | Ask | No | | | Reviewer - Nightly implementation | Ask | No | | -| Contributor - Stabilization - 9 months: optimize 2 months, restore diagnostics 1 month, "update spans" mode 5 months, rustdoc 1 month | Ask | No | | +| Contributor - Stabilization | Ask | No | | ## Frequently asked questions From a74b97b1658d3240df6d365ee925e3a761386010 Mon Sep 17 00:00:00 2001 From: Matyas Susits Date: Fri, 17 Jul 2026 08:15:30 +0200 Subject: [PATCH 5/5] RDR: standardize tracking issue and zulip links --- src/2026/relink-dont-rebuild.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/2026/relink-dont-rebuild.md b/src/2026/relink-dont-rebuild.md index c48e1992..305737b7 100644 --- a/src/2026/relink-dont-rebuild.md +++ b/src/2026/relink-dont-rebuild.md @@ -7,8 +7,10 @@ | What and why | Massive speedup of rebuilds in large multi-crate projects | | Roadmap | Fast Builds | | Tracking issue | | -| Other tracking issues | [https://github.com/rust-lang/rust/issues/158844] | -| Zulip channel | [https://rust-lang.zulipchat.com/#narrow/channel/604410-t-compiler.2Frelink-dont-rebuild] | +| Other tracking issues | [rust-lang/rust#158844] | +| Zulip channel | [t-compiler/relink-dont-rebuild][zulip] | + +[zulip]: https://rust-lang.zulipchat.com/#narrow/channel/604410-t-compiler.2Frelink-dont-rebuild ## Summary