Skip to content

Commit

Permalink
codetable: fix build for blake2s and blake2b features
Browse files Browse the repository at this point in the history
In the refactor where each hasher was moved to a separate feature, the
conditional compilation of derive_write! was written such that enabling
only blake2 hashing will result in compilation errors:

    error: cannot find macro `derive_write` in this scope
      --> /home/cyphar/.cargo/registry/src/index.crates.io-6f17d22bba15001f/multihash-codetable-0.1.0/src/hasher_impl.rs:59:9
       |
    59 |         derive_write!($name);
       |         ^^^^^^^^^^^^
    ...
    65 |     derive_hasher_blake!(blake2b_simd, Blake2bHasher);
       |     ------------------------------------------------- in this macro invocation
       |
       = note: this error originates in the macro `derive_hasher_blake` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: could not compile `multihash-codetable` (lib) due to previous error

Fixes: 954e523 ("refactor!: split crates into multiple to isolate breaking changes")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
  • Loading branch information
cyphar committed Oct 30, 2023
1 parent 6b4cbc5 commit c977fcf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion codetable/src/hasher_impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#[cfg(any(feature = "strobe", feature = "identity", feature = "blake3"))]
#[cfg(any(
feature = "strobe",
feature = "identity",
feature = "blake2b",
feature = "blake2s",
feature = "blake3"
))]
macro_rules! derive_write {
($name:ident) => {
impl<const S: usize> core2::io::Write for $name<S> {
Expand Down

0 comments on commit c977fcf

Please sign in to comment.