Skip to content

Commit

Permalink
test: show proc macro example from dep affecting feature unificaiton
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed May 9, 2024
1 parent 9e5b260 commit c2e41e9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/testsuite/features2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2652,3 +2652,43 @@ fn dep_with_optional_host_deps_activated() {
)
.run();
}

#[cargo_test]
fn dont_unify_proc_macro_example_from_dependency() {
// See https://github.com/rust-lang/cargo/issues/13726
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
edition = "2021"
[dependencies]
pm_helper = { path = "pm_helper" }
"#,
)
.file("src/lib.rs", "")
.file(
"pm_helper/Cargo.toml",
r#"
[package]
name = "pm_helper"
[[example]]
name = "pm"
proc-macro = true
crate-type = ["proc-macro"]
"#,
)
.file("pm_helper/src/lib.rs", "")
.file("pm_helper/examples/pm.rs", "")
.build();

p.cargo("check")
.with_status(101)
.with_stderr_contains(
"[..]activated_features for invalid package: features did not find PackageId [..]pm_helper[..]NormalOrDev[..]"
)
.run();
}

0 comments on commit c2e41e9

Please sign in to comment.