Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/output_depinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn add_deps_for_unit(
// Recursively traverse all transitive dependencies
let unit_deps = Vec::from(cx.unit_deps(unit)); // Create vec due to mutable borrow.
for dep in unit_deps {
if unit.is_local() {
if dep.unit.is_local() {
add_deps_for_unit(deps, cx, &dep.unit, visited)?;
}
}
Expand Down
38 changes: 38 additions & 0 deletions tests/testsuite/dep_info.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Tests for dep-info files. This includes the dep-info file Cargo creates in
//! the output directory, and the ones stored in the fingerprint.

use cargo_test_support::compare::assert_match_exact;
use cargo_test_support::paths::{self, CargoPathExt};
use cargo_test_support::registry::Package;
use cargo_test_support::{
Expand Down Expand Up @@ -575,3 +576,40 @@ fn canonical_path() {
&[(0, "src/lib.rs"), (1, "debug/deps/libregdep-*.rmeta")],
);
}

#[cargo_test]
fn non_local_build_script() {
// Non-local build script information is not included.
Package::new("bar", "1.0.0")
.file(
"build.rs",
r#"
fn main() {
println!("cargo:rerun-if-changed=build.rs");
}
"#,
)
.file("src/lib.rs", "")
.publish();
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"

[dependencies]
bar = "1.0"
"#,
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("build").run();
let contents = p.read_file("target/debug/foo.d");
assert_match_exact(
"[ROOT]/foo/target/debug/foo[EXE]: [ROOT]/foo/src/main.rs",
&contents,
);
}