From ffd18df3f2e4f97f23d1e34983a54c9ddc0752ab Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Tue, 8 Aug 2023 18:34:42 +0000 Subject: [PATCH] Reduce MSRV to 1.61.0 It turned out that there were only a few lines of code that required our MSRV to be as high as it was before this commit (1.65.0), and those lines were easy to modify to be compatible with this new MSRV. Note that this requires introducing defensive code to `FromZeroes::new_box_slice_zeroed` in order to sidestep a bug in `Layout::from_size_align` that was present through 1.64.0. --- Cargo.toml | 2 +- src/lib.rs | 91 ++++++++----------- tests/trybuild.rs | 6 +- tests/ui-msrv/transmute-illegal.stderr | 19 ++-- zerocopy-derive/Cargo.toml | 2 +- zerocopy-derive/src/repr.rs | 4 +- zerocopy-derive/tests/trybuild.rs | 6 +- .../tests/ui-msrv/derive_transparent.stderr | 80 ++++------------ zerocopy-derive/tests/ui-msrv/enum.stderr | 2 - .../tests/ui-msrv/late_compile_pass.stderr | 70 -------------- zerocopy-derive/tests/ui-msrv/struct.stderr | 3 +- zerocopy-derive/tests/ui-msrv/union.stderr | 3 +- 12 files changed, 80 insertions(+), 208 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 46a613741a5..2fd90097fa1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ authors = ["Joshua Liebow-Feeser "] description = "Utilities for zero-copy parsing and serialization" license = "BSD-2-Clause" repository = "https://github.com/google/zerocopy" -rust-version = "1.65.0" +rust-version = "1.61.0" exclude = [".*"] diff --git a/src/lib.rs b/src/lib.rs index 549d43e30f4..661284423d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -334,15 +334,22 @@ pub unsafe trait FromZeroes { where Self: Sized, { + let size = mem::size_of::() + .checked_mul(len) + .expect("mem::size_of::() * len overflows `usize`"); + let align = mem::align_of::(); + // On stable Rust versions <= 1.64.0, `Layout::from_size_align` has a + // bug in which sufficiently-large allocations (those which, when + // rounded up to the alignment, overflow `isize`) are not rejected, + // which can cause undefined behavior. See #64 for details. + // + // TODO(#67): Once our MSRV is > 1.64.0, remove this assertion. + let max_alloc = usize::MAX / 2 - align; + assert!(size <= max_alloc); // TODO(#2): Use `Layout::repeat` when `alloc_layout_extra` is // stabilized. - let layout = Layout::from_size_align( - mem::size_of::() - .checked_mul(len) - .expect("mem::size_of::() * len overflows `usize`"), - mem::align_of::(), - ) - .expect("total allocation size overflows `isize`"); + let layout = + Layout::from_size_align(size, align).expect("total allocation size overflows `isize`"); // TODO(#61): Add a "SAFETY" comment and remove this `allow`. #[allow(clippy::undocumented_unsafe_blocks)] @@ -1265,12 +1272,16 @@ impl Unalign { /// If `self` does not satisfy `mem::align_of::()`, then /// `self.deref_unchecked()` may cause undefined behavior. pub const unsafe fn deref_unchecked(&self) -> &T { - // SAFETY: `self.get_ptr()` returns a raw pointer to a valid `T` at the - // same memory location as `self`. It has no alignment guarantee, but - // the caller has promised that `self` is properly aligned, so we know - // that the pointer itself is aligned, and thus that it is sound to - // create a reference to a `T` at this memory location. - unsafe { &*self.get_ptr() } + // SAFETY: `Unalign` is `repr(transparent)`, so there is a valid `T` + // at the same memory location as `self`. It has no alignment guarantee, + // but the caller has promised that `self` is properly aligned, so we + // know that it is sound to create a reference to `T` at this memory + // location. + // + // We use `mem::transmute` instead of `&*self.get_ptr()` because + // dereferencing pointers is not stable in `const` on our current MSRV + // (1.56 as of this writing). + unsafe { mem::transmute(self) } } /// Returns a mutable reference to the wrapped `T` without checking @@ -1518,6 +1529,10 @@ macro_rules! transmute { // were to use `core::mem::transmute`, this macro would not work in // `std` contexts in which `core` was not manually imported. This is // not a problem for 2018 edition crates. + // + // Some older versions of Clippy have a bug in which they don't + // recognize the preceding safety comment. + #[allow(clippy::undocumented_unsafe_blocks)] unsafe { $crate::__real_transmute(e) } } }} @@ -2777,17 +2792,12 @@ mod alloc_support { #[cfg(test)] mod tests { - use core::convert::TryFrom as _; - use super::*; #[test] fn test_extend_vec_zeroed() { // Test extending when there is an existing allocation. - let mut v: Vec = Vec::with_capacity(3); - v.push(100); - v.push(200); - v.push(300); + let mut v = vec![100u64, 200, 300]; extend_vec_zeroed(&mut v, 3); assert_eq!(v.len(), 6); assert_eq!(&*v, &[100, 200, 300, 0, 0, 0]); @@ -2804,10 +2814,7 @@ mod alloc_support { #[test] fn test_extend_vec_zeroed_zst() { // Test extending when there is an existing (fake) allocation. - let mut v: Vec<()> = Vec::with_capacity(3); - v.push(()); - v.push(()); - v.push(()); + let mut v = vec![(), (), ()]; extend_vec_zeroed(&mut v, 3); assert_eq!(v.len(), 6); assert_eq!(&*v, &[(), (), (), (), (), ()]); @@ -2830,30 +2837,21 @@ mod alloc_support { drop(v); // Insert at start. - let mut v: Vec = Vec::with_capacity(3); - v.push(100); - v.push(200); - v.push(300); + let mut v = vec![100u64, 200, 300]; insert_vec_zeroed(&mut v, 0, 2); assert_eq!(v.len(), 5); assert_eq!(&*v, &[0, 0, 100, 200, 300]); drop(v); // Insert at middle. - let mut v: Vec = Vec::with_capacity(3); - v.push(100); - v.push(200); - v.push(300); + let mut v = vec![100u64, 200, 300]; insert_vec_zeroed(&mut v, 1, 1); assert_eq!(v.len(), 4); assert_eq!(&*v, &[100, 0, 200, 300]); drop(v); // Insert at end. - let mut v: Vec = Vec::with_capacity(3); - v.push(100); - v.push(200); - v.push(300); + let mut v = vec![100u64, 200, 300]; insert_vec_zeroed(&mut v, 3, 1); assert_eq!(v.len(), 4); assert_eq!(&*v, &[100, 200, 300, 0]); @@ -2870,30 +2868,21 @@ mod alloc_support { drop(v); // Insert at start. - let mut v: Vec<()> = Vec::with_capacity(3); - v.push(()); - v.push(()); - v.push(()); + let mut v = vec![(), (), ()]; insert_vec_zeroed(&mut v, 0, 2); assert_eq!(v.len(), 5); assert_eq!(&*v, &[(), (), (), (), ()]); drop(v); // Insert at middle. - let mut v: Vec<()> = Vec::with_capacity(3); - v.push(()); - v.push(()); - v.push(()); + let mut v = vec![(), (), ()]; insert_vec_zeroed(&mut v, 1, 1); assert_eq!(v.len(), 4); assert_eq!(&*v, &[(), (), (), ()]); drop(v); // Insert at end. - let mut v: Vec<()> = Vec::with_capacity(3); - v.push(()); - v.push(()); - v.push(()); + let mut v = vec![(), (), ()]; insert_vec_zeroed(&mut v, 3, 1); assert_eq!(v.len(), 4); assert_eq!(&*v, &[(), (), (), ()]); @@ -2962,7 +2951,7 @@ mod alloc_support { } #[test] - #[should_panic(expected = "total allocation size overflows `isize`: LayoutError")] + #[should_panic(expected = "assertion failed: size <= max_alloc")] fn test_new_box_slice_zeroed_panics_isize_overflow() { let max = usize::try_from(isize::MAX).unwrap(); let _ = u16::new_box_slice_zeroed((max / mem::size_of::()) + 1); @@ -3753,7 +3742,7 @@ mod tests { /// has had its bits flipped (by applying `^= 0xFF`). /// /// `N` is the size of `t` in bytes. - fn test( + fn test( t: &mut T, bytes: &[u8], post_mutation: &T, @@ -3825,12 +3814,12 @@ mod tests { }; let post_mutation_expected_a = if cfg!(target_endian = "little") { 0x00_00_00_FE } else { 0xFF_00_00_01 }; - test::<12, _>( + test::<_, 12>( &mut Foo { a: 1, b: Wrapping(2), c: None }, expected_bytes.as_bytes(), &Foo { a: post_mutation_expected_a, b: Wrapping(2), c: None }, ); - test::<3, _>( + test::<_, 3>( Unsized::from_mut_slice(&mut [1, 2, 3]), &[1, 2, 3], Unsized::from_mut_slice(&mut [0xFE, 2, 3]), diff --git a/tests/trybuild.rs b/tests/trybuild.rs index 36ce5dcdbb2..32f38cc94a9 100644 --- a/tests/trybuild.rs +++ b/tests/trybuild.rs @@ -15,11 +15,11 @@ // - `tests/ui-msrv` - Contains symlinks to the `.rs` files in // `tests/ui-nightly`, and contains `.err` and `.out` files for MSRV -#[rustversion::any(nightly)] +#[rustversion::nightly] const SOURCE_FILES_GLOB: &str = "tests/ui-nightly/*.rs"; -#[rustversion::all(stable, not(stable(1.65.0)))] +#[rustversion::stable(1.69.0)] const SOURCE_FILES_GLOB: &str = "tests/ui-stable/*.rs"; -#[rustversion::stable(1.65.0)] +#[rustversion::stable(1.61.0)] const SOURCE_FILES_GLOB: &str = "tests/ui-msrv/*.rs"; #[test] diff --git a/tests/ui-msrv/transmute-illegal.stderr b/tests/ui-msrv/transmute-illegal.stderr index 731134d4790..37c124ad95f 100644 --- a/tests/ui-msrv/transmute-illegal.stderr +++ b/tests/ui-msrv/transmute-illegal.stderr @@ -2,20 +2,13 @@ error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied --> tests/ui-msrv/transmute-illegal.rs:10:30 | 10 | const POINTER_VALUE: usize = zerocopy::transmute!(&0usize as *const usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the trait `AsBytes` is not implemented for `*const usize` - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `*const usize` | - = help: the following other types implement trait `AsBytes`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + and $N others note: required by a bound in `POINTER_VALUE::transmute` --> tests/ui-msrv/transmute-illegal.rs:10:30 diff --git a/zerocopy-derive/Cargo.toml b/zerocopy-derive/Cargo.toml index 3ec45a01f93..8806869b35c 100644 --- a/zerocopy-derive/Cargo.toml +++ b/zerocopy-derive/Cargo.toml @@ -10,7 +10,7 @@ authors = ["Joshua Liebow-Feeser "] description = "Custom derive for traits from the zerocopy crate" license = "BSD-2-Clause" repository = "https://github.com/google/zerocopy" -rust-version = "1.65.0" +rust-version = "1.61.0" exclude = [".*"] diff --git a/zerocopy-derive/src/repr.rs b/zerocopy-derive/src/repr.rs index b7ba6fd85fe..5bd4a8a9115 100644 --- a/zerocopy-derive/src/repr.rs +++ b/zerocopy-derive/src/repr.rs @@ -191,7 +191,7 @@ impl Repr { let ident = path .get_ident() .ok_or_else(|| Error::new_spanned(meta, "unrecognized representation hint"))?; - match format!("{ident}").as_str() { + match format!("{}", ident).as_str() { "u8" => return Ok(Repr::U8), "u16" => return Ok(Repr::U16), "u32" => return Ok(Repr::U32), @@ -221,7 +221,7 @@ impl Repr { impl Display for Repr { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> { if let Repr::Align(n) = self { - return write!(f, "repr(align({n}))"); + return write!(f, "repr(align({}))", n); } write!( f, diff --git a/zerocopy-derive/tests/trybuild.rs b/zerocopy-derive/tests/trybuild.rs index 36ce5dcdbb2..32f38cc94a9 100644 --- a/zerocopy-derive/tests/trybuild.rs +++ b/zerocopy-derive/tests/trybuild.rs @@ -15,11 +15,11 @@ // - `tests/ui-msrv` - Contains symlinks to the `.rs` files in // `tests/ui-nightly`, and contains `.err` and `.out` files for MSRV -#[rustversion::any(nightly)] +#[rustversion::nightly] const SOURCE_FILES_GLOB: &str = "tests/ui-nightly/*.rs"; -#[rustversion::all(stable, not(stable(1.65.0)))] +#[rustversion::stable(1.69.0)] const SOURCE_FILES_GLOB: &str = "tests/ui-stable/*.rs"; -#[rustversion::stable(1.65.0)] +#[rustversion::stable(1.61.0)] const SOURCE_FILES_GLOB: &str = "tests/ui-msrv/*.rs"; #[test] diff --git a/zerocopy-derive/tests/ui-msrv/derive_transparent.stderr b/zerocopy-derive/tests/ui-msrv/derive_transparent.stderr index 316bc0b3d7d..32184460e80 100644 --- a/zerocopy-derive/tests/ui-msrv/derive_transparent.stderr +++ b/zerocopy-derive/tests/ui-msrv/derive_transparent.stderr @@ -1,20 +1,10 @@ error[E0277]: the trait bound `NotZerocopy: FromZeroes` is not satisfied - --> tests/ui-msrv/derive_transparent.rs:33:18 + --> tests/ui-msrv/derive_transparent.rs:33:1 | 33 | assert_impl_all!(TransparentStruct: FromZeroes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromZeroes` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `FromZeroes`: - () - AU16 - F32 - F64 - I128 - I16 - I32 - I64 - and $N others -note: required for `TransparentStruct` to implement `FromZeroes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromZeroes` is not implemented for `NotZerocopy` + | +note: required because of the requirements on the impl of `FromZeroes` for `TransparentStruct` --> tests/ui-msrv/derive_transparent.rs:23:19 | 23 | #[derive(AsBytes, FromZeroes, FromBytes, Unaligned)] @@ -24,25 +14,15 @@ note: required by a bound in `_::{closure#0}::assert_impl_all` | 33 | assert_impl_all!(TransparentStruct: FromZeroes); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` - = note: this error originates in the derive macro `FromZeroes` which comes from the expansion of the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied - --> tests/ui-msrv/derive_transparent.rs:34:18 + --> tests/ui-msrv/derive_transparent.rs:34:1 | 34 | assert_impl_all!(TransparentStruct: FromBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `FromBytes`: - () - AU16 - F32 - F64 - I128 - I16 - I32 - I64 - and $N others -note: required for `TransparentStruct` to implement `FromBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` + | +note: required because of the requirements on the impl of `FromBytes` for `TransparentStruct` --> tests/ui-msrv/derive_transparent.rs:23:31 | 23 | #[derive(AsBytes, FromZeroes, FromBytes, Unaligned)] @@ -52,25 +32,15 @@ note: required by a bound in `_::{closure#0}::assert_impl_all` | 34 | assert_impl_all!(TransparentStruct: FromBytes); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` - = note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: AsBytes` is not satisfied - --> tests/ui-msrv/derive_transparent.rs:35:18 + --> tests/ui-msrv/derive_transparent.rs:35:1 | 35 | assert_impl_all!(TransparentStruct: AsBytes); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `AsBytes`: - () - AU16 - F32 - F64 - I128 - I16 - I32 - I64 - and $N others -note: required for `TransparentStruct` to implement `AsBytes` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy` + | +note: required because of the requirements on the impl of `AsBytes` for `TransparentStruct` --> tests/ui-msrv/derive_transparent.rs:23:10 | 23 | #[derive(AsBytes, FromZeroes, FromBytes, Unaligned)] @@ -80,25 +50,15 @@ note: required by a bound in `_::{closure#0}::assert_impl_all` | 35 | assert_impl_all!(TransparentStruct: AsBytes); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` - = note: this error originates in the derive macro `AsBytes` which comes from the expansion of the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotZerocopy: Unaligned` is not satisfied - --> tests/ui-msrv/derive_transparent.rs:36:18 + --> tests/ui-msrv/derive_transparent.rs:36:1 | 36 | assert_impl_all!(TransparentStruct: Unaligned); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unaligned` is not implemented for `NotZerocopy` - | - = help: the following other types implement trait `Unaligned`: - () - F32 - F64 - I128 - I16 - I32 - I64 - ManuallyDrop - and $N others -note: required for `TransparentStruct` to implement `Unaligned` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unaligned` is not implemented for `NotZerocopy` + | +note: required because of the requirements on the impl of `Unaligned` for `TransparentStruct` --> tests/ui-msrv/derive_transparent.rs:23:42 | 23 | #[derive(AsBytes, FromZeroes, FromBytes, Unaligned)] @@ -108,4 +68,4 @@ note: required by a bound in `_::{closure#0}::assert_impl_all` | 36 | assert_impl_all!(TransparentStruct: Unaligned); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` - = note: this error originates in the derive macro `Unaligned` which comes from the expansion of the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui-msrv/enum.stderr b/zerocopy-derive/tests/ui-msrv/enum.stderr index 7617f9c07e4..a71b0722cab 100644 --- a/zerocopy-derive/tests/ui-msrv/enum.stderr +++ b/zerocopy-derive/tests/ui-msrv/enum.stderr @@ -187,8 +187,6 @@ error[E0552]: unrecognized representation hint | 21 | #[repr(foo)] | ^^^ - | - = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` error[E0566]: conflicting representation hints --> tests/ui-msrv/enum.rs:33:8 diff --git a/zerocopy-derive/tests/ui-msrv/late_compile_pass.stderr b/zerocopy-derive/tests/ui-msrv/late_compile_pass.stderr index 7bda5d00115..29d20e4e7f8 100644 --- a/zerocopy-derive/tests/ui-msrv/late_compile_pass.stderr +++ b/zerocopy-derive/tests/ui-msrv/late_compile_pass.stderr @@ -4,16 +4,6 @@ error[E0277]: the trait bound `NotZerocopy: FromZeroes` is not satisfied 23 | #[derive(FromZeroes)] | ^^^^^^^^^^ the trait `FromZeroes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `FromZeroes`: - () - AU16 - F32 - F64 - FromZeroes1 - I128 - I16 - I32 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeroes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -23,16 +13,6 @@ error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied 32 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `FromBytes`: - () - AU16 - F32 - F64 - FromBytes1 - I128 - I16 - I32 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -42,16 +22,6 @@ error[E0277]: the trait bound `FromBytes1: FromZeroes` is not satisfied 32 | #[derive(FromBytes)] | ^^^^^^^^^ the trait `FromZeroes` is not implemented for `FromBytes1` | - = help: the following other types implement trait `FromZeroes`: - () - AU16 - F32 - F64 - FromZeroes1 - I128 - I16 - I32 - and $N others note: required by a bound in `FromBytes` --> $WORKSPACE/src/lib.rs | @@ -65,16 +35,6 @@ error[E0277]: the trait bound `NotZerocopy: AsBytes` is not satisfied 41 | #[derive(AsBytes)] | ^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy` | - = help: the following other types implement trait `AsBytes`: - () - AU16 - AsBytes1 - F32 - F64 - I128 - I16 - I32 - and $N others = help: see issue #48214 = note: this error originates in the derive macro `AsBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -84,16 +44,6 @@ error[E0277]: the trait bound `AU16: Unaligned` is not satisfied 51 | #[derive(Unaligned)] | ^^^^^^^^^ the trait `Unaligned` is not implemented for `AU16` | - = help: the following other types implement trait `Unaligned`: - () - F32 - F64 - I128 - I16 - I32 - I64 - ManuallyDrop - and $N others = help: see issue #48214 = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -103,16 +53,6 @@ error[E0277]: the trait bound `AU16: Unaligned` is not satisfied 59 | #[derive(Unaligned)] | ^^^^^^^^^ the trait `Unaligned` is not implemented for `AU16` | - = help: the following other types implement trait `Unaligned`: - () - F32 - F64 - I128 - I16 - I32 - I64 - ManuallyDrop - and $N others = help: see issue #48214 = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -122,15 +62,5 @@ error[E0277]: the trait bound `AU16: Unaligned` is not satisfied 66 | #[derive(Unaligned)] | ^^^^^^^^^ the trait `Unaligned` is not implemented for `AU16` | - = help: the following other types implement trait `Unaligned`: - () - F32 - F64 - I128 - I16 - I32 - I64 - ManuallyDrop - and $N others = help: see issue #48214 = note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui-msrv/struct.stderr b/zerocopy-derive/tests/ui-msrv/struct.stderr index 1a88f84519c..fe73b80fd07 100644 --- a/zerocopy-derive/tests/ui-msrv/struct.stderr +++ b/zerocopy-derive/tests/ui-msrv/struct.stderr @@ -48,6 +48,7 @@ error[E0277]: the trait bound `HasPadding: ShouldBe` is n 23 | #[derive(AsBytes)] | ^^^^^^^ the trait `ShouldBe` is not implemented for `HasPadding` | - = help: the trait `ShouldBe` is implemented for `HasPadding` + = help: the following implementations were found: + as ShouldBe> = help: see issue #48214 = note: this error originates in the derive macro `AsBytes` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui-msrv/union.stderr b/zerocopy-derive/tests/ui-msrv/union.stderr index 2dab3caaccd..711b8e26a91 100644 --- a/zerocopy-derive/tests/ui-msrv/union.stderr +++ b/zerocopy-derive/tests/ui-msrv/union.stderr @@ -36,6 +36,7 @@ error[E0277]: the trait bound `HasPadding: ShouldBe` is n 26 | #[derive(AsBytes)] | ^^^^^^^ the trait `ShouldBe` is not implemented for `HasPadding` | - = help: the trait `ShouldBe` is implemented for `HasPadding` + = help: the following implementations were found: + as ShouldBe> = help: see issue #48214 = note: this error originates in the derive macro `AsBytes` (in Nightly builds, run with -Z macro-backtrace for more info)