-
-
Notifications
You must be signed in to change notification settings - Fork 15k
no-op remap_path_prefix change invalidates incremental cache #132132
Copy link
Copy link
Open
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-incr-compArea: Incremental compilationArea: Incremental compilationA-path-remappingArea: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc.Area: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-incr-compWorking group: Incremental compilationWorking group: Incremental compilation
Metadata
Metadata
Assignees
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-incr-compArea: Incremental compilationArea: Incremental compilationA-path-remappingArea: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc.Area: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-incr-compWorking group: Incremental compilationWorking group: Incremental compilation
Type
Fields
Give feedbackNo fields configured for issues without a type.
I'm building rust code in a CI environment, setting -Cincremental to a shared location. CI allocates a new working directory for each build. To prevent leaking that info to the debug info, we set
--remap_path_prefix=${PWD}=to eliminate the unwanted prefix from the debug info.I expected this will reuse the incremental build cache, but it's not:
Further inspection of how the hash being generated, I found:
rust/compiler/rustc_session/src/options.rs
Lines 195 to 222 in 017ae1b
for our case,
working_diralways uses remapped_path"", which is stable over build. but theremap_path_prefixis different everytime. and the logic for populatingworking_diris at:rust/compiler/rustc_session/src/config.rs
Lines 2690 to 2695 in 017ae1b
So to get correct remapped
working_dir, I must set--remap-path-prefix, but setting it will changeremap_path_prefixand causing hash mismatch:rust/compiler/rustc_incremental/src/persist/load.rs
Lines 159 to 164 in 017ae1b
Meta
rustc --version --verbose: