Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/ops/cargo_clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ fn clean_specs(
.to_string_lossy()
.into_owned();

let uplifted_path = uplift_dir.join(&uplifted_filename);
// Unremap file emitted for `-Ztrim-paths`.
let unremap = trim_paths::append_unremap_suffix(&uplifted_path);
clean_ctx.rm_rf(&unremap)?;

dirs_to_clean.mark_utf(uplift_dir, |filename| {
filename == uplifted_filename || filename == dep_info
});
Expand Down
20 changes: 20 additions & 0 deletions tests/testsuite/profile_trim_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,26 @@ fn unremap_file_with_cargo_clean() {

assert!(!unremap_file_path(&p.bin("foo")).exists());
assert_eq!(p.glob("target/**/*.trim-paths.jsonl").count(), 0);

// Test the new layout

p.cargo("clean -Ztrim-paths")
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
.run();

p.cargo("build -Ztrim-paths -Zbuild-dir-new-layout")
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
.run();

assert!(unremap_file_path(&p.bin("foo")).exists());
assert_eq!(p.glob("target/**/*.trim-paths.jsonl").count(), 2);

p.cargo("clean -p foo -Ztrim-paths -Zbuild-dir-new-layout")
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
.run();

assert!(!unremap_file_path(&p.bin("foo")).exists());
assert_eq!(p.glob("target/**/*.trim-paths.jsonl").count(), 0);
}

// MSVC always emits a PDB when debuginfo is on (which the unremap file requires),
Expand Down