Skip to content

borrowck: Simplify deps to build compiler 30s faster - #160358

Open
joshtriplett wants to merge 2 commits into
rust-lang:mainfrom
joshtriplett:borrowck-simplify-deps
Open

borrowck: Simplify deps to build compiler 30s faster#160358
joshtriplett wants to merge 2 commits into
rust-lang:mainfrom
joshtriplett:borrowck-simplify-deps

Conversation

@joshtriplett

Copy link
Copy Markdown
Member

rustc_borrowck uses two helpers from rustc_traits. One of them is re-exported from rustc_trait_selection, and the other can easily move to rustc_trait_selection.

Making rustc_borrowck use these helpers from rustc_trait_selection directly, and eliminating the rustc_traits dependency, allows starting to build rustc_borrowck earlier, which substantially speeds up building the compiler because rustc_borrowck is one of the last things to build.

On my system, this speeds up the rustc build by a little over 30s.

… it from there

`rustc_borrowck` uses `type_op_prove_predicate_with_cause` from
`rustc_traits`, but is a simple helper that can live in
`rustc_trait_selection` instead. Move it there.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 1, 2026
@rustbot

rustbot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, types
  • compiler, types expanded to 75 candidates
  • Random selection from 18 candidates

@rust-log-analyzer

This comment has been minimized.

`rustc_borrowck` now only uses `rustc_traits` for one helper that it
re-exports from `rustc_trait_selection`. Use the helper directly from
`rustc_trait_selection`, and eliminate the dependency.
@joshtriplett
joshtriplett force-pushed the borrowck-simplify-deps branch from 33ec3dd to 425c312 Compare August 1, 2026 23:06
@rustbot

rustbot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@mejrs

mejrs commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 2, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 2, 2026
borrowck: Simplify deps to build compiler 30s faster
@rust-bors

rust-bors Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: f1bf412 (f1bf412ba34726c72fd27fb00f7b35c908c57318)
Base parent: 73dc916 (73dc9167f1cd099e525c9ade2e068d1907b78564)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (f1bf412): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary 3.4%, secondary 0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.4% [0.5%, 6.4%] 2
Regressions ❌
(secondary)
0.5% [0.4%, 0.6%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.4% [0.5%, 6.4%] 2

Cycles

Results (primary 0.1%, secondary -0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.7% [0.5%, 1.1%] 5
Regressions ❌
(secondary)
0.7% [0.5%, 1.0%] 6
Improvements ✅
(primary)
-0.7% [-0.9%, -0.6%] 4
Improvements ✅
(secondary)
-2.1% [-2.9%, -1.0%] 4
All ❌✅ (primary) 0.1% [-0.9%, 1.1%] 9

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 490.553s -> 487.967s (-0.53%)
Artifact size: 390.33 MiB -> 390.35 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 2, 2026
@joshtriplett

Copy link
Copy Markdown
Member Author

AIUI, the perf suite bootstrap timing uses -j1, so it isn't picking up on improvements that primarily help builds with higher parallelism. This was a 30s improvement on my system with -j12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants