Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions bitcode_derive/src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down Expand Up @@ -300,15 +300,15 @@ 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<Item = &'__v #input_ty> + Clone) where #input_ty: '__v {
fn encode_vectored<'__v>(&mut self, #[allow(unused)] i: impl Iterator<Item = &'__v #input_ty> + Clone) where #input_ty: '__v {
#[allow(unused_imports)]
use #private::Buffer as _;
#encode_vectored_body
}
}

impl #encoder_impl_generics #private::Buffer for #encoder_ty #encoder_where_clause {
fn collect_into(&mut self, out: &mut #private::Vec<u8>) {
fn collect_into(&mut self, #[allow(unused)] out: &mut #private::Vec<u8>) {
#collect_into_body
}

Expand Down
2 changes: 1 addition & 1 deletion src/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Unaligned<bool>>> {
fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned<bool>>> {
// Safety: `Unaligned<bool>` 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())) }
Expand Down
2 changes: 1 addition & 1 deletion src/coder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub trait Decoder<'a, T>: View<'a> + Default + Send + Sync {
/// Returns a `&mut SliceImpl<Unaligned<T>>` if `T` is a type that can be decoded by copying.
/// Uses `Unaligned<T>` so `IntDecoder` can borrow from input `[u8]`.
#[inline(always)]
fn as_primitive(&mut self) -> Option<&mut SliceImpl<Unaligned<T>>> {
fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned<T>>> {
None
}

Expand Down
2 changes: 1 addition & 1 deletion src/derive/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Unaligned<[T; N]>>> {
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.
Expand Down
1 change: 0 additions & 1 deletion src/derive/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/derive/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ macro_rules! unsafe_wild_copy {
}
}
}
#[allow(unused_imports)]
pub(crate) use unsafe_wild_copy;

impl<T: Encode> VecEncoder<T> {
Expand Down
4 changes: 2 additions & 2 deletions src/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<'a, T: Int> View<'a> for IntDecoder<'a, T> {
// Makes IntDecoder<u32> 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<Unaligned<P>>> {
fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned<P>>> {
Some(self.0.mut_slice().cast())
}

Expand Down Expand Up @@ -107,7 +107,7 @@ where
<C as CheckedBitPattern>::Bits: Pod,
{
#[inline(always)]
fn as_primitive(&mut self) -> Option<&mut SliceImpl<Unaligned<C>>> {
fn as_primitive(&mut self) -> Option<&mut SliceImpl<'_, Unaligned<C>>> {
self.0
.as_primitive()
.map(|p: &mut SliceImpl<'_, Unaligned<I>>| {
Expand Down
2 changes: 1 addition & 1 deletion src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading