Skip to content

Commit 2c488c9

Browse files
hugwijstHugo van der Wijst
authored and
Hugo van der Wijst
committed
Fix overwriting binary .d file for dSYM target on apple targets.
1 parent 37cb9bb commit 2c488c9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Diff for: src/cargo/core/compiler/output_depinfo.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
55

66
use log::debug;
77

8-
use super::{fingerprint, Context, Unit};
8+
use super::{fingerprint, Context, FileFlavor, Unit};
99
use crate::util::paths;
1010
use crate::util::{internal, CargoResult};
1111

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

101-
for output in cx.outputs(unit)?.iter() {
101+
for output in cx
102+
.outputs(unit)?
103+
.iter()
104+
.filter(|o| o.flavor != FileFlavor::DebugInfo)
105+
{
102106
if let Some(ref link_dst) = output.hardlink {
103107
let output_path = link_dst.with_extension("d");
104108
if success {

Diff for: tests/testsuite/dep_info.rs

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ fn build_dep_info() {
1313
let depinfo_bin_path = &p.bin("foo").with_extension("d");
1414

1515
assert!(depinfo_bin_path.is_file());
16+
17+
let depinfo = p.read_file(depinfo_bin_path.to_str().unwrap());
18+
19+
let bin_path = p.bin("foo");
20+
let src_path = p.root().join("src").join("foo.rs");
21+
let expected_depinfo = format!("{}: {}\n", bin_path.display(), src_path.display());
22+
assert_eq!(depinfo, expected_depinfo);
1623
}
1724

1825
#[cargo_test]

0 commit comments

Comments
 (0)