diff --git a/src/impls.rs b/src/impls.rs index c7d77326a8..221cdcbf74 100644 --- a/src/impls.rs +++ b/src/impls.rs @@ -1005,6 +1005,137 @@ const _: () = unsafe { // [1] https://doc.rust-lang.org/core/option/enum.Option.html const _: () = unsafe { unsafe_impl!(T: Immutable => Immutable for Option) }; +mod tuples { + use super::*; + + /// Generates various trait implementations for tuples. + /// + /// # Safety + /// + /// `impl_tuple!` should be provided name-number pairs, where each number is + /// the ordinal of the preceding type name. + macro_rules! impl_tuple { + // Entry point. + ($($T:ident $I:tt),+ $(,)?) => { + crate::util::macros::__unsafe(); + impl_tuple!(@all [] [$($T $I)+]); + }; + + // Build up the set of tuple types (i.e., `(A,)`, `(A, B)`, `(A, B, C)`, + // etc.) Trait implementations that do not depend on field index may be + // added to this branch. + (@all [$($head_T:ident $head_I:tt)*] [$next_T:ident $next_I:tt $($tail:tt)*]) => { + // SAFETY: If all fields of the tuple `Self` are `Immutable`, so too is `Self`. + unsafe_impl!($($head_T: Immutable,)* $next_T: Immutable => Immutable for ($($head_T,)* $next_T,)); + + // SAFETY: If all fields in `c` are `is_bit_valid`, so too is `c`. + unsafe_impl!($($head_T: TryFromBytes,)* $next_T: TryFromBytes => TryFromBytes for ($($head_T,)* $next_T,); |c| { + let mut c = c; + $(TryFromBytes::is_bit_valid(c.reborrow().project::<_, { crate::ident_id!($head_I) }>()) &&)* + TryFromBytes::is_bit_valid(c.reborrow().project::<_, { crate::ident_id!($next_I) }>()) + }); + + // SAFETY: If all fields in `Self` are `FromZeros`, so too is `Self`. + unsafe_impl!($($head_T: FromZeros,)* $next_T: FromZeros => FromZeros for ($($head_T,)* $next_T,)); + + // SAFETY: If all fields in `Self` are `FromBytes`, so too is `Self`. + unsafe_impl!($($head_T: FromBytes,)* $next_T: FromBytes => FromBytes for ($($head_T,)* $next_T,)); + + // Generate impls that depend on tuple index. + impl_tuple!(@variants + [$($head_T $head_I)* $next_T $next_I] + [] + [$($head_T $head_I)* $next_T $next_I] + ); + + // Recurse to next tuple size + impl_tuple!(@all [$($head_T $head_I)* $next_T $next_I] [$($tail)*]); + }; + (@all [$($head_T:ident $head_I:tt)*] []) => {}; + + // Emit trait implementations that depend on field index. + (@variants + // The full tuple definition in type–index pairs. + [$($AllT:ident $AllI:tt)+] + // Types before the current index. + [$($BeforeT:ident)*] + // The types and indices at and after the current index. + [$CurrT:ident $CurrI:tt $($AfterT:ident $AfterI:tt)*] + ) => { + // SAFETY: + // - `Self` is a struct (albeit anonymous), so `VARIANT_ID` is + // `STRUCT_VARIANT_ID`. + // - `$CurrI` is the field at index `$CurrI`, so `FIELD_ID` is + // `zerocopy::ident_id!($CurrI)` + // - `()` has the same visibility as the `.$CurrI` field (ie, `.0`, + // `.1`, etc) + // - `Type` has the same type as `$CurrI`; i.e., `$CurrT`. + unsafe impl<$($AllT),+> crate::HasField< + (), + { crate::STRUCT_VARIANT_ID }, + { crate::ident_id!($CurrI)} + > for ($($AllT,)+) { + #[inline] + fn only_derive_is_allowed_to_implement_this_trait() + where + Self: Sized + {} + + type Type = $CurrT; + + #[inline(always)] + fn project(slf: crate::PtrInner<'_, Self>) -> *mut Self::Type { + let slf = slf.as_non_null().as_ptr(); + // SAFETY: `PtrInner` promises it references either a zero-sized + // byte range, or else will reference a byte range that is + // entirely contained within an allocated object. In either + // case, this guarantees that `(*slf).$CurrI` is in-bounds of + // `slf`. + unsafe { core::ptr::addr_of_mut!((*slf).$CurrI) } + } + } + + // Recurse to the next index. + impl_tuple!(@variants [$($AllT $AllI)+] [$($BeforeT)* $CurrT] [$($AfterT $AfterI)*]); + }; + (@variants [$($AllT:ident $AllI:tt)+] [$($BeforeT:ident)*] []) => {}; + } + + // SAFETY: `impl_tuple` is provided name-number pairs, where number is the + // ordinal of the name. + #[allow(clippy::multiple_unsafe_ops_per_block)] + const _: () = unsafe { + impl_tuple! { + A 0, + B 1, + C 2, + D 3, + E 4, + F 5, + G 6, + H 7, + I 8, + J 9, + K 10, + L 11, + M 12, + N 13, + O 14, + P 15, + Q 16, + R 17, + S 18, + T 19, + U 20, + V 21, + W 22, + X 23, + Y 24, + Z 25, + }; + }; +} + // SIMD support // // Per the Unsafe Code Guidelines Reference [1]: diff --git a/tests/ui-nightly/diagnostic-not-implemented-from-bytes.stderr b/tests/ui-nightly/diagnostic-not-implemented-from-bytes.stderr index 96aedb28db..042473b972 100644 --- a/tests/ui-nightly/diagnostic-not-implemented-from-bytes.stderr +++ b/tests/ui-nightly/diagnostic-not-implemented-from-bytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `takes_from_bytes` --> tests/ui-nightly/diagnostic-not-implemented-from-bytes.rs:21:24 diff --git a/tests/ui-nightly/diagnostic-not-implemented-from-zeros.stderr b/tests/ui-nightly/diagnostic-not-implemented-from-zeros.stderr index 00d4d8411e..77df3f445c 100644 --- a/tests/ui-nightly/diagnostic-not-implemented-from-zeros.stderr +++ b/tests/ui-nightly/diagnostic-not-implemented-from-zeros.stderr @@ -12,13 +12,13 @@ help: the trait `FromZeros` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `takes_from_zeros` --> tests/ui-nightly/diagnostic-not-implemented-from-zeros.rs:21:24 diff --git a/tests/ui-nightly/diagnostic-not-implemented-immutable.stderr b/tests/ui-nightly/diagnostic-not-implemented-immutable.stderr index 6a7dfb9b82..f08ae8280d 100644 --- a/tests/ui-nightly/diagnostic-not-implemented-immutable.stderr +++ b/tests/ui-nightly/diagnostic-not-implemented-immutable.stderr @@ -14,11 +14,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `NotZerocopy` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `takes_immutable` --> tests/ui-nightly/diagnostic-not-implemented-immutable.rs:21:23 diff --git a/tests/ui-nightly/diagnostic-not-implemented-try-from-bytes.stderr b/tests/ui-nightly/diagnostic-not-implemented-try-from-bytes.stderr index f080bb446d..11d9fae39f 100644 --- a/tests/ui-nightly/diagnostic-not-implemented-try-from-bytes.stderr +++ b/tests/ui-nightly/diagnostic-not-implemented-try-from-bytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `takes_try_from_bytes` --> tests/ui-nightly/diagnostic-not-implemented-try-from-bytes.rs:21:28 diff --git a/tests/ui-nightly/include_value_not_from_bytes.stderr b/tests/ui-nightly/include_value_not_from_bytes.stderr index f7999508f5..e95e72b762 100644 --- a/tests/ui-nightly/include_value_not_from_bytes.stderr +++ b/tests/ui-nightly/include_value_not_from_bytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `NOT_FROM_BYTES::transmute` --> tests/ui-nightly/include_value_not_from_bytes.rs:19:42 diff --git a/tests/ui-nightly/transmute-dst-not-frombytes.stderr b/tests/ui-nightly/transmute-dst-not-frombytes.stderr index ade6fad666..9a3ed77475 100644 --- a/tests/ui-nightly/transmute-dst-not-frombytes.stderr +++ b/tests/ui-nightly/transmute-dst-not-frombytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `DST_NOT_FROM_BYTES::transmute` --> tests/ui-nightly/transmute-dst-not-frombytes.rs:19:41 diff --git a/tests/ui-nightly/transmute-mut-dst-not-frombytes.stderr b/tests/ui-nightly/transmute-mut-dst-not-frombytes.stderr index 6d117e21b0..de92afb002 100644 --- a/tests/ui-nightly/transmute-mut-dst-not-frombytes.stderr +++ b/tests/ui-nightly/transmute-mut-dst-not-frombytes.stderr @@ -12,13 +12,13 @@ help: the trait `FromBytes` is not implemented for `Dst` = note: Consider adding `#[derive(FromBytes)]` to `Dst` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs diff --git a/tests/ui-nightly/transmute-mut-src-not-frombytes.stderr b/tests/ui-nightly/transmute-mut-src-not-frombytes.stderr index fc62627312..dbf8dda209 100644 --- a/tests/ui-nightly/transmute-mut-src-not-frombytes.stderr +++ b/tests/ui-nightly/transmute-mut-src-not-frombytes.stderr @@ -12,13 +12,13 @@ help: the trait `FromBytes` is not implemented for `Src` = note: Consider adding `#[derive(FromBytes)]` to `Src` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs diff --git a/tests/ui-nightly/transmute-ref-dst-not-frombytes.stderr b/tests/ui-nightly/transmute-ref-dst-not-frombytes.stderr index 8d0fc3639b..4e01b16a2c 100644 --- a/tests/ui-nightly/transmute-ref-dst-not-frombytes.stderr +++ b/tests/ui-nightly/transmute-ref-dst-not-frombytes.stderr @@ -15,13 +15,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `Dst` = note: Consider adding `#[derive(FromBytes)]` to `Dst` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `AssertDstIsFromBytes` --> tests/ui-nightly/transmute-ref-dst-not-frombytes.rs:23:34 diff --git a/tests/ui-nightly/transmute-ref-dst-not-nocell.stderr b/tests/ui-nightly/transmute-ref-dst-not-nocell.stderr index 62bec102fb..a96d25309d 100644 --- a/tests/ui-nightly/transmute-ref-dst-not-nocell.stderr +++ b/tests/ui-nightly/transmute-ref-dst-not-nocell.stderr @@ -17,11 +17,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `Dst` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `AssertDstIsImmutable` --> tests/ui-nightly/transmute-ref-dst-not-nocell.rs:23:33 diff --git a/tests/ui-nightly/transmute-ref-src-not-nocell.stderr b/tests/ui-nightly/transmute-ref-src-not-nocell.stderr index 33240d5ae5..17debd8c91 100644 --- a/tests/ui-nightly/transmute-ref-src-not-nocell.stderr +++ b/tests/ui-nightly/transmute-ref-src-not-nocell.stderr @@ -17,11 +17,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `Src` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `AssertSrcIsImmutable` --> tests/ui-nightly/transmute-ref-src-not-nocell.rs:23:34 @@ -46,11 +46,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `Src` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `AssertSrcIsImmutable` --> tests/ui-nightly/transmute-ref-src-not-nocell.rs:23:34 diff --git a/tests/ui-nightly/try_transmute-dst-not-tryfrombytes.stderr b/tests/ui-nightly/try_transmute-dst-not-tryfrombytes.stderr index 86ded303c0..28ce2ebd2a 100644 --- a/tests/ui-nightly/try_transmute-dst-not-tryfrombytes.stderr +++ b/tests/ui-nightly/try_transmute-dst-not-tryfrombytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs @@ -40,13 +40,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `try_transmute` --> src/util/macro_util.rs @@ -72,13 +72,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs diff --git a/tests/ui-nightly/try_transmute_mut-dst-not-tryfrombytes.stderr b/tests/ui-nightly/try_transmute_mut-dst-not-tryfrombytes.stderr index 390c6f2c2f..5c1e2c4473 100644 --- a/tests/ui-nightly/try_transmute_mut-dst-not-tryfrombytes.stderr +++ b/tests/ui-nightly/try_transmute_mut-dst-not-tryfrombytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs @@ -40,13 +40,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `try_transmute_mut` --> src/util/macro_util.rs @@ -104,13 +104,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs diff --git a/tests/ui-nightly/try_transmute_mut-src-not-frombytes.stderr b/tests/ui-nightly/try_transmute_mut-src-not-frombytes.stderr index 1cb5717348..0b0e2f47c2 100644 --- a/tests/ui-nightly/try_transmute_mut-src-not-frombytes.stderr +++ b/tests/ui-nightly/try_transmute_mut-src-not-frombytes.stderr @@ -12,13 +12,13 @@ help: the trait `FromBytes` is not implemented for `Src` = note: Consider adding `#[derive(FromBytes)]` to `Src` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs @@ -44,13 +44,13 @@ help: the trait `FromBytes` is not implemented for `Dst` = note: Consider adding `#[derive(FromBytes)]` to `Dst` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs diff --git a/tests/ui-nightly/try_transmute_mut-src-not-intobytes.stderr b/tests/ui-nightly/try_transmute_mut-src-not-intobytes.stderr index 4c5b59fbe8..21c4a851f6 100644 --- a/tests/ui-nightly/try_transmute_mut-src-not-intobytes.stderr +++ b/tests/ui-nightly/try_transmute_mut-src-not-intobytes.stderr @@ -44,13 +44,13 @@ help: the trait `FromBytes` is not implemented for `Dst` = note: Consider adding `#[derive(FromBytes)]` to `Dst` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs diff --git a/tests/ui-nightly/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr b/tests/ui-nightly/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr index 9454a1c852..f982f3a23a 100644 --- a/tests/ui-nightly/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr +++ b/tests/ui-nightly/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs @@ -40,13 +40,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `try_transmute_ref` --> src/util/macro_util.rs @@ -74,11 +74,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `NotZerocopy` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `try_transmute_ref` --> src/util/macro_util.rs @@ -104,13 +104,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs diff --git a/tests/ui-nightly/try_transmute_ref-src-not-immutable-intobytes.stderr b/tests/ui-nightly/try_transmute_ref-src-not-immutable-intobytes.stderr index 3c74c3817b..efb2296a29 100644 --- a/tests/ui-nightly/try_transmute_ref-src-not-immutable-intobytes.stderr +++ b/tests/ui-nightly/try_transmute_ref-src-not-immutable-intobytes.stderr @@ -46,11 +46,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `NotZerocopy` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `try_transmute_ref` --> src/util/macro_util.rs diff --git a/tests/ui-stable/diagnostic-not-implemented-from-bytes.stderr b/tests/ui-stable/diagnostic-not-implemented-from-bytes.stderr index a8af9c7ca0..815b20c615 100644 --- a/tests/ui-stable/diagnostic-not-implemented-from-bytes.stderr +++ b/tests/ui-stable/diagnostic-not-implemented-from-bytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `takes_from_bytes` --> tests/ui-stable/diagnostic-not-implemented-from-bytes.rs:21:24 diff --git a/tests/ui-stable/diagnostic-not-implemented-from-zeros.stderr b/tests/ui-stable/diagnostic-not-implemented-from-zeros.stderr index 6da6fa299f..8bea0161a8 100644 --- a/tests/ui-stable/diagnostic-not-implemented-from-zeros.stderr +++ b/tests/ui-stable/diagnostic-not-implemented-from-zeros.stderr @@ -12,13 +12,13 @@ help: the trait `FromZeros` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `takes_from_zeros` --> tests/ui-stable/diagnostic-not-implemented-from-zeros.rs:21:24 diff --git a/tests/ui-stable/diagnostic-not-implemented-immutable.stderr b/tests/ui-stable/diagnostic-not-implemented-immutable.stderr index 47c4e83982..44e7212c0d 100644 --- a/tests/ui-stable/diagnostic-not-implemented-immutable.stderr +++ b/tests/ui-stable/diagnostic-not-implemented-immutable.stderr @@ -14,11 +14,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `NotZerocopy` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `takes_immutable` --> tests/ui-stable/diagnostic-not-implemented-immutable.rs:21:23 diff --git a/tests/ui-stable/diagnostic-not-implemented-try-from-bytes.stderr b/tests/ui-stable/diagnostic-not-implemented-try-from-bytes.stderr index 8b5b3a8f48..b291417f73 100644 --- a/tests/ui-stable/diagnostic-not-implemented-try-from-bytes.stderr +++ b/tests/ui-stable/diagnostic-not-implemented-try-from-bytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `takes_try_from_bytes` --> tests/ui-stable/diagnostic-not-implemented-try-from-bytes.rs:21:28 diff --git a/tests/ui-stable/include_value_not_from_bytes.stderr b/tests/ui-stable/include_value_not_from_bytes.stderr index 8f2bcbea6b..7e70aa0b69 100644 --- a/tests/ui-stable/include_value_not_from_bytes.stderr +++ b/tests/ui-stable/include_value_not_from_bytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `NOT_FROM_BYTES::transmute` --> tests/ui-stable/include_value_not_from_bytes.rs:19:42 diff --git a/tests/ui-stable/transmute-dst-not-frombytes.stderr b/tests/ui-stable/transmute-dst-not-frombytes.stderr index bd31ed0ca8..550f142039 100644 --- a/tests/ui-stable/transmute-dst-not-frombytes.stderr +++ b/tests/ui-stable/transmute-dst-not-frombytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `DST_NOT_FROM_BYTES::transmute` --> tests/ui-stable/transmute-dst-not-frombytes.rs:19:41 diff --git a/tests/ui-stable/transmute-mut-dst-not-frombytes.stderr b/tests/ui-stable/transmute-mut-dst-not-frombytes.stderr index cfd6c21474..7aba82630f 100644 --- a/tests/ui-stable/transmute-mut-dst-not-frombytes.stderr +++ b/tests/ui-stable/transmute-mut-dst-not-frombytes.stderr @@ -12,13 +12,13 @@ help: the trait `FromBytes` is not implemented for `Dst` = note: Consider adding `#[derive(FromBytes)]` to `Dst` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs diff --git a/tests/ui-stable/transmute-mut-src-not-frombytes.stderr b/tests/ui-stable/transmute-mut-src-not-frombytes.stderr index 5d7e7fb415..6718eaac49 100644 --- a/tests/ui-stable/transmute-mut-src-not-frombytes.stderr +++ b/tests/ui-stable/transmute-mut-src-not-frombytes.stderr @@ -12,13 +12,13 @@ help: the trait `FromBytes` is not implemented for `Src` = note: Consider adding `#[derive(FromBytes)]` to `Src` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs diff --git a/tests/ui-stable/transmute-ref-dst-not-frombytes.stderr b/tests/ui-stable/transmute-ref-dst-not-frombytes.stderr index 4e775bf303..20532a42ef 100644 --- a/tests/ui-stable/transmute-ref-dst-not-frombytes.stderr +++ b/tests/ui-stable/transmute-ref-dst-not-frombytes.stderr @@ -15,13 +15,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `Dst` = note: Consider adding `#[derive(FromBytes)]` to `Dst` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `AssertDstIsFromBytes` --> tests/ui-stable/transmute-ref-dst-not-frombytes.rs:23:34 diff --git a/tests/ui-stable/transmute-ref-dst-not-nocell.stderr b/tests/ui-stable/transmute-ref-dst-not-nocell.stderr index 3f7edc29cd..7be53d86ba 100644 --- a/tests/ui-stable/transmute-ref-dst-not-nocell.stderr +++ b/tests/ui-stable/transmute-ref-dst-not-nocell.stderr @@ -17,11 +17,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `Dst` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `AssertDstIsImmutable` --> tests/ui-stable/transmute-ref-dst-not-nocell.rs:23:33 diff --git a/tests/ui-stable/transmute-ref-src-not-nocell.stderr b/tests/ui-stable/transmute-ref-src-not-nocell.stderr index 46bf46ae07..19bbaf8f99 100644 --- a/tests/ui-stable/transmute-ref-src-not-nocell.stderr +++ b/tests/ui-stable/transmute-ref-src-not-nocell.stderr @@ -17,11 +17,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `Src` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `AssertSrcIsImmutable` --> tests/ui-stable/transmute-ref-src-not-nocell.rs:23:34 @@ -46,11 +46,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `Src` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `AssertSrcIsImmutable` --> tests/ui-stable/transmute-ref-src-not-nocell.rs:23:34 diff --git a/tests/ui-stable/try_transmute-dst-not-tryfrombytes.stderr b/tests/ui-stable/try_transmute-dst-not-tryfrombytes.stderr index 3d96eaf36a..d40f55f685 100644 --- a/tests/ui-stable/try_transmute-dst-not-tryfrombytes.stderr +++ b/tests/ui-stable/try_transmute-dst-not-tryfrombytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs @@ -40,13 +40,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `try_transmute` --> src/util/macro_util.rs @@ -72,13 +72,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs diff --git a/tests/ui-stable/try_transmute_mut-dst-not-tryfrombytes.stderr b/tests/ui-stable/try_transmute_mut-dst-not-tryfrombytes.stderr index 139dcaa5b1..7b342747f7 100644 --- a/tests/ui-stable/try_transmute_mut-dst-not-tryfrombytes.stderr +++ b/tests/ui-stable/try_transmute_mut-dst-not-tryfrombytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs @@ -40,13 +40,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `try_transmute_mut` --> src/util/macro_util.rs @@ -104,13 +104,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs diff --git a/tests/ui-stable/try_transmute_mut-src-not-frombytes.stderr b/tests/ui-stable/try_transmute_mut-src-not-frombytes.stderr index e99b2f0990..2c8a1a4bae 100644 --- a/tests/ui-stable/try_transmute_mut-src-not-frombytes.stderr +++ b/tests/ui-stable/try_transmute_mut-src-not-frombytes.stderr @@ -12,13 +12,13 @@ help: the trait `FromBytes` is not implemented for `Src` = note: Consider adding `#[derive(FromBytes)]` to `Src` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs @@ -44,13 +44,13 @@ help: the trait `FromBytes` is not implemented for `Dst` = note: Consider adding `#[derive(FromBytes)]` to `Dst` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs diff --git a/tests/ui-stable/try_transmute_mut-src-not-intobytes.stderr b/tests/ui-stable/try_transmute_mut-src-not-intobytes.stderr index cd2c51f853..0aae9b99c1 100644 --- a/tests/ui-stable/try_transmute_mut-src-not-intobytes.stderr +++ b/tests/ui-stable/try_transmute_mut-src-not-intobytes.stderr @@ -44,13 +44,13 @@ help: the trait `FromBytes` is not implemented for `Dst` = note: Consider adding `#[derive(FromBytes)]` to `Dst` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `Wrap::<&'a mut Src, &'a mut Dst>::transmute_mut` --> src/util/macro_util.rs diff --git a/tests/ui-stable/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr b/tests/ui-stable/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr index 0a004a6081..2dd0641184 100644 --- a/tests/ui-stable/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr +++ b/tests/ui-stable/try_transmute_ref-dst-not-immutable-tryfrombytes.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs @@ -40,13 +40,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `try_transmute_ref` --> src/util/macro_util.rs @@ -74,11 +74,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `NotZerocopy` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `try_transmute_ref` --> src/util/macro_util.rs @@ -104,13 +104,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required by a bound in `ValidityError` --> src/error.rs diff --git a/tests/ui-stable/try_transmute_ref-src-not-immutable-intobytes.stderr b/tests/ui-stable/try_transmute_ref-src-not-immutable-intobytes.stderr index fcd3836c40..831b088d75 100644 --- a/tests/ui-stable/try_transmute_ref-src-not-immutable-intobytes.stderr +++ b/tests/ui-stable/try_transmute_ref-src-not-immutable-intobytes.stderr @@ -46,11 +46,11 @@ help: the trait `zerocopy::Immutable` is not implemented for `NotZerocopy` &T &mut T () - *const T - *mut T - AU16 - Box - F32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others note: required by a bound in `try_transmute_ref` --> src/util/macro_util.rs diff --git a/tools/update-ui-test-files.sh b/tools/update-ui-test-files.sh index 00f6b5680f..d2b7ee498d 100755 --- a/tools/update-ui-test-files.sh +++ b/tools/update-ui-test-files.sh @@ -12,12 +12,12 @@ set -e -TRYBUILD=overwrite ./cargo.sh +nightly test ui --test trybuild -p zerocopy --all-features -TRYBUILD=overwrite ./cargo.sh +stable test ui --test trybuild -p zerocopy --features=__internal_use_only_features_that_work_on_stable +TRYBUILD=overwrite ./cargo.sh +nightly test ui --verbose --test trybuild -p zerocopy --all-features +TRYBUILD=overwrite ./cargo.sh +stable test ui --verbose --test trybuild -p zerocopy --features=__internal_use_only_features_that_work_on_stable # For developers using Rust Analyzer, it's often the case that Rust Analyzer has # chosen versions of dependencies (especially syn) which have an MSRV higher than # our own. Doing `rm Cargo.lock` here permits `./cargo.sh +msrv` to choose its own # versions of these crates that have a lower MSRV. -rm Cargo.lock && TRYBUILD=overwrite ./cargo.sh +msrv test ui --test trybuild -p zerocopy --features=__internal_use_only_features_that_work_on_stable +rm Cargo.lock && TRYBUILD=overwrite ./cargo.sh +msrv test ui --verbose --test trybuild -p zerocopy --features=__internal_use_only_features_that_work_on_stable -TRYBUILD=overwrite ./cargo.sh +all test ui --test trybuild -p zerocopy-derive +TRYBUILD=overwrite ./cargo.sh +all test ui --verbose --test trybuild -p zerocopy-derive diff --git a/zerocopy-derive/src/lib.rs b/zerocopy-derive/src/lib.rs index 9c2bb440c5..4f26070a2c 100644 --- a/zerocopy-derive/src/lib.rs +++ b/zerocopy-derive/src/lib.rs @@ -897,15 +897,11 @@ fn derive_try_from_bytes_struct( where ___ZerocopyAliasing: #zerocopy_crate::pointer::invariant::Reference, { - use #zerocopy_crate::util::macro_util::core_reexport; - use #zerocopy_crate::pointer::PtrInner; - true #(&& { let field_candidate = candidate.reborrow().project::< _, { #zerocopy_crate::ident_id!(#field_names) } >(); - <#field_tys as #zerocopy_crate::TryFromBytes>::is_bit_valid(field_candidate) })* } diff --git a/zerocopy-derive/src/output_tests.rs b/zerocopy-derive/src/output_tests.rs index 20237cf296..d7856c2139 100644 --- a/zerocopy-derive/src/output_tests.rs +++ b/zerocopy-derive/src/output_tests.rs @@ -309,8 +309,6 @@ fn test_try_from_bytes() { where ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, { - use ::zerocopy::util::macro_util::core_reexport; - use ::zerocopy::pointer::PtrInner; true } } @@ -334,8 +332,6 @@ fn test_from_zeros() { where ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, { - use ::zerocopy::util::macro_util::core_reexport; - use ::zerocopy::pointer::PtrInner; true } } @@ -625,529 +621,871 @@ fn test_try_from_bytes_enum() { TupleLike(bool, Y, PhantomData<&'a [(X, Y); N]>), } } expands to { - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl<'a: 'static, const N: usize, X, Y: Deref> ::zerocopy::TryFromBytes - for ComplexWithGenerics<'a, { N }, X, Y> - where - X: Deref, - u8: ::zerocopy::TryFromBytes, - X: ::zerocopy::TryFromBytes, - X::Target: ::zerocopy::TryFromBytes, - Y::Target: ::zerocopy::TryFromBytes, - [(X, Y); N]: ::zerocopy::TryFromBytes, - bool: ::zerocopy::TryFromBytes, - Y: ::zerocopy::TryFromBytes, - PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - fn is_bit_valid<___ZerocopyAliasing>( - candidate: ::zerocopy::Maybe<'_, Self, ___ZerocopyAliasing>, - ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool - where - ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, - { - use ::zerocopy::util::macro_util::core_reexport; - #[repr(u8)] - #[allow(dead_code, non_camel_case_types)] - enum ___ZerocopyTag { - UnitLike, - StructLike, - TupleLike, - } - unsafe impl ::zerocopy::Immutable for ___ZerocopyTag { - fn only_derive_is_allowed_to_implement_this_trait() {} - } - type ___ZerocopyTagPrimitive = ::zerocopy::util::macro_util::SizeToTag< - { core_reexport::mem::size_of::<___ZerocopyTag>() }, - >; - #[allow(non_upper_case_globals)] - const ___ZEROCOPY_TAG_UnitLike: ___ZerocopyTagPrimitive = ___ZerocopyTag::UnitLike - as ___ZerocopyTagPrimitive; - #[allow(non_upper_case_globals)] - const ___ZEROCOPY_TAG_StructLike: ___ZerocopyTagPrimitive = ___ZerocopyTag::StructLike - as ___ZerocopyTagPrimitive; - #[allow(non_upper_case_globals)] - const ___ZEROCOPY_TAG_TupleLike: ___ZerocopyTagPrimitive = ___ZerocopyTag::TupleLike - as ___ZerocopyTagPrimitive; - type ___ZerocopyOuterTag = (); - type ___ZerocopyInnerTag = ___ZerocopyTag; - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - (), - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(tag) }, - > for ___ZerocopyRawEnum<'a, N, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = ___ZerocopyTag; - #[inline(always)] - fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { - slf.as_ptr().cast() - } - } - #[repr(C)] - #[allow(non_snake_case)] - struct ___ZerocopyVariantStruct_StructLike< - 'a: 'static, - const N: usize, - X, - Y: Deref, - >( - core_reexport::mem::MaybeUninit<___ZerocopyInnerTag>, - u8, - X, - X::Target, - Y::Target, - [(X, Y); N], - core_reexport::marker::PhantomData>, - ) - where - X: Deref; #[allow(deprecated, non_local_definitions)] #[automatically_derived] - const _: () = { - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::TryFromBytes - for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + unsafe impl<'a: 'static, const N: usize, X, Y: Deref> ::zerocopy::TryFromBytes + for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + u8: ::zerocopy::TryFromBytes, + X: ::zerocopy::TryFromBytes, + X::Target: ::zerocopy::TryFromBytes, + Y::Target: ::zerocopy::TryFromBytes, + [(X, Y); N]: ::zerocopy::TryFromBytes, + bool: ::zerocopy::TryFromBytes, + Y: ::zerocopy::TryFromBytes, + PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + fn is_bit_valid<___ZerocopyAliasing>( + candidate: ::zerocopy::Maybe<'_, Self, ___ZerocopyAliasing>, + ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool where - X: Deref, - core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >: ::zerocopy::TryFromBytes, - u8: ::zerocopy::TryFromBytes, - X: ::zerocopy::TryFromBytes, - X::Target: ::zerocopy::TryFromBytes, - Y::Target: ::zerocopy::TryFromBytes, - [(X, Y); N]: ::zerocopy::TryFromBytes, - core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >: ::zerocopy::TryFromBytes, + ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, { - fn only_derive_is_allowed_to_implement_this_trait() {} - fn is_bit_valid<___ZerocopyAliasing>( - mut candidate: ::zerocopy::Maybe, - ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool - where - ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, - { - use ::zerocopy::util::macro_util::core_reexport; - use ::zerocopy::pointer::PtrInner; - true - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(0) }>(); - as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) - } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(1) }>(); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(2) }>(); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(3) }>(); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(4) }>(); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(5) }>(); - <[( - X, - Y, - ); N] as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(6) }>(); - , - > as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) - } + use ::zerocopy::util::macro_util::core_reexport; + #[repr(u8)] + #[allow(dead_code, non_camel_case_types)] + enum ___ZerocopyTag { + UnitLike, + StructLike, + TupleLike, } - } - #[allow(non_camel_case_types)] - const _: () = { - enum ẕ0 {} - enum ẕ1 {} - enum ẕ2 {} - enum ẕ3 {} - enum ẕ4 {} - enum ẕ5 {} - enum ẕ6 {} - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - ẕ0, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(0) }, - > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> - where - X: Deref, - { + unsafe impl ::zerocopy::Immutable for ___ZerocopyTag { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = core_reexport::mem::MaybeUninit<___ZerocopyInnerTag>; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).0 - ) - } - } } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] + type ___ZerocopyTagPrimitive = ::zerocopy::util::macro_util::SizeToTag< + { core_reexport::mem::size_of::<___ZerocopyTag>() }, + >; + #[allow(non_upper_case_globals)] + const ___ZEROCOPY_TAG_UnitLike: ___ZerocopyTagPrimitive = ___ZerocopyTag::UnitLike + as ___ZerocopyTagPrimitive; + #[allow(non_upper_case_globals)] + const ___ZEROCOPY_TAG_StructLike: ___ZerocopyTagPrimitive = ___ZerocopyTag::StructLike + as ___ZerocopyTagPrimitive; + #[allow(non_upper_case_globals)] + const ___ZEROCOPY_TAG_TupleLike: ___ZerocopyTagPrimitive = ___ZerocopyTag::TupleLike + as ___ZerocopyTagPrimitive; + type ___ZerocopyOuterTag = (); + type ___ZerocopyInnerTag = ___ZerocopyTag; unsafe impl< 'a: 'static, const N: usize, X, Y: Deref, > ::zerocopy::HasField< - ẕ1, + (), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> - where - X: Deref, - { + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, N, X, Y> { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = u8; + type Type = ___ZerocopyTag; #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).1 - ) - } + fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { + slf.as_ptr().cast() } } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< + #[repr(C)] + #[allow(non_snake_case)] + struct ___ZerocopyVariantStruct_StructLike< 'a: 'static, const N: usize, X, Y: Deref, - > ::zerocopy::HasField< - ẕ2, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, - > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + >( + core_reexport::mem::MaybeUninit<___ZerocopyInnerTag>, + u8, + X, + X::Target, + Y::Target, + [(X, Y); N], + core_reexport::marker::PhantomData>, + ) where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = X; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).2 - ) - } - } - } + X: Deref; #[allow(deprecated, non_local_definitions)] #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - ẕ3, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, - > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = X::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).3 - ) + const _: () = { + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::TryFromBytes + for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >: ::zerocopy::TryFromBytes, + u8: ::zerocopy::TryFromBytes, + X: ::zerocopy::TryFromBytes, + X::Target: ::zerocopy::TryFromBytes, + Y::Target: ::zerocopy::TryFromBytes, + [(X, Y); N]: ::zerocopy::TryFromBytes, + core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >: ::zerocopy::TryFromBytes, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + fn is_bit_valid<___ZerocopyAliasing>( + mut candidate: ::zerocopy::Maybe, + ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool + where + ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, + { + true + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(0) }>(); + as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(1) }>(); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(2) }>(); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(3) }>(); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(4) }>(); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(5) }>(); + <[( + X, + Y, + ); N] as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(6) }>(); + , + > as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) + } } } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - ẕ4, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(4) }, - > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = Y::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).4 - ) + #[allow(non_camel_case_types)] + const _: () = { + enum ẕ0 {} + enum ẕ1 {} + enum ẕ2 {} + enum ẕ3 {} + enum ẕ4 {} + enum ẕ5 {} + enum ẕ6 {} + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ0, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(0) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = core_reexport::mem::MaybeUninit<___ZerocopyInnerTag>; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).0 + ) + } + } } - } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ1, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(1) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = u8; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).1 + ) + } + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ2, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(2) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = X; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).2 + ) + } + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ3, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(3) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = X::Target; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).3 + ) + } + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ4, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(4) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = Y::Target; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).4 + ) + } + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ5, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(5) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = [(X, Y); N]; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).5 + ) + } + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ6, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(6) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).6 + ) + } + } + } + }; + }; + #[repr(C)] + #[allow(non_snake_case)] + struct ___ZerocopyVariantStruct_TupleLike< 'a: 'static, const N: usize, X, Y: Deref, - > ::zerocopy::HasField< - ẕ5, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(5) }, - > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + >( + core_reexport::mem::MaybeUninit<___ZerocopyInnerTag>, + bool, + Y, + PhantomData<&'a [(X, Y); N]>, + core_reexport::marker::PhantomData>, + ) where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = [(X, Y); N]; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).5 - ) - } - } - } + X: Deref; #[allow(deprecated, non_local_definitions)] #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - ẕ6, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(6) }, - > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).6 - ) + const _: () = { + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::TryFromBytes + for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >: ::zerocopy::TryFromBytes, + bool: ::zerocopy::TryFromBytes, + Y: ::zerocopy::TryFromBytes, + PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, + core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >: ::zerocopy::TryFromBytes, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + fn is_bit_valid<___ZerocopyAliasing>( + mut candidate: ::zerocopy::Maybe, + ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool + where + ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, + { + true + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(0) }>(); + as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(1) }>(); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(2) }>(); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(3) }>(); + as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) + } + && { + let field_candidate = candidate + .reborrow() + .project::<_, { ::zerocopy::ident_id!(4) }>(); + , + > as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) + } } } - } - }; - }; - #[repr(C)] - #[allow(non_snake_case)] - struct ___ZerocopyVariantStruct_TupleLike< - 'a: 'static, - const N: usize, - X, - Y: Deref, - >( - core_reexport::mem::MaybeUninit<___ZerocopyInnerTag>, - bool, - Y, - PhantomData<&'a [(X, Y); N]>, - core_reexport::marker::PhantomData>, - ) - where - X: Deref; - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - const _: () = { - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::TryFromBytes - for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> - where - X: Deref, - core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >: ::zerocopy::TryFromBytes, - bool: ::zerocopy::TryFromBytes, - Y: ::zerocopy::TryFromBytes, - PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, - core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >: ::zerocopy::TryFromBytes, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - fn is_bit_valid<___ZerocopyAliasing>( - mut candidate: ::zerocopy::Maybe, - ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool - where - ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, - { - use ::zerocopy::util::macro_util::core_reexport; - use ::zerocopy::pointer::PtrInner; - true - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(0) }>(); - as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) + #[allow(non_camel_case_types)] + const _: () = { + enum ẕ0 {} + enum ẕ1 {} + enum ẕ2 {} + enum ẕ3 {} + enum ẕ4 {} + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ0, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(0) }, + > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = core_reexport::mem::MaybeUninit<___ZerocopyInnerTag>; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).0 + ) + } + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ1, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(1) }, + > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = bool; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).1 + ) + } + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ2, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(2) }, + > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = Y; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).2 + ) + } + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ3, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(3) }, + > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = PhantomData<&'a [(X, Y); N]>; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).3 + ) + } + } } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(1) }>(); - ::is_bit_valid( - field_candidate, - ) + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ4, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(4) }, + > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).4 + ) + } + } } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(2) }>(); - ::is_bit_valid( - field_candidate, - ) + }; + }; + #[repr(C)] + #[allow(non_snake_case)] + union ___ZerocopyVariants<'a: 'static, const N: usize, X, Y: Deref> { + __field_StructLike: core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >, + __field_TupleLike: core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >, + __nonempty: (), + } + #[allow(non_camel_case_types)] + const _: () = { + enum ẕ__field_StructLike {} + enum ẕ__field_TupleLike {} + enum ẕ__nonempty {} + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + const _: () = { + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ__field_StructLike, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__field_StructLike + ) + } + } } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(3) }>(); - as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::pointer::cast::Cast< + ___ZerocopyVariants<'a, N, X, Y>, + core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >, + > + for ::zerocopy::pointer::cast::Projection< + ẕ__field_StructLike, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > {} + }; + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + const _: () = { + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ__field_TupleLike, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__field_TupleLike + ) + } + } } - && { - let field_candidate = candidate - .reborrow() - .project::<_, { ::zerocopy::ident_id!(4) }>(); - , - > as ::zerocopy::TryFromBytes>::is_bit_valid(field_candidate) + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::pointer::cast::Cast< + ___ZerocopyVariants<'a, N, X, Y>, + core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >, + > + for ::zerocopy::pointer::cast::Projection< + ẕ__field_TupleLike, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > {} + }; + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + const _: () = { + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕ__nonempty, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = (); + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__nonempty + ) + } + } } + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::pointer::cast::Cast<___ZerocopyVariants<'a, N, X, Y>, ()> + for ::zerocopy::pointer::cast::Projection< + ẕ__nonempty, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > {} + }; + }; + #[repr(C)] + struct ___ZerocopyRawEnum<'a: 'static, const N: usize, X, Y: Deref> { + tag: ___ZerocopyOuterTag, + variants: ___ZerocopyVariants<'a, N, X, Y>, } - } - #[allow(non_camel_case_types)] - const _: () = { - enum ẕ0 {} - enum ẕ1 {} - enum ẕ2 {} - enum ẕ3 {} - enum ẕ4 {} - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] unsafe impl< 'a: 'static, const N: usize, X, Y: Deref, - > ::zerocopy::HasField< - ẕ0, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(0) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > ::zerocopy::pointer::InvariantsEq<___ZerocopyRawEnum<'a, N, X, Y>> + for ComplexWithGenerics<'a, N, X, Y> where X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = core_reexport::mem::MaybeUninit<___ZerocopyInnerTag>; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).0 - ) + {} + #[allow(non_camel_case_types)] + const _: () = { + enum ẕtag {} + enum ẕvariants {} + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕtag, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = ___ZerocopyOuterTag; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).tag + ) + } + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + ẕvariants, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = ___ZerocopyVariants<'a, N, X, Y>; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut Self::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).variants + ) + } } } - } + }; #[allow(deprecated, non_local_definitions)] #[automatically_derived] unsafe impl< @@ -1156,25 +1494,52 @@ fn test_try_from_bytes_enum() { X, Y: Deref, > ::zerocopy::HasField< - ẕ1, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + (), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(a) }, + > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = bool; + type Type = u8; #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).1 - ) - } + fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(1) }, + >, + >() + .as_ptr() } } #[allow(deprecated, non_local_definitions)] @@ -1185,25 +1550,52 @@ fn test_try_from_bytes_enum() { X, Y: Deref, > ::zerocopy::HasField< - ẕ2, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + (), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(b) }, + > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = Y; + type Type = X; #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).2 - ) - } + fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(2) }, + >, + >() + .as_ptr() } } #[allow(deprecated, non_local_definitions)] @@ -1214,25 +1606,52 @@ fn test_try_from_bytes_enum() { X, Y: Deref, > ::zerocopy::HasField< - ẕ3, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + (), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(c) }, + > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = PhantomData<&'a [(X, Y); N]>; + type Type = X::Target; #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).3 - ) - } + fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(3) }, + >, + >() + .as_ptr() } } #[allow(deprecated, non_local_definitions)] @@ -1243,146 +1662,54 @@ fn test_try_from_bytes_enum() { X, Y: Deref, > ::zerocopy::HasField< - ẕ4, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(4) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + (), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(d) }, + > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).4 - ) - } - } - } - }; - }; - #[repr(C)] - #[allow(non_snake_case)] - union ___ZerocopyVariants<'a: 'static, const N: usize, X, Y: Deref> { - __field_StructLike: core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >, - __field_TupleLike: core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >, - __nonempty: (), - } - #[allow(non_camel_case_types)] - const _: () = { - enum ẕ__field_StructLike {} - enum ẕ__field_TupleLike {} - enum ẕ__nonempty {} - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - const _: () = { - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - ẕ__field_StructLike, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - > for ___ZerocopyVariants<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__field_StructLike - ) - } - } - } - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::pointer::cast::Cast< - ___ZerocopyVariants<'a, N, X, Y>, - core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >, - > - for ::zerocopy::pointer::cast::Projection< - ẕ__field_StructLike, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - > {} - }; - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - const _: () = { - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - ẕ__field_TupleLike, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - > for ___ZerocopyVariants<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >; + type Type = Y::Target; #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__field_TupleLike - ) - } + fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(4) }, + >, + >() + .as_ptr() } } - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::pointer::cast::Cast< - ___ZerocopyVariants<'a, N, X, Y>, - core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >, - > - for ::zerocopy::pointer::cast::Projection< - ẕ__field_TupleLike, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - > {} - }; - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - const _: () = { #[allow(deprecated, non_local_definitions)] #[automatically_derived] unsafe impl< @@ -1391,638 +1718,303 @@ fn test_try_from_bytes_enum() { X, Y: Deref, > ::zerocopy::HasField< - ẕ__nonempty, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__nonempty) }, - > for ___ZerocopyVariants<'a, { N }, X, Y> { + (), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(e) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = (); + type Type = [(X, Y); N]; #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__nonempty - ) - } + fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(5) }, + >, + >() + .as_ptr() } } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] unsafe impl< 'a: 'static, const N: usize, - X, - Y: Deref, - > ::zerocopy::pointer::cast::Cast<___ZerocopyVariants<'a, N, X, Y>, ()> - for ::zerocopy::pointer::cast::Projection< - ẕ__nonempty, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__nonempty) }, - > {} - }; - }; - #[repr(C)] - struct ___ZerocopyRawEnum<'a: 'static, const N: usize, X, Y: Deref> { - tag: ___ZerocopyOuterTag, - variants: ___ZerocopyVariants<'a, N, X, Y>, - } - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::pointer::InvariantsEq<___ZerocopyRawEnum<'a, N, X, Y>> - for ComplexWithGenerics<'a, N, X, Y> - where - X: Deref, - {} - #[allow(non_camel_case_types)] - const _: () = { - enum ẕtag {} - enum ẕvariants {} - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - ẕtag, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(tag) }, - > for ___ZerocopyRawEnum<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = ___ZerocopyOuterTag; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).tag - ) - } - } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - ẕvariants, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - > for ___ZerocopyRawEnum<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = ___ZerocopyVariants<'a, N, X, Y>; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut Self::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).variants - ) - } - } - } - }; - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, - > for ComplexWithGenerics<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = u8; - #[inline(always)] - fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - >, - >() - .as_ptr() - } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, - > for ComplexWithGenerics<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = X; - #[inline(always)] - fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, - >, - >() - .as_ptr() - } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(c) }, - > for ComplexWithGenerics<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = X::Target; - #[inline(always)] - fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, - >, - >() - .as_ptr() - } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(d) }, - > for ComplexWithGenerics<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = Y::Target; - #[inline(always)] - fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(4) }, - >, - >() - .as_ptr() - } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(e) }, - > for ComplexWithGenerics<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = [(X, Y); N]; - #[inline(always)] - fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(5) }, - >, - >() - .as_ptr() - } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - (), - { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(0) }, - > for ComplexWithGenerics<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = bool; - #[inline(always)] - fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - >, - >() - .as_ptr() - } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - (), - { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, - > for ComplexWithGenerics<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = Y; - #[inline(always)] - fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, - >, - >() - .as_ptr() - } - } - #[allow(deprecated, non_local_definitions)] - #[automatically_derived] - unsafe impl< - 'a: 'static, - const N: usize, - X, - Y: Deref, - > ::zerocopy::HasField< - (), - { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(2) }, - > for ComplexWithGenerics<'a, { N }, X, Y> - where - X: Deref, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = PhantomData<&'a [(X, Y); N]>; - #[inline(always)] - fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, - >, - >() - .as_ptr() - } - } - let mut raw_enum = candidate - .cast::< - ___ZerocopyRawEnum<'a, N, X, Y>, - ::zerocopy::pointer::cast::CastSized, - ::zerocopy::pointer::BecauseInvariantsEq, - >(); - let tag = { - let tag_ptr = raw_enum - .reborrow() - .project::<(), { ::zerocopy::ident_id!(tag) }>() - .cast::< - ___ZerocopyTagPrimitive, - ::zerocopy::pointer::cast::CastSized, - _, - >(); - tag_ptr - .recall_validity::<_, (_, (_, _))>() - .read_unaligned::<::zerocopy::BecauseImmutable>() - }; - let variants = raw_enum.project::<_, { ::zerocopy::ident_id!(variants) }>(); - #[allow(non_upper_case_globals)] - match tag { - ___ZEROCOPY_TAG_UnitLike => true, - ___ZEROCOPY_TAG_StructLike => { - let variant_md = unsafe { - variants - .cast_unchecked::< - core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >, - ::zerocopy::pointer::cast::Projection< + X, + Y: Deref, + > ::zerocopy::HasField< + (), + { ::zerocopy::ident_id!(TupleLike) }, + { ::zerocopy::ident_id!(0) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = bool; + #[inline(always)] + fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - >, - >() - }; - let variant = variant_md - .cast::< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - ::zerocopy::pointer::cast::CastSized, - ::zerocopy::pointer::BecauseInvariantsEq, - >(); - <___ZerocopyVariantStruct_StructLike< - 'a, - N, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(1) }, + >, + >() + .as_ptr() + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, X, - Y, - > as ::zerocopy::TryFromBytes>::is_bit_valid(variant) - } - ___ZEROCOPY_TAG_TupleLike => { - let variant_md = unsafe { - variants - .cast_unchecked::< - core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >, - ::zerocopy::pointer::cast::Projection< + Y: Deref, + > ::zerocopy::HasField< + (), + { ::zerocopy::ident_id!(TupleLike) }, + { ::zerocopy::ident_id!(1) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = Y; + #[inline(always)] + fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< _, - { ::zerocopy::UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - }; - let variant = variant_md + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(2) }, + >, + >() + .as_ptr() + } + } + #[allow(deprecated, non_local_definitions)] + #[automatically_derived] + unsafe impl< + 'a: 'static, + const N: usize, + X, + Y: Deref, + > ::zerocopy::HasField< + (), + { ::zerocopy::ident_id!(TupleLike) }, + { ::zerocopy::ident_id!(2) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = PhantomData<&'a [(X, Y); N]>; + #[inline(always)] + fn project(slf: ::zerocopy::pointer::PtrInner<'_, Self>) -> *mut Self::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(3) }, + >, + >() + .as_ptr() + } + } + let mut raw_enum = candidate .cast::< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + ___ZerocopyRawEnum<'a, N, X, Y>, ::zerocopy::pointer::cast::CastSized, ::zerocopy::pointer::BecauseInvariantsEq, >(); - <___ZerocopyVariantStruct_TupleLike< - 'a, - N, - X, - Y, - > as ::zerocopy::TryFromBytes>::is_bit_valid(variant) + let tag = { + let tag_ptr = raw_enum + .reborrow() + .project::<(), { ::zerocopy::ident_id!(tag) }>() + .cast::< + ___ZerocopyTagPrimitive, + ::zerocopy::pointer::cast::CastSized, + _, + >(); + tag_ptr + .recall_validity::<_, (_, (_, _))>() + .read_unaligned::<::zerocopy::BecauseImmutable>() + }; + let variants = raw_enum.project::<_, { ::zerocopy::ident_id!(variants) }>(); + #[allow(non_upper_case_globals)] + match tag { + ___ZEROCOPY_TAG_UnitLike => true, + ___ZEROCOPY_TAG_StructLike => { + let variant_md = unsafe { + variants + .cast_unchecked::< + core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >, + ::zerocopy::pointer::cast::Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + }; + let variant = variant_md + .cast::< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + ::zerocopy::pointer::cast::CastSized, + ::zerocopy::pointer::BecauseInvariantsEq, + >(); + <___ZerocopyVariantStruct_StructLike< + 'a, + N, + X, + Y, + > as ::zerocopy::TryFromBytes>::is_bit_valid(variant) + } + ___ZEROCOPY_TAG_TupleLike => { + let variant_md = unsafe { + variants + .cast_unchecked::< + core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >, + ::zerocopy::pointer::cast::Projection< + _, + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + >, + >() + }; + let variant = variant_md + .cast::< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + ::zerocopy::pointer::cast::CastSized, + ::zerocopy::pointer::BecauseInvariantsEq, + >(); + <___ZerocopyVariantStruct_TupleLike< + 'a, + N, + X, + Y, + > as ::zerocopy::TryFromBytes>::is_bit_valid(variant) + } + _ => false, + } } - _ => false, } - } - } } no_build } @@ -2153,8 +2145,6 @@ fn test_try_from_bytes_enum() { where ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, { - use ::zerocopy::util::macro_util::core_reexport; - use ::zerocopy::pointer::PtrInner; true && { let field_candidate = candidate @@ -2480,8 +2470,6 @@ fn test_try_from_bytes_enum() { where ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, { - use ::zerocopy::util::macro_util::core_reexport; - use ::zerocopy::pointer::PtrInner; true && { let field_candidate = candidate @@ -3436,7 +3424,6 @@ fn test_try_from_bytes_enum() { } } } - } no_build } @@ -3567,8 +3554,6 @@ fn test_try_from_bytes_enum() { where ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, { - use ::zerocopy::util::macro_util::core_reexport; - use ::zerocopy::pointer::PtrInner; true && { let field_candidate = candidate @@ -3894,8 +3879,6 @@ fn test_try_from_bytes_enum() { where ___ZerocopyAliasing: ::zerocopy::pointer::invariant::Reference, { - use ::zerocopy::util::macro_util::core_reexport; - use ::zerocopy::pointer::PtrInner; true && { let field_candidate = candidate @@ -4850,7 +4833,6 @@ fn test_try_from_bytes_enum() { } } } - } no_build } } diff --git a/zerocopy-derive/tests/ui-nightly/derive_transparent.stderr b/zerocopy-derive/tests/ui-nightly/derive_transparent.stderr index e43ea10095..6987e75ac6 100644 --- a/zerocopy-derive/tests/ui-nightly/derive_transparent.stderr +++ b/zerocopy-derive/tests/ui-nightly/derive_transparent.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `TransparentStruct` to implement `zerocopy::TryFromBytes` --> tests/ui-nightly/derive_transparent.rs:24:21 @@ -51,13 +51,13 @@ help: the trait `FromZeros` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `TransparentStruct` to implement `FromZeros` --> tests/ui-nightly/derive_transparent.rs:24:21 @@ -90,13 +90,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `TransparentStruct` to implement `zerocopy::FromBytes` --> tests/ui-nightly/derive_transparent.rs:24:21 diff --git a/zerocopy-derive/tests/ui-nightly/enum.stderr b/zerocopy-derive/tests/ui-nightly/enum.stderr index fc42e31bb1..b0894b5226 100644 --- a/zerocopy-derive/tests/ui-nightly/enum.stderr +++ b/zerocopy-derive/tests/ui-nightly/enum.stderr @@ -313,11 +313,11 @@ error[E0277]: the trait bound `UnsafeCell<()>: Immutable` is not satisfied &T &mut T () - *const T - *mut T - ::is_bit_valid::___ZerocopyTag - ::{constant#0}::___ZerocopyTag - ::{constant#0}::___ZerocopyTag + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = help: see issue #48214 = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -337,11 +337,11 @@ error[E0277]: the trait bound `UnsafeCell: Immutable` is not satisfied &T &mut T () - *const T - *mut T - ::is_bit_valid::___ZerocopyTag - ::{constant#0}::___ZerocopyTag - ::{constant#0}::___ZerocopyTag + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = help: see issue #48214 = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -364,13 +364,13 @@ help: the trait `TryFromBytes` is not implemented for `NotTryFromBytes` = note: Consider adding `#[derive(TryFromBytes)]` to `NotTryFromBytes` = help: the following other types implement trait `TryFromBytes`: () - *const T - *mut T - ::is_bit_valid::___ZerocopyVariantStruct_A - ::is_bit_valid::___ZerocopyVariantStruct_A - AtomicBool - AtomicI16 - AtomicI32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -393,13 +393,13 @@ help: the trait `TryFromBytes` is not implemented for `NotFromZeros` = note: Consider adding `#[derive(TryFromBytes)]` to `NotFromZeros` = help: the following other types implement trait `TryFromBytes`: () - *const T - *mut T - ::is_bit_valid::___ZerocopyVariantStruct_A - ::is_bit_valid::___ZerocopyVariantStruct_A - AtomicBool - AtomicI16 - AtomicI32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -422,13 +422,13 @@ help: the trait `FromZeros` is not implemented for `NotFromZeros` = note: Consider adding `#[derive(FromZeros)]` to `NotFromZeros` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -446,13 +446,13 @@ error[E0277]: the trait bound `bool: FromBytes` is not satisfied = note: Consider adding `#[derive(FromBytes)]` to `bool` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) 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) @@ -549,13 +549,13 @@ error[E0277]: the trait bound `bool: FromBytes` is not satisfied = note: Consider adding `#[derive(FromBytes)]` to `bool` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `FooU8` to implement `FromBytes` --> tests/ui-nightly/enum.rs:191:10 diff --git a/zerocopy-derive/tests/ui-nightly/late_compile_pass.stderr b/zerocopy-derive/tests/ui-nightly/late_compile_pass.stderr index b767c825c2..f06f374f7b 100644 --- a/zerocopy-derive/tests/ui-nightly/late_compile_pass.stderr +++ b/zerocopy-derive/tests/ui-nightly/late_compile_pass.stderr @@ -20,13 +20,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -49,13 +49,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -78,13 +78,13 @@ help: the trait `FromZeros` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -107,13 +107,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) 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) @@ -136,13 +136,13 @@ help: the trait `FromZeros` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) 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) @@ -165,13 +165,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) 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) @@ -310,13 +310,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `FromBytes1` to implement `zerocopy::FromBytes` --> tests/ui-nightly/late_compile_pass.rs:47:10 diff --git a/zerocopy-derive/tests/ui-nightly/struct.stderr b/zerocopy-derive/tests/ui-nightly/struct.stderr index 16dc911693..f91648fca8 100644 --- a/zerocopy-derive/tests/ui-nightly/struct.stderr +++ b/zerocopy-derive/tests/ui-nightly/struct.stderr @@ -196,11 +196,11 @@ error[E0277]: the trait bound `UnsafeCell<()>: zerocopy::Immutable` is not satis &T &mut T () - *const T - *mut T - AU16 - F32 - F64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = help: see issue #48214 = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -220,11 +220,11 @@ error[E0277]: the trait bound `UnsafeCell: zerocopy::Immutable` is not satis &T &mut T () - *const T - *mut T - AU16 - F32 - F64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = note: required for `[UnsafeCell; 0]` to implement `zerocopy::Immutable` = help: see issue #48214 diff --git a/zerocopy-derive/tests/ui-nightly/union.stderr b/zerocopy-derive/tests/ui-nightly/union.stderr index 61dde476c4..8073858e9e 100644 --- a/zerocopy-derive/tests/ui-nightly/union.stderr +++ b/zerocopy-derive/tests/ui-nightly/union.stderr @@ -87,11 +87,11 @@ error[E0277]: the trait bound `UnsafeCell<()>: zerocopy::Immutable` is not satis &T &mut T () - *const T - *mut T - AU16 - F32 - F64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = note: required for `ManuallyDrop>` to implement `zerocopy::Immutable` = help: see issue #48214 diff --git a/zerocopy-derive/tests/ui-stable/derive_transparent.stderr b/zerocopy-derive/tests/ui-stable/derive_transparent.stderr index c82b354aeb..c9200d5cd0 100644 --- a/zerocopy-derive/tests/ui-stable/derive_transparent.stderr +++ b/zerocopy-derive/tests/ui-stable/derive_transparent.stderr @@ -12,13 +12,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `TransparentStruct` to implement `zerocopy::TryFromBytes` --> tests/ui-stable/derive_transparent.rs:24:21 @@ -46,13 +46,13 @@ help: the trait `FromZeros` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `TransparentStruct` to implement `FromZeros` --> tests/ui-stable/derive_transparent.rs:24:21 @@ -80,13 +80,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `TransparentStruct` to implement `zerocopy::FromBytes` --> tests/ui-stable/derive_transparent.rs:24:21 diff --git a/zerocopy-derive/tests/ui-stable/enum.stderr b/zerocopy-derive/tests/ui-stable/enum.stderr index 306ef2d937..f92169e2d3 100644 --- a/zerocopy-derive/tests/ui-stable/enum.stderr +++ b/zerocopy-derive/tests/ui-stable/enum.stderr @@ -299,11 +299,11 @@ error[E0277]: the trait bound `UnsafeCell<()>: Immutable` is not satisfied &T &mut T () - *const T - *mut T - ::is_bit_valid::___ZerocopyTag - ::{constant#0}::___ZerocopyTag - ::{constant#0}::___ZerocopyTag + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = help: see issue #48214 = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -319,11 +319,11 @@ error[E0277]: the trait bound `UnsafeCell: Immutable` is not satisfied &T &mut T () - *const T - *mut T - ::is_bit_valid::___ZerocopyTag - ::{constant#0}::___ZerocopyTag - ::{constant#0}::___ZerocopyTag + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = help: see issue #48214 = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -342,13 +342,13 @@ help: the trait `TryFromBytes` is not implemented for `NotTryFromBytes` = note: Consider adding `#[derive(TryFromBytes)]` to `NotTryFromBytes` = help: the following other types implement trait `TryFromBytes`: () - *const T - *mut T - ::is_bit_valid::___ZerocopyVariantStruct_A - ::is_bit_valid::___ZerocopyVariantStruct_A - AtomicBool - AtomicI16 - AtomicI32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -367,13 +367,13 @@ help: the trait `TryFromBytes` is not implemented for `NotFromZeros` = note: Consider adding `#[derive(TryFromBytes)]` to `NotFromZeros` = help: the following other types implement trait `TryFromBytes`: () - *const T - *mut T - ::is_bit_valid::___ZerocopyVariantStruct_A - ::is_bit_valid::___ZerocopyVariantStruct_A - AtomicBool - AtomicI16 - AtomicI32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -392,13 +392,13 @@ help: the trait `FromZeros` is not implemented for `NotFromZeros` = note: Consider adding `#[derive(FromZeros)]` to `NotFromZeros` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -412,13 +412,13 @@ error[E0277]: the trait bound `bool: FromBytes` is not satisfied = note: Consider adding `#[derive(FromBytes)]` to `bool` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) 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) @@ -487,13 +487,13 @@ error[E0277]: the trait bound `bool: FromBytes` is not satisfied = note: Consider adding `#[derive(FromBytes)]` to `bool` = help: the following other types implement trait `FromBytes`: () - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 - AtomicU32 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `FooU8` to implement `FromBytes` --> tests/ui-stable/enum.rs:191:10 diff --git a/zerocopy-derive/tests/ui-stable/late_compile_pass.stderr b/zerocopy-derive/tests/ui-stable/late_compile_pass.stderr index 21076e419f..4bd2390ac5 100644 --- a/zerocopy-derive/tests/ui-stable/late_compile_pass.stderr +++ b/zerocopy-derive/tests/ui-stable/late_compile_pass.stderr @@ -20,13 +20,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -45,13 +45,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -70,13 +70,13 @@ help: the trait `FromZeros` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others = help: see issue #48214 = note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -95,13 +95,13 @@ help: the trait `zerocopy::TryFromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::TryFromBytes`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) 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) @@ -120,13 +120,13 @@ help: the trait `FromZeros` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy` = help: the following other types implement trait `FromZeros`: () - *const T - *mut T - AU16 - AtomicBool - AtomicI16 - AtomicI32 - AtomicI64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) 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) @@ -145,13 +145,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) 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) @@ -270,13 +270,13 @@ help: the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` = note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy` = help: the following other types implement trait `zerocopy::FromBytes`: () - AU16 - AtomicI16 - AtomicI32 - AtomicI64 - AtomicI8 - AtomicIsize - AtomicU16 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) + (A, B, C, D, E, F, G) + (A, B, C, D, E, F, G, H) and $N others note: required for `FromBytes1` to implement `zerocopy::FromBytes` --> tests/ui-stable/late_compile_pass.rs:47:10 diff --git a/zerocopy-derive/tests/ui-stable/struct.stderr b/zerocopy-derive/tests/ui-stable/struct.stderr index e2354dd4c3..10d76762ce 100644 --- a/zerocopy-derive/tests/ui-stable/struct.stderr +++ b/zerocopy-derive/tests/ui-stable/struct.stderr @@ -177,11 +177,11 @@ error[E0277]: the trait bound `UnsafeCell<()>: zerocopy::Immutable` is not satis &T &mut T () - *const T - *mut T - AU16 - F32 - F64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = help: see issue #48214 = note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -197,11 +197,11 @@ error[E0277]: the trait bound `UnsafeCell: zerocopy::Immutable` is not satis &T &mut T () - *const T - *mut T - AU16 - F32 - F64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = note: required for `[UnsafeCell; 0]` to implement `zerocopy::Immutable` = help: see issue #48214 diff --git a/zerocopy-derive/tests/ui-stable/union.stderr b/zerocopy-derive/tests/ui-stable/union.stderr index c17306eadc..bff92a1746 100644 --- a/zerocopy-derive/tests/ui-stable/union.stderr +++ b/zerocopy-derive/tests/ui-stable/union.stderr @@ -87,11 +87,11 @@ error[E0277]: the trait bound `UnsafeCell<()>: zerocopy::Immutable` is not satis &T &mut T () - *const T - *mut T - AU16 - F32 - F64 + (A, B) + (A, B, C) + (A, B, C, D) + (A, B, C, D, E) + (A, B, C, D, E, F) and $N others = note: required for `ManuallyDrop>` to implement `zerocopy::Immutable` = help: see issue #48214