Skip to content

Commit 2b0df94

Browse files
committed
test: show proc macro example from dep affecting feature unificaiton
1 parent a201d25 commit 2b0df94

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/testsuite/features2.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,3 +2652,43 @@ fn dep_with_optional_host_deps_activated() {
26522652
)
26532653
.run();
26542654
}
2655+
2656+
#[cargo_test]
2657+
fn dont_unify_proc_macro_example_from_dependency() {
2658+
// See https://github.com/rust-lang/cargo/issues/13726
2659+
let p = project()
2660+
.file(
2661+
"Cargo.toml",
2662+
r#"
2663+
[package]
2664+
name = "foo"
2665+
edition = "2021"
2666+
2667+
[dependencies]
2668+
pm_helper = { path = "pm_helper" }
2669+
"#,
2670+
)
2671+
.file("src/lib.rs", "")
2672+
.file(
2673+
"pm_helper/Cargo.toml",
2674+
r#"
2675+
[package]
2676+
name = "pm_helper"
2677+
2678+
[[example]]
2679+
name = "pm"
2680+
proc-macro = true
2681+
crate-type = ["proc-macro"]
2682+
"#,
2683+
)
2684+
.file("pm_helper/src/lib.rs", "")
2685+
.file("pm_helper/examples/pm.rs", "")
2686+
.build();
2687+
2688+
p.cargo("check")
2689+
.with_status(101)
2690+
.with_stderr_contains(
2691+
"[..]activated_features for invalid package: features did not find PackageId [..]pm_helper[..]NormalOrDev[..]"
2692+
)
2693+
.run();
2694+
}

0 commit comments

Comments
 (0)