From c1a1852168622228cbefe892593541af7fd279ae Mon Sep 17 00:00:00 2001 From: mehmetkr-31 Date: Fri, 7 Aug 2026 00:04:15 +0300 Subject: [PATCH 1/2] chore(types): drop redundant macro imports that break CI on Rust 1.92 On Rust 1.92 the CI lint command cargo clippy --all-targets --all-features -- -D warnings fails on this crate with two `unused import: crate::codec::impl_versioned_codec` errors, so bumping rust-toolchain.toml past the pinned 1.91.1 breaks the Rust Lint job. `impl_versioned_codec` is a `macro_rules!` macro defined in `codec/mod.rs` above the `pub mod network;` / `pub mod wal;` declarations. Textual macro scoping already puts it in scope for both child modules, so the explicit `use` never did anything; 1.92 is simply the first release whose `unused_imports` lint reports it. Removing the two imports leaves the `pub(crate) use impl_versioned_codec;` re-export with no remaining users, and it warns in turn, so it goes as well. Nothing outside `codec` referenced the macro by path. This is a lint-visibility fix, not a behaviour change: textual scoping is long-stable and version-independent, so the macro resolves the same way on 1.91.1 and on 1.92. Co-Authored-By: Claude Opus 5 --- crates/types/src/codec/mod.rs | 2 -- crates/types/src/codec/network.rs | 1 - crates/types/src/codec/wal.rs | 1 - 3 files changed, 4 deletions(-) diff --git a/crates/types/src/codec/mod.rs b/crates/types/src/codec/mod.rs index 2489bdf6..365aee6f 100644 --- a/crates/types/src/codec/mod.rs +++ b/crates/types/src/codec/mod.rs @@ -77,8 +77,6 @@ macro_rules! impl_versioned_codec { }; } -pub(crate) use impl_versioned_codec; - pub mod error; pub mod network; pub mod proto; diff --git a/crates/types/src/codec/network.rs b/crates/types/src/codec/network.rs index 9b7b3d45..c9456a88 100644 --- a/crates/types/src/codec/network.rs +++ b/crates/types/src/codec/network.rs @@ -23,7 +23,6 @@ use malachitebft_core_types::ValidatorProof; use malachitebft_sync::{self as sync}; use crate::codec::error::CodecError; -use crate::codec::impl_versioned_codec; use crate::codec::proto::ProtobufCodec; use crate::codec::versions::{ LivenessMsgVersion, ProposalPartVersion, SignedConsensusMsgVersion, StreamMessageVersion, diff --git a/crates/types/src/codec/wal.rs b/crates/types/src/codec/wal.rs index 285d9f18..bd26eb69 100644 --- a/crates/types/src/codec/wal.rs +++ b/crates/types/src/codec/wal.rs @@ -19,7 +19,6 @@ use malachitebft_core_consensus::{ProposedValue, SignedConsensusMsg}; use malachitebft_core_types::PolkaCertificate; -use crate::codec::impl_versioned_codec; use crate::codec::versions::{ PolkaCertificateVersion, ProposedValueVersion, SignedConsensusMsgVersion, }; From bdf34bf2e93acfaa848c3148963df63f2fa99bbf Mon Sep 17 00:00:00 2001 From: mehmetkr-31 Date: Wed, 12 Aug 2026 23:22:57 +0300 Subject: [PATCH 2/2] docs(types): record that the codec macro must precede the mod declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing the path imports made declaration order in `codec/mod.rs` load-bearing: `network` and `wal` now reach `impl_versioned_codec` through textual scope alone, so hoisting the `pub mod` block above the macro — or alphabetising the file — breaks all 11 invocation sites with `cannot find macro`, and nothing at those sites hints at the dependency. Before this change the `pub(crate) use` re-export made the macro path-addressable regardless of position, so the ordering was free. Raised by @osr21 in review on #232. --- crates/types/src/codec/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/types/src/codec/mod.rs b/crates/types/src/codec/mod.rs index 365aee6f..ee4f0261 100644 --- a/crates/types/src/codec/mod.rs +++ b/crates/types/src/codec/mod.rs @@ -26,6 +26,11 @@ pub use malachitebft_codec::{Codec, HasEncodedLen}; /// - `$ty`: The message type to encode/decode /// - `$version_ty`: The version enum type /// - `$version_val`: The specific version value to use +/// +/// Must stay above the `pub mod` declarations at the bottom of this file: +/// `network` and `wal` reach this macro through textual scope, not through a +/// path, so moving the module declarations above it — or moving this below +/// them — breaks all 11 invocation sites with `cannot find macro`. macro_rules! impl_versioned_codec { ($codec_ty:ty, $ty:ty, $version_ty:ty, $version_val:expr) => { impl malachitebft_codec::Codec<$ty> for $codec_ty {