Skip to content

Commit

Permalink
Fix overwriting binary .d file for dSYM target on apple targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
hugwijst authored and Hugo van der Wijst committed Jun 21, 2019
1 parent 37cb9bb commit 2c488c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cargo/core/compiler/output_depinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};

use log::debug;

use super::{fingerprint, Context, Unit};
use super::{fingerprint, Context, FileFlavor, Unit};
use crate::util::paths;
use crate::util::{internal, CargoResult};

Expand Down Expand Up @@ -98,7 +98,11 @@ pub fn output_depinfo<'a, 'b>(cx: &mut Context<'a, 'b>, unit: &Unit<'a>) -> Carg
.map(|f| render_filename(f, basedir))
.collect::<CargoResult<Vec<_>>>()?;

for output in cx.outputs(unit)?.iter() {
for output in cx
.outputs(unit)?
.iter()
.filter(|o| o.flavor != FileFlavor::DebugInfo)
{
if let Some(ref link_dst) = output.hardlink {
let output_path = link_dst.with_extension("d");
if success {
Expand Down
7 changes: 7 additions & 0 deletions tests/testsuite/dep_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ fn build_dep_info() {
let depinfo_bin_path = &p.bin("foo").with_extension("d");

assert!(depinfo_bin_path.is_file());

let depinfo = p.read_file(depinfo_bin_path.to_str().unwrap());

let bin_path = p.bin("foo");
let src_path = p.root().join("src").join("foo.rs");
let expected_depinfo = format!("{}: {}\n", bin_path.display(), src_path.display());
assert_eq!(depinfo, expected_depinfo);
}

#[cargo_test]
Expand Down

0 comments on commit 2c488c9

Please sign in to comment.