Skip to content

Commit 548b252

Browse files
committed
test: reproduce bindep dependency collision bug
Signed-off-by: Roman Volosatovs <[email protected]>
1 parent e99c0bb commit 548b252

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

tests/testsuite/artifact_dep.rs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2795,3 +2795,62 @@ fn decouple_same_target_transitive_dep_from_artifact_dep_and_proc_macro() {
27952795
)
27962796
.run();
27972797
}
2798+
2799+
#[cargo_test]
2800+
fn same_target_artifact_dep_sharing() {
2801+
let target = rustc_host();
2802+
let p = project()
2803+
.file(
2804+
"Cargo.toml",
2805+
&format!(
2806+
r#"
2807+
[package]
2808+
name = "foo"
2809+
version = "0.1.0"
2810+
2811+
[dependencies]
2812+
a = {{ path = "a" }}
2813+
bar = {{ path = "bar", artifact = "bin", target = "{target}" }}
2814+
"#
2815+
),
2816+
)
2817+
.file("src/lib.rs", "")
2818+
.file(
2819+
"bar/Cargo.toml",
2820+
r#"
2821+
[package]
2822+
name = "bar"
2823+
version = "0.1.0"
2824+
2825+
[dependencies]
2826+
a = { path = "../a" }
2827+
"#,
2828+
)
2829+
.file(
2830+
"bar/src/main.rs",
2831+
r#"
2832+
fn main() {}
2833+
"#,
2834+
)
2835+
.file(
2836+
"a/Cargo.toml",
2837+
r#"
2838+
[package]
2839+
name = "a"
2840+
version = "0.1.0"
2841+
"#,
2842+
)
2843+
.file("a/src/lib.rs", "")
2844+
.build();
2845+
p.cargo(&format!("build -Z bindeps --target {target}"))
2846+
.masquerade_as_nightly_cargo(&["bindeps"])
2847+
.with_stderr(
2848+
"\
2849+
[COMPILING] a v0.1.0 ([CWD]/a)
2850+
[COMPILING] bar v0.1.0 ([CWD]/bar)
2851+
[COMPILING] foo v0.1.0 ([CWD])
2852+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2853+
",
2854+
)
2855+
.run();
2856+
}

0 commit comments

Comments
 (0)