From a74e9e5eabf74a16ab10947eff37b29f09c96d1a Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Tue, 18 Aug 2026 15:12:43 +1000 Subject: [PATCH 1/2] Unbreak trybuild tests on my machine --- .cargo/config.toml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..e6aa557 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,4 @@ +[term] +# Set `color` to `auto` in case the user has set it to `always`, which would +# cause divergence in compiler output and break the trybuild tests. +color = "auto" From e40e0ec1e869ea618973a62977594fa81964839f Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Tue, 18 Aug 2026 15:28:41 +1000 Subject: [PATCH 2/2] Duplicate selector test case --- .../tests/compile_fail/duplicate_variant_selector.rs | 11 +++++++++++ .../compile_fail/duplicate_variant_selector.stderr | 7 +++++++ 2 files changed, 18 insertions(+) create mode 100644 tree_hash/tests/compile_fail/duplicate_variant_selector.rs create mode 100644 tree_hash/tests/compile_fail/duplicate_variant_selector.stderr diff --git a/tree_hash/tests/compile_fail/duplicate_variant_selector.rs b/tree_hash/tests/compile_fail/duplicate_variant_selector.rs new file mode 100644 index 0000000..3a0e738 --- /dev/null +++ b/tree_hash/tests/compile_fail/duplicate_variant_selector.rs @@ -0,0 +1,11 @@ +//! More than one selector in a variant-level `tree_hash` attribute must be rejected. +use tree_hash_derive::TreeHash; + +#[derive(TreeHash)] +#[tree_hash(enum_behaviour = "compatible_union")] +enum Foo { + #[tree_hash(selector = "1", selector = "2")] + A(u8), +} + +fn main() {} diff --git a/tree_hash/tests/compile_fail/duplicate_variant_selector.stderr b/tree_hash/tests/compile_fail/duplicate_variant_selector.stderr new file mode 100644 index 0000000..4a5470c --- /dev/null +++ b/tree_hash/tests/compile_fail/duplicate_variant_selector.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> tests/compile_fail/duplicate_variant_selector.rs:4:10 + | +4 | #[derive(TreeHash)] + | ^^^^^^^^ + | + = help: message: failed to parse variant attribute for "A": Duplicate field `selector`; note that `selector` must be an integer in 1..=127