From 8969cbb22f6de2116ec2350ad355729742076a4b Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 31 Aug 2021 13:10:16 +0200 Subject: [PATCH] Depend on both crates individually --- Cargo.lock | 4 +--- crates/cfg/Cargo.toml | 6 +++++- crates/cfg/src/cfg_expr.rs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 057d23cd282..1842bf46da2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,9 +52,6 @@ name = "arbitrary" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "577b08a4acd7b99869f863c50011b01eb73424ccc798ecd996f2e24817adfca7" -dependencies = [ - "derive_arbitrary", -] [[package]] name = "arrayvec" @@ -157,6 +154,7 @@ name = "cfg" version = "0.0.0" dependencies = [ "arbitrary", + "derive_arbitrary", "expect-test", "mbe", "oorandom", diff --git a/crates/cfg/Cargo.toml b/crates/cfg/Cargo.toml index 4a0fdd30e00..132505fbf4a 100644 --- a/crates/cfg/Cargo.toml +++ b/crates/cfg/Cargo.toml @@ -17,5 +17,9 @@ tt = { path = "../tt", version = "0.0.0" } mbe = { path = "../mbe" } syntax = { path = "../syntax" } expect-test = "1.1" -arbitrary = { version = "1", features = ["derive"] } oorandom = "11" +# We depend on both individually instead of using `features = ["derive"]` to microoptimize the +# build graph: if the feature was enabled, syn would be built early on in the graph if `smolstr` +# supports `arbitrary`. This way, we avoid feature unification. +arbitrary = "1" +derive_arbitrary = "1" diff --git a/crates/cfg/src/cfg_expr.rs b/crates/cfg/src/cfg_expr.rs index a06f0f4480c..c980e9642ac 100644 --- a/crates/cfg/src/cfg_expr.rs +++ b/crates/cfg/src/cfg_expr.rs @@ -50,7 +50,7 @@ impl fmt::Display for CfgAtom { } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(test, derive(arbitrary::Arbitrary))] +#[cfg_attr(test, derive(derive_arbitrary::Arbitrary))] pub enum CfgExpr { Invalid, Atom(CfgAtom),