Skip to content

Commit 3acd15e

Browse files
committed
Fix pdb uplift when executable has dashes.
1 parent f9047dc commit 3acd15e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/cargo/core/compiler/build_context/target_info.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@ impl TargetInfo {
292292
suffix: ".pdb".to_string(),
293293
prefix: prefix.clone(),
294294
flavor: FileFlavor::DebugInfo,
295-
should_replace_hyphens: false,
295+
// rustc calls the linker with underscores, and the
296+
// filename is embedded in the executable.
297+
should_replace_hyphens: true,
296298
})
297299
}
298300
}

tests/testsuite/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4201,6 +4201,7 @@ fn uplift_pdb_of_bin_on_windows() {
42014201
let p = project()
42024202
.file("src/main.rs", "fn main() { panic!(); }")
42034203
.file("src/bin/b.rs", "fn main() { panic!(); }")
4204+
.file("src/bin/foo-bar.rs", "fn main() { panic!(); }")
42044205
.file("examples/c.rs", "fn main() { panic!(); }")
42054206
.file("tests/d.rs", "fn main() { panic!(); }")
42064207
.build();
@@ -4209,6 +4210,8 @@ fn uplift_pdb_of_bin_on_windows() {
42094210
assert!(p.target_debug_dir().join("foo.pdb").is_file());
42104211
assert!(p.target_debug_dir().join("b.pdb").is_file());
42114212
assert!(p.target_debug_dir().join("examples/c.pdb").exists());
4213+
assert!(p.target_debug_dir().join("foo-bar.exe").is_file());
4214+
assert!(p.target_debug_dir().join("foo_bar.pdb").is_file());
42124215
assert!(!p.target_debug_dir().join("c.pdb").exists());
42134216
assert!(!p.target_debug_dir().join("d.pdb").exists());
42144217
}

0 commit comments

Comments
 (0)