diff --git a/src/encode.rs b/src/encode.rs index cd59210..9f576f1 100644 --- a/src/encode.rs +++ b/src/encode.rs @@ -63,22 +63,10 @@ unsafe impl Encode for *const c_void { const ENCODING: Encoding<'static> = Encoding::Pointer(&Encoding::Void); } -// TODO: Replace this with a const generics implementation when they stabilise (#44580) -macro_rules! slice_encode_impl { - ($($n:literal),* $(,)?) => { - $( - unsafe impl Encode for [T; $n] { - const ENCODING: Encoding<'static> = Encoding::Array($n, &::ENCODING); - } - )* - }; +unsafe impl Encode for [T; LENGTH] { + const ENCODING: Encoding<'static> = Encoding::Array(LENGTH as u32, &::ENCODING); } -slice_encode_impl!( - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32 -); - /* External crates cannot implement Encode for pointers or Optionals, but they *can* implement it for references. rust-lang/rust#25126