diff --git a/src/cargo/core/compiler/build_context/target_info.rs b/src/cargo/core/compiler/build_context/target_info.rs index a8561278e58..8d0d462a731 100644 --- a/src/cargo/core/compiler/build_context/target_info.rs +++ b/src/cargo/core/compiler/build_context/target_info.rs @@ -462,6 +462,16 @@ impl TargetInfo { // preserved. should_replace_hyphens: true, }) + } else { + ret.push(FileType { + suffix: ".dwp".to_string(), + prefix: prefix.clone(), + flavor: FileFlavor::DebugInfo, + crate_type: Some(crate_type), + // Currently no known reason to prefer one naming scheme + // over the other, but the macos approach seems friendlier. + should_replace_hyphens: false, + }) } } diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 33fc7d30395..3ead8fb4778 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -4788,9 +4788,14 @@ fn cdylib_final_outputs() { } #[cargo_test] -// NOTE: Windows MSVC and wasm32-unknown-emscripten do not use metadata. Skip them. +// NOTE: Windows MSVC and wasm32-unknown-emscripten do not use metadata. // See -#[cfg(not(all(target_os = "windows", target_env = "msvc")))] +// +// We skip both msvc windows and gnu windows (mingw) because their naming schemes for +// debuginfo files results in conflicts in this case. msvc makes two `foo.pdb` files +// while mingw makes two `foo.dwp` files. These files clobber eachother, +// corrupting the build output. +#[cfg(not(target_os = "windows"))] fn no_dep_info_collision_when_cdylib_and_bin_coexist() { let p = project() .file(