diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f882c05..a91b6b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,12 +17,13 @@ jobs: - uses: actions-rs/toolchain@v1 with: # Nightly toolchain must ship the `rust-std` component for - # `i686-unknown-linux-gnu` and `mips64-unknown-linux-gnuabi64`. + # `i686-unknown-linux-gnu` and powerpc64-unknown-linux-gnu (or `mips64-unknown-linux-gnuabi64`). # In practice, `rust-std` almost always ships for - # `i686-unknown-linux-gnu` so we just need to check this page for a + # `i686-unknown-linux-gnu` so we just need to check either of these pages for a # compatible nightly: + # https://rust-lang.github.io/rustup-components-history/powerpc64-unknown-linux-gnu # https://rust-lang.github.io/rustup-components-history/mips64-unknown-linux-gnuabi64.html - toolchain: nightly-2023-04-25 + toolchain: nightly-2025-10-10 override: true components: rustfmt, miri - name: Lint @@ -48,9 +49,9 @@ jobs: - name: Test (miri all-features) run: cargo miri test --all-features - name: Setup Miri (big-endian) - run: rustup target add mips64-unknown-linux-gnuabi64 && cargo miri setup --target mips64-unknown-linux-gnuabi64 + run: rustup target add powerpc64-unknown-linux-gnu && cargo miri setup --target powerpc64-unknown-linux-gnu - name: Test (miri big-endian) - run: cargo miri test --target mips64-unknown-linux-gnuabi64 + run: cargo miri test --target powerpc64-unknown-linux-gnu msrv: runs-on: ubuntu-latest steps: diff --git a/bitcode_derive/src/encode.rs b/bitcode_derive/src/encode.rs index 9680229..34374bf 100644 --- a/bitcode_derive/src/encode.rs +++ b/bitcode_derive/src/encode.rs @@ -156,7 +156,7 @@ impl crate::shared::Item for Item { }) .collect(); quote! { - #[allow(unused_variables)] + #[allow(unused_variables, unused_assignments)] self.variants.encode(&match v { #variants }); @@ -300,7 +300,7 @@ impl crate::shared::Derive<{ Item::COUNT }> for Encode { // #[cfg_attr(not(debug_assertions), inline(always))] // #[inline(never)] - fn encode_vectored<'__v>(&mut self, i: impl Iterator + Clone) where #input_ty: '__v { + fn encode_vectored<'__v>(&mut self, #[allow(unused)] i: impl Iterator + Clone) where #input_ty: '__v { #[allow(unused_imports)] use #private::Buffer as _; #encode_vectored_body @@ -308,7 +308,7 @@ impl crate::shared::Derive<{ Item::COUNT }> for Encode { } impl #encoder_impl_generics #private::Buffer for #encoder_ty #encoder_where_clause { - fn collect_into(&mut self, out: &mut #private::Vec) { + fn collect_into(&mut self, #[allow(unused)] out: &mut #private::Vec) { #collect_into_body } diff --git a/src/bool.rs b/src/bool.rs index d8610e6..149e0c7 100644 --- a/src/bool.rs +++ b/src/bool.rs @@ -42,7 +42,7 @@ impl<'a> View<'a> for BoolDecoder<'a> { impl<'a> Decoder<'a, bool> for BoolDecoder<'a> { #[inline(always)] - fn as_primitive(&mut self) -> Option<&mut SliceImpl>> { + fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned>> { // Safety: `Unaligned` is equivalent to bool since it's a `#[repr(C, packed)]` wrapper // around bool and both have size/align of 1. unsafe { Some(core::mem::transmute(self.0.mut_slice())) } diff --git a/src/coder.rs b/src/coder.rs index 152dfb7..eea042b 100644 --- a/src/coder.rs +++ b/src/coder.rs @@ -71,7 +71,7 @@ pub trait Decoder<'a, T>: View<'a> + Default + Send + Sync { /// Returns a `&mut SliceImpl>` if `T` is a type that can be decoded by copying. /// Uses `Unaligned` so `IntDecoder` can borrow from input `[u8]`. #[inline(always)] - fn as_primitive(&mut self) -> Option<&mut SliceImpl>> { + fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned>> { None } diff --git a/src/derive/array.rs b/src/derive/array.rs index 717e6ab..0a4960e 100644 --- a/src/derive/array.rs +++ b/src/derive/array.rs @@ -76,7 +76,7 @@ impl<'a, T: Decode<'a>, const N: usize> View<'a> for ArrayDecoder<'a, T, N> { } impl<'a, T: Decode<'a>, const N: usize> Decoder<'a, [T; N]> for ArrayDecoder<'a, T, N> { - fn as_primitive(&mut self) -> Option<&mut FastSlice>> { + fn as_primitive(&mut self) -> Option<&mut FastSlice<'_, Unaligned<[T; N]>>> { self.0.as_primitive().map(|s| { // Safety: FastSlice doesn't have a length unlike slice, so casting to FastSlice<[T; N]> // is safe. N == 0 case is also safe for the same reason. diff --git a/src/derive/impls.rs b/src/derive/impls.rs index b98cce0..61fd569 100644 --- a/src/derive/impls.rs +++ b/src/derive/impls.rs @@ -28,7 +28,6 @@ macro_rules! impl_both { } }; } -pub(crate) use impl_both; impl_both!(bool, BoolEncoder, BoolDecoder); impl_both!(f32, F32Encoder, F32Decoder); impl_both!(String, StrEncoder, StrDecoder); diff --git a/src/derive/vec.rs b/src/derive/vec.rs index f692fd7..52ab03f 100644 --- a/src/derive/vec.rs +++ b/src/derive/vec.rs @@ -77,6 +77,7 @@ macro_rules! unsafe_wild_copy { } } } +#[allow(unused_imports)] pub(crate) use unsafe_wild_copy; impl VecEncoder { diff --git a/src/int.rs b/src/int.rs index b57ea96..2903676 100644 --- a/src/int.rs +++ b/src/int.rs @@ -61,7 +61,7 @@ impl<'a, T: Int> View<'a> for IntDecoder<'a, T> { // Makes IntDecoder able to decode i32/f32 (but not char since it can fail). impl<'a, T: Int, P: Pod> Decoder<'a, P> for IntDecoder<'a, T> { #[inline(always)] - fn as_primitive(&mut self) -> Option<&mut SliceImpl>> { + fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned

>> { Some(self.0.mut_slice().cast()) } @@ -107,7 +107,7 @@ where ::Bits: Pod, { #[inline(always)] - fn as_primitive(&mut self) -> Option<&mut SliceImpl>> { + fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned>> { self.0 .as_primitive() .map(|p: &mut SliceImpl<'_, Unaligned>| { diff --git a/src/str.rs b/src/str.rs index e7c4d6c..80d727d 100644 --- a/src/str.rs +++ b/src/str.rs @@ -254,7 +254,7 @@ mod tests { #[doc(hidden)] pub fn _cant_decode_static_from_non_static_buffer() {} -/// ```compile_fail,E0495 +/// ```compile_fail /// use bitcode::{encode, decode, Encode, Decode}; /// /// type StaticStr = &'static str;