diff --git a/src/lib.rs b/src/lib.rs index f4bee17e8b..925922b631 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2040,9 +2040,7 @@ pub unsafe trait TryFromBytes { // condition will not happen. match source.try_into_valid() { Ok(source) => Ok(source.as_mut()), - Err(e) => { - Err(e.map_src(|src| src.as_bytes::().as_mut()).into()) - } + Err(e) => Err(e.map_src(|src| src.as_bytes().as_mut()).into()), } } Err(e) => Err(e.map_src(Ptr::as_mut).into()), @@ -2622,9 +2620,7 @@ pub unsafe trait TryFromBytes { // condition will not happen. match source.try_into_valid() { Ok(source) => Ok(source.as_mut()), - Err(e) => { - Err(e.map_src(|src| src.as_bytes::().as_mut()).into()) - } + Err(e) => Err(e.map_src(|src| src.as_bytes().as_mut()).into()), } } Err(e) => Err(e.map_src(Ptr::as_mut).into()), @@ -3044,7 +3040,7 @@ fn try_mut_from_prefix_suffix Ok((valid.as_mut(), prefix_suffix.as_mut())), - Err(e) => Err(e.map_src(|src| src.as_bytes::().as_mut()).into()), + Err(e) => Err(e.map_src(|src| src.as_bytes().as_mut()).into()), } } Err(e) => Err(e.map_src(Ptr::as_mut).into()), @@ -4849,7 +4845,7 @@ pub unsafe trait FromBytes: FromZeros { // cannot be violated even though `buf` may have more permissive bit // validity than `ptr`. let ptr = unsafe { ptr.assume_validity::() }; - let ptr = ptr.as_bytes::(); + let ptr = ptr.as_bytes(); src.read_exact(ptr.as_mut())?; // SAFETY: `buf` entirely consists of initialized bytes, and `Self` is // `FromBytes`. diff --git a/src/pointer/mod.rs b/src/pointer/mod.rs index 0ca13aa14c..0c06c43c9b 100644 --- a/src/pointer/mod.rs +++ b/src/pointer/mod.rs @@ -36,7 +36,7 @@ where I: invariant::Invariants, I::Aliasing: invariant::Reference, { - ptr.as_bytes::().as_ref().iter().all(|&byte| byte == 0) + ptr.as_bytes().as_ref().iter().all(|&byte| byte == 0) } #[doc(hidden)] @@ -315,7 +315,8 @@ pub mod cast { } /// A cast from `T` to `[u8]`. - pub(crate) struct AsBytesCast; + #[allow(missing_copy_implementations, missing_debug_implementations)] + pub struct AsBytesCast; // SAFETY: `project` constructs a pointer with the same address as `src` // and with a referent of the same size as `*src`. It does this using diff --git a/src/pointer/ptr.rs b/src/pointer/ptr.rs index 36eaa6151f..57dfd3d2c9 100644 --- a/src/pointer/ptr.rs +++ b/src/pointer/ptr.rs @@ -160,7 +160,7 @@ mod _external { /// Methods for converting to and from `Ptr` and Rust's safe reference types. mod _conversions { use super::*; - use crate::pointer::cast::CastSized; + use crate::pointer::cast::{CastExact, CastSized, IdCast}; /// `&'a T` → `Ptr<'a, T>` impl<'a, T> Ptr<'a, T, (Shared, Aligned, Valid)> @@ -381,7 +381,9 @@ mod _conversions { pub(crate) fn transmute(self) -> Ptr<'a, U, (I::Aliasing, Unaligned, V)> where V: Validity, - U: TransmuteFromPtr + SizeEq + ?Sized, + U: TransmuteFromPtr>::CastFrom, R> + + SizeEq + + ?Sized, { self.transmute_with::>::CastFrom, R>() } @@ -389,8 +391,8 @@ mod _conversions { pub(crate) fn transmute_with(self) -> Ptr<'a, U, (I::Aliasing, Unaligned, V)> where V: Validity, - U: TransmuteFromPtr + ?Sized, - C: crate::pointer::cast::CastExact, + U: TransmuteFromPtr + ?Sized, + C: CastExact, { // SAFETY: // - By `C: CastExact`, `C` preserves referent address, and so we @@ -403,10 +405,8 @@ mod _conversions { // at the same time, as neither can perform interior mutation // - It is directly guaranteed that it is sound for shared code to // operate on these references simultaneously - // - By `U: TransmuteFromPtr`, it is - // sound to perform this transmute using an address- and - // size-preserving cast. By `C: CastExact`, `C` is address- and - // size-preserving. + // - By `U: TransmuteFromPtr`, it + // is sound to perform this transmute using `C`. unsafe { self.project_transmute_unchecked::<_, _, C>() } } @@ -416,19 +416,9 @@ mod _conversions { pub fn recall_validity(self) -> Ptr<'a, T, (I::Aliasing, I::Alignment, V)> where V: Validity, - T: TransmuteFromPtr, + T: TransmuteFromPtr, { - // SAFETY: - // - By `SizeEq::CastFrom: Cast`, `SizeEq::CastFrom` preserves - // referent address, and so we don't need to consider projections - // in the following safety arguments. - // - It is trivially sound to have multiple `&T` referencing the - // same referent simultaneously - // - By `T: TransmuteFromPtr`, it is - // sound to perform this transmute using an address- and - // size-preserving cast (which `IdCast` is). - let ptr = - unsafe { self.project_transmute_unchecked::<_, _, crate::pointer::cast::IdCast>() }; + let ptr = self.transmute_with::(); // SAFETY: `self` and `ptr` have the same address and referent type. // Therefore, if `self` satisfies `I::Alignment`, then so does // `ptr`. @@ -512,6 +502,11 @@ mod _conversions { pub(crate) fn into_unalign( self, ) -> Ptr<'a, crate::Unalign, (I::Aliasing, Aligned, I::Validity)> { + // FIXME(#1359): This should be a `transmute_with` call. + // Unfortunately, to avoid blanket impl conflicts, we only implement + // `TransmuteFrom` for `Unalign` (and vice versa) specifically + // for `Valid` validity, not for all validity types. + // SAFETY: // - By `CastSized: Cast`, `CastSized` preserves referent address, // and so we don't need to consider projections in the following @@ -568,7 +563,7 @@ mod _conversions { /// State transitions between invariants. mod _transitions { use super::*; - use crate::pointer::transmute::TryTransmuteFromPtr; + use crate::pointer::{cast::IdCast, transmute::TryTransmuteFromPtr}; impl<'a, T, I> Ptr<'a, T, I> where @@ -767,59 +762,6 @@ mod _transitions { unsafe { self.assume_validity::() } } - /// Recalls that `self`'s referent is initialized. - #[doc(hidden)] - #[must_use] - #[inline] - // FIXME(#859): Reconsider the name of this method before making it - // public. - pub fn bikeshed_recall_initialized_from_bytes( - self, - ) -> Ptr<'a, T, (I::Aliasing, I::Alignment, Initialized)> - where - T: crate::IntoBytes + crate::FromBytes, - I: Invariants, - { - // SAFETY: The `T: IntoBytes + FromBytes` bound ensures that `T`'s - // bit validity is equivalent to `[u8]`. In other words, the set of - // allowed referents for a `Ptr` is the set of - // initialized bit patterns. The same is true of the set of allowed - // referents for any `Ptr<_, (_, _, Initialized)>`. Thus, this call - // does not change the set of allowed values in the referent. - unsafe { self.assume_initialized() } - } - - /// Recalls that `self`'s referent is initialized. - #[doc(hidden)] - #[must_use] - #[inline] - // FIXME(#859): Reconsider the name of this method before making it - // public. - pub fn bikeshed_recall_initialized_immutable( - self, - ) -> Ptr<'a, T, (Shared, I::Alignment, Initialized)> - where - T: crate::IntoBytes + crate::Immutable, - I: Invariants, - { - // SAFETY: Let `O` (for "old") be the set of allowed bit patterns in - // `self`'s referent, and let `N` (for "new") be the set of allowed - // bit patterns in the referent of the returned `Ptr`. `T: - // IntoBytes` and `I: Invariants` ensures that `O` - // cannot contain any uninitialized bit patterns. Since the returned - // `Ptr` has validity `Initialized`, `N` is equal to the set of all - // initialized bit patterns. Thus, `O` is a subset of `N`, and so - // the returned `Ptr`'s validity invariant is upheld. - // - // Since `T: Immutable` and aliasing is `Shared`, the returned `Ptr` - // cannot be used to modify the referent. Before this call, `self`'s - // referent is guaranteed by invariant on `Ptr` to satisfy `self`'s - // validity invariant. Since the returned `Ptr` cannot be used to - // modify the referent, this guarantee cannot be violated by the - // returned `Ptr` (even if `O` is a strict subset of `N`). - unsafe { self.assume_initialized() } - } - /// Checks that `self`'s referent is validly initialized for `T`, /// returning a `Ptr` with `Valid` on success. /// @@ -839,7 +781,7 @@ mod _transitions { where T: TryFromBytes + Read - + TryTransmuteFromPtr, + + TryTransmuteFromPtr, I::Aliasing: Reference, I: Invariants, { @@ -977,23 +919,17 @@ mod _casts { impl<'a, T, I> Ptr<'a, T, I> where T: 'a + KnownLayout + ?Sized, - I: Invariants, + I: Invariants, { - // FIXME: Is there any way to teach Rust that, for all `T, A, R`, `T: - // Read` implies `[u8]: Read`? - /// Casts this pointer-to-initialized into a pointer-to-bytes. #[allow(clippy::wrong_self_convention)] #[must_use] #[inline] pub fn as_bytes(self) -> Ptr<'a, [u8], (I::Aliasing, Aligned, Valid)> where - T: Read, - [u8]: Read, - I::Aliasing: Reference, + [u8]: TransmuteFromPtr, { - let ptr = self.cast::<_, AsBytesCast, _>(); - ptr.bikeshed_recall_aligned().recall_validity::() + self.transmute_with::<[u8], Valid, AsBytesCast, _>().bikeshed_recall_aligned() } } diff --git a/src/pointer/transmute.rs b/src/pointer/transmute.rs index c61cd422bb..9f48b13b61 100644 --- a/src/pointer/transmute.rs +++ b/src/pointer/transmute.rs @@ -13,7 +13,10 @@ use core::{ }; use crate::{ - pointer::{cast, invariant::*}, + pointer::{ + cast::{self, CastExact, CastSizedExact}, + invariant::*, + }, FromBytes, Immutable, IntoBytes, Unalign, }; @@ -30,17 +33,17 @@ use crate::{ /// /// ## Post-conditions /// -/// Given `Dst: TryTransmuteFromPtr`, callers may assume the -/// following: +/// Given `Dst: TryTransmuteFromPtr`, callers may assume +/// the following: /// /// Given `src: Ptr<'a, Src, (A, _, SV)>`, if the referent of `src` is /// `DV`-valid for `Dst`, then it is sound to transmute `src` into `dst: Ptr<'a, -/// Dst, (A, Unaligned, DV)>` using a address- and size-preserving cast. +/// Dst, (A, Unaligned, DV)>` using `C`. /// /// ## Pre-conditions /// /// Given `src: Ptr` and `dst: Ptr`, -/// `Dst: TryTransmuteFromPtr` is sound if all of the +/// `Dst: TryTransmuteFromPtr` is sound if all of the /// following hold: /// - Forwards transmutation: Either of the following hold: /// - So long as `dst` is active, no mutation of `dst`'s referent is allowed @@ -68,13 +71,14 @@ use crate::{ /// - `src: Ptr<'a, Src, (A, _, SV)>` /// - `src`'s referent is `DV`-valid for `Dst` /// -/// We are trying to prove that it is sound to perform a size-preserving cast -/// from `src` to a `dst: Ptr<'a, Dst, (A, Unaligned, DV)>`. We need to prove -/// that such a cast does not violate any of `src`'s invariants, and that it +/// We are trying to prove that it is sound to perform a cast from `src` to a +/// `dst: Ptr<'a, Dst, (A, Unaligned, DV)>` using `C`. We need to prove that +/// such a cast does not violate any of `src`'s invariants, and that it /// satisfies all invariants of the destination `Ptr` type. /// -/// First, `src`'s address is unchanged, so it still satisfies its alignment. -/// Since `dst`'s alignment is `Unaligned`, it trivially satisfies its alignment. +/// First, by `C: CastExact`, `src`'s address is unchanged, so it still satisfies +/// its alignment. Since `dst`'s alignment is `Unaligned`, it trivially satisfies +/// its alignment. /// /// Second, aliasing is either `Exclusive` or `Shared`: /// - If it is `Exclusive`, then both `src` and `dst` satisfy `Exclusive` @@ -103,7 +107,16 @@ use crate::{ /// - The set of `DV`-valid referents of `dst` is a superset of the set of /// `SV`-valid referents of `src`. Thus, any value written via `src` is /// guaranteed to be a `DV`-valid referent of `dst`. -pub unsafe trait TryTransmuteFromPtr {} +pub unsafe trait TryTransmuteFromPtr< + Src: ?Sized, + A: Aliasing, + SV: Validity, + DV: Validity, + C: CastExact, + R, +> +{ +} #[allow(missing_copy_implementations, missing_debug_implementations)] pub enum BecauseMutationCompatible {} @@ -118,13 +131,13 @@ pub enum BecauseMutationCompatible {} // - Aliasing is `Shared`, `Src: Immutable`, and `Dst: Immutable`, in which // case no mutation is possible via either `Ptr` // - Since the underlying cast is size-preserving, `dst` addresses the same -// bytes as `src`. By `Dst: TransmuteFrom`, the set of +// referent as `src`. By `Dst: TransmuteFrom`, the set of // `DV`-valid referents of `dst` is a superset of the set of `SV`-valid // referents of `src`. // - Reverse transmutation: Since the underlying cast is size-preserving, `dst` -// addresses the same bytes as `src`. By `Src: TransmuteFrom`, the -// set of `DV`-valid referents of `src` is a subset of the set of `SV`-valid -// referents of `dst`. +// addresses the same referent as `src`. By `Src: TransmuteFrom`, +// the set of `DV`-valid referents of `src` is a subset of the set of +// `SV`-valid referents of `dst`. // - No safe code, given access to `src` and `dst`, can cause undefined // behavior: By `Dst: MutationCompatible`, at least one of // the following holds: @@ -132,14 +145,15 @@ pub enum BecauseMutationCompatible {} // - `Src: Immutable` and `Dst: Immutable` // - `Dst: InvariantsEq`, which guarantees that `Src` and `Dst` have the // same invariants, and permit interior mutation on the same byte ranges -unsafe impl - TryTransmuteFromPtr for Dst +unsafe impl + TryTransmuteFromPtr for Dst where A: Aliasing, SV: Validity, DV: Validity, Src: TransmuteFrom + ?Sized, Dst: MutationCompatible + ?Sized, + C: CastExact, { } @@ -150,12 +164,14 @@ where // `dst` does not permit mutation of its referent. // - No safe code, given access to `src` and `dst`, can cause undefined // behavior: `Src: Immutable` and `Dst: Immutable` -unsafe impl TryTransmuteFromPtr for Dst +unsafe impl TryTransmuteFromPtr + for Dst where SV: Validity, DV: Validity, Src: Immutable + ?Sized, Dst: Immutable + ?Sized, + C: CastExact, { } @@ -247,17 +263,30 @@ unsafe impl InvariantsEq> for T {} /// /// `Dst: TransmuteFromPtr` is equivalent to `Dst: /// TryTransmuteFromPtr + TransmuteFrom`. -pub unsafe trait TransmuteFromPtr: - TryTransmuteFromPtr + TransmuteFrom +pub unsafe trait TransmuteFromPtr< + Src: ?Sized, + A: Aliasing, + SV: Validity, + DV: Validity, + C: CastExact, + R, +>: TryTransmuteFromPtr + TransmuteFrom { } // SAFETY: The `where` bounds are equivalent to the safety invariant on // `TransmuteFromPtr`. -unsafe impl - TransmuteFromPtr for Dst +unsafe impl< + Src: ?Sized, + Dst: ?Sized, + A: Aliasing, + SV: Validity, + DV: Validity, + C: CastExact, + R, + > TransmuteFromPtr for Dst where - Dst: TransmuteFrom + TryTransmuteFromPtr, + Dst: TransmuteFrom + TryTransmuteFromPtr, { } @@ -289,9 +318,9 @@ pub unsafe trait TransmuteFrom {} /// the [`CastExact`] bound. /// /// [`CastFrom`]: SizeEq::CastFrom -/// [`CastExact`]: cast::CastExact +/// [`CastExact`]: CastExact pub trait SizeEq { - type CastFrom: cast::CastExact; + type CastFrom: CastExact; } impl SizeEq for T { @@ -449,11 +478,11 @@ impl_transitive_transmute_from!(T: ?Sized => UnsafeCell => T => Cell); unsafe impl TransmuteFrom for MaybeUninit {} impl SizeEq for MaybeUninit { - type CastFrom = cast::CastSizedExact; + type CastFrom = CastSizedExact; } impl SizeEq> for T { - type CastFrom = cast::CastSizedExact; + type CastFrom = CastSizedExact; } #[cfg(test)] diff --git a/src/ref.rs b/src/ref.rs index 49d70b45d4..6354442b63 100644 --- a/src/ref.rs +++ b/src/ref.rs @@ -960,7 +960,7 @@ where T: FromBytes + KnownLayout + ?Sized, A: crate::invariant::Aliasing, [u8]: MutationCompatible, - T: TransmuteFromPtr, + T: TransmuteFromPtr, { use crate::pointer::cast::{Cast, Project}; diff --git a/src/util/macro_util.rs b/src/util/macro_util.rs index ab4be24046..0f18bc7237 100644 --- a/src/util/macro_util.rs +++ b/src/util/macro_util.rs @@ -29,6 +29,7 @@ use core::{ use crate::{ pointer::{ + cast::{CastSized, IdCast}, invariant::{self, BecauseExclusive, BecauseImmutable, Invariants}, BecauseInvariantsEq, TryTransmuteFromPtr, }, @@ -635,20 +636,17 @@ where Src: invariant::Read, Dst: TryFromBytes + invariant::Read - + TryTransmuteFromPtr, + + TryTransmuteFromPtr, I: Invariants, I::Aliasing: invariant::Reference, { - static_assert!(Src, Dst => mem::size_of::() == mem::size_of::()); - - let c_ptr = src.cast::<_, crate::pointer::cast::CastSized, _>(); - + let c_ptr = src.cast::<_, CastSized, _>(); match c_ptr.try_into_valid() { Ok(ptr) => Ok(ptr), Err(err) => { // Re-cast `Ptr` to `Ptr`. let ptr = err.into_src(); - let ptr = ptr.cast::<_, crate::pointer::cast::CastSized, _>(); + let ptr = ptr.cast::<_, CastSized, _>(); // SAFETY: `ptr` is `src`, and has the same alignment invariant. let ptr = unsafe { ptr.assume_alignment::() }; // SAFETY: `ptr` is `src` and has the same validity invariant. @@ -727,7 +725,7 @@ where Dst: TryFromBytes + Immutable, { let ptr = Ptr::from_ref(src); - let ptr = ptr.bikeshed_recall_initialized_immutable(); + let ptr = ptr.recall_validity::(); match try_cast_or_pme::(ptr) { Ok(ptr) => { static_assert!(Src, Dst => mem::align_of::() <= mem::align_of::()); @@ -771,7 +769,7 @@ where Dst: TryFromBytes + IntoBytes, { let ptr = Ptr::from_mut(src); - let ptr = ptr.bikeshed_recall_initialized_from_bytes(); + let ptr = ptr.recall_validity::(); match try_cast_or_pme::(ptr) { Ok(ptr) => { static_assert!(Src, Dst => mem::align_of::() <= mem::align_of::()); diff --git a/zerocopy-derive/tests/ui-nightly/enum.stderr b/zerocopy-derive/tests/ui-nightly/enum.stderr index 2ece01b011..5d6f4a92cb 100644 --- a/zerocopy-derive/tests/ui-nightly/enum.stderr +++ b/zerocopy-derive/tests/ui-nightly/enum.stderr @@ -482,7 +482,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -504,7 +504,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -526,7 +526,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui-nightly/struct.stderr b/zerocopy-derive/tests/ui-nightly/struct.stderr index 688f0b3481..4ba680b355 100644 --- a/zerocopy-derive/tests/ui-nightly/struct.stderr +++ b/zerocopy-derive/tests/ui-nightly/struct.stderr @@ -325,7 +325,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -347,7 +347,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -405,7 +405,7 @@ help: the trait `DynamicPaddingFree` is not implemented for `( but trait `DynamicPaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 82 | impl DynamicPaddingFree for () {} + 83 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -427,7 +427,7 @@ help: the trait `DynamicPaddingFree` is not implemented for `( but trait `DynamicPaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 82 | impl DynamicPaddingFree for () {} + 83 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -449,7 +449,7 @@ help: the trait `DynamicPaddingFree` is not implemented for `( but trait `DynamicPaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 82 | impl DynamicPaddingFree for () {} + 83 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui-stable/enum.stderr b/zerocopy-derive/tests/ui-stable/enum.stderr index c91e177995..24d0c42799 100644 --- a/zerocopy-derive/tests/ui-stable/enum.stderr +++ b/zerocopy-derive/tests/ui-stable/enum.stderr @@ -439,7 +439,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -457,7 +457,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -475,7 +475,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/zerocopy-derive/tests/ui-stable/struct.stderr b/zerocopy-derive/tests/ui-stable/struct.stderr index 66ebb049df..4adff4acef 100644 --- a/zerocopy-derive/tests/ui-stable/struct.stderr +++ b/zerocopy-derive/tests/ui-stable/struct.stderr @@ -293,7 +293,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -311,7 +311,7 @@ help: the trait `PaddingFree` is not implemented for `()` but trait `PaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 64 | impl PaddingFree for () {} + 65 | impl PaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -365,7 +365,7 @@ help: the trait `DynamicPaddingFree` is not implemented for `( but trait `DynamicPaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 82 | impl DynamicPaddingFree for () {} + 83 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -383,7 +383,7 @@ help: the trait `DynamicPaddingFree` is not implemented for `( but trait `DynamicPaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 82 | impl DynamicPaddingFree for () {} + 83 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -401,7 +401,7 @@ help: the trait `DynamicPaddingFree` is not implemented for `( but trait `DynamicPaddingFree` is implemented for it --> $WORKSPACE/src/util/macro_util.rs | - 82 | impl DynamicPaddingFree for () {} + 83 | impl DynamicPaddingFree for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: see issue #48214 = note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)