Skip to content

Build a new incr comp session dir from scratch every time#159287

Draft
bjorn3 wants to merge 2 commits into
rust-lang:mainfrom
bjorn3:incr_comp_session_from_scratch
Draft

Build a new incr comp session dir from scratch every time#159287
bjorn3 wants to merge 2 commits into
rust-lang:mainfrom
bjorn3:incr_comp_session_from_scratch

Conversation

@bjorn3

@bjorn3 bjorn3 commented Jul 14, 2026

Copy link
Copy Markdown
Member

Rather than copying the old incr comp dir and then modifying it. This saves a copy/hardlink for files that are modified. And it removes the need for accurate work product tracking to avoid accumulating cruft, which is non-trivial. We don't accurately track the pre-LTO bitcode files for ThinLTO for example.

Based on #159225
Part of rust-lang/compiler-team#908

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 14, 2026
@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 added the A-incr-comp Area: Incremental compilation label Jul 14, 2026
@rust-bors

This comment has been minimized.

@bjorn3
bjorn3 force-pushed the incr_comp_session_from_scratch branch 2 times, most recently from bf1a4e3 to 50ba28a Compare July 21, 2026 09:35
@rust-log-analyzer

This comment has been minimized.

This will allow introducing a separate incr comp session dir for the
post LTO artifacts in the future. In addition it statically encodes the
lifetime of the incr comp session rather than requiring an enum behind a
mutex stored in the Session.
@bjorn3
bjorn3 force-pushed the incr_comp_session_from_scratch branch from 50ba28a to 68660f2 Compare July 21, 2026 14:00
@rust-log-analyzer

This comment has been minimized.

Rather than copying the old incr comp dir and then modifying it. This
saves a copy/hardlink for files that are modified. And it removes the
need for accurate work product tracking to avoid accumulating cruft,
which is non-trivial. We don't accurately track the pre-LTO bitcode
files for ThinLTO for example.

FIXME cleanup
@bjorn3
bjorn3 force-pushed the incr_comp_session_from_scratch branch from 68660f2 to 1f2a9e3 Compare July 21, 2026 14:43
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_borrowck v0.0.0 (/checkout/compiler/rustc_borrowck)
warning: unused variable: `bitcode_path`
    --> compiler/rustc_codegen_ssa/src/back/write.rs:2269:9
     |
2269 |     let bitcode_path = in_incr_comp_dir_sess(tcx.incr_comp_session.unwrap(), &filename);
     |         ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_bitcode_path`
     |
     = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default

[RUSTC-TIMING] rustc_codegen_ssa test:false 3.565
error: `rustc_codegen_ssa` (lib) generated 1 warning (run `cargo fix --lib -p rustc_codegen_ssa` to apply 1 suggestion)

@rust-bors

rust-bors Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #159728) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

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

Labels

A-incr-comp Area: Incremental compilation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

3 participants