From f975c2e5889c4a6b16568e9b68ec9ec85ec8f795 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 4 Jun 2020 16:14:17 -0700 Subject: [PATCH] Don't hash executable filenames on apple platforms. --- src/cargo/core/compiler/context/compilation_files.rs | 9 ++++++++- tests/testsuite/build.rs | 2 +- tests/testsuite/collisions.rs | 4 ++-- tests/testsuite/freshness.rs | 6 +++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/cargo/core/compiler/context/compilation_files.rs b/src/cargo/core/compiler/context/compilation_files.rs index 04d75fe0ac5..5d2cf4efce9 100644 --- a/src/cargo/core/compiler/context/compilation_files.rs +++ b/src/cargo/core/compiler/context/compilation_files.rs @@ -608,6 +608,12 @@ fn should_use_metadata(bcx: &BuildContext<'_, '_>, unit: &Unit) -> bool { // - wasm32 executables: When using emscripten, the path to the .wasm file // is embedded in the .js file, so we don't want the hash in there. // TODO: Is this necessary for wasm32-unknown-unknown? + // - apple executables: The executable name is used in the dSYM directory + // (such as `target/debug/foo.dSYM/Contents/Resources/DWARF/foo-64db4e4bf99c12dd`). + // Unfortunately this causes problems with our current backtrace + // implementation which looks for a file matching the exe name exactly. + // See https://github.com/rust-lang/rust/issues/72550#issuecomment-638501691 + // for more details. // // This is only done for local packages, as we don't expect to export // dependencies. @@ -622,7 +628,8 @@ fn should_use_metadata(bcx: &BuildContext<'_, '_>, unit: &Unit) -> bool { if (unit.target.is_dylib() || unit.target.is_cdylib() || (unit.target.is_executable() && short_name.starts_with("wasm32-")) - || (unit.target.is_executable() && short_name.contains("msvc"))) + || (unit.target.is_executable() && short_name.contains("msvc")) + || (unit.target.is_executable() && short_name.contains("-apple-"))) && unit.pkg.package_id().source_id().is_path() && env::var("__CARGO_DEFAULT_LIB_METADATA").is_err() { diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 260b0f11f76..42a72dd8db1 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -4149,7 +4149,7 @@ fn uplift_dsym_of_bin_on_mac() { assert!(p.target_debug_dir().join("foo.dSYM").is_dir()); assert!(p.target_debug_dir().join("b.dSYM").is_dir()); assert!(p.target_debug_dir().join("b.dSYM").is_symlink()); - assert!(p.target_debug_dir().join("examples/c.dSYM").is_symlink()); + assert!(p.target_debug_dir().join("examples/c.dSYM").is_dir()); assert!(!p.target_debug_dir().join("c.dSYM").exists()); assert!(!p.target_debug_dir().join("d.dSYM").exists()); } diff --git a/tests/testsuite/collisions.rs b/tests/testsuite/collisions.rs index e81ef90919f..5b94aae28ec 100644 --- a/tests/testsuite/collisions.rs +++ b/tests/testsuite/collisions.rs @@ -91,9 +91,9 @@ This may become a hard error in the future; see