diff --git a/zerocopy/src/lib.rs b/zerocopy/src/lib.rs index 30695eee8c..237f2d86ce 100644 --- a/zerocopy/src/lib.rs +++ b/zerocopy/src/lib.rs @@ -1184,6 +1184,14 @@ pub const REPR_C_UNION_VARIANT_ID: i128 = -3; #[doc(hidden)] #[derive(Copy, Clone, Debug)] pub enum TryFromBytesDerive {} +#[doc(hidden)] +#[derive(Copy, Clone, Debug)] +pub enum ProjectDerive {} + +#[cfg(any(feature = "derive", test))] +#[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] +#[doc(hidden)] +pub use zerocopy_derive::Project; /// # Safety /// @@ -1212,9 +1220,9 @@ pub unsafe trait HasTag { /// Projects a given field from `Self`. /// -/// All implementations of `HasField` for a particular field `f` in `Self` -/// should use the same `Field` type; this ensures that `Field` is inferable -/// given an explicit `VARIANT_ID` and `FIELD_ID`. +/// All implementations of `HasField` for a particular `Client` and field `f` +/// in `Self` should use the same `Field` type; this ensures that `Field` is +/// inferable given an explicit `Client`, `VARIANT_ID`, and `FIELD_ID`. /// /// The `Client` parameter exists solely to disambiguate between implementations /// of `HasField` that would otherwise conflict. @@ -1224,12 +1232,14 @@ pub unsafe trait HasTag { /// A field `f` is `HasField` for `Self` if and only if: /// /// - If `Self` has the layout of a struct or union type, then `VARIANT_ID` is -/// `STRUCT_VARIANT_ID` or `UNION_VARIANT_ID` respectively; otherwise, if -/// `Self` has the layout of an enum type, `VARIANT_ID` is the numerical index -/// of the enum variant in which `f` appears. Note that `Self` does not need -/// to actually *be* such a type – it just needs to have the same layout as -/// such a type. For example, a `#[repr(transparent)]` wrapper around an enum -/// has the same layout as that enum. +/// `STRUCT_VARIANT_ID` or `UNION_VARIANT_ID` respectively. For internal +/// projections of `repr(C)` unions, `VARIANT_ID` may instead be +/// `REPR_C_UNION_VARIANT_ID`. Otherwise, if `Self` has the layout of an enum +/// type and `f` appears in a variant named `v`, `VARIANT_ID` is +/// `zerocopy::ident_id!(v)`. Note that `Self` does not need to actually *be* +/// such a type – it just needs to have the same layout as such a type. For +/// example, a `#[repr(transparent)]` wrapper around an enum has the same +/// layout as that enum. /// - If `f` has name `n`, `FIELD_ID` is `zerocopy::ident_id!(n)`; otherwise, /// if `f` is at index `i`, `FIELD_ID` is `zerocopy::ident_id!(i)`. /// - `Field` is a type with the same visibility as `f`. @@ -1274,7 +1284,8 @@ pub unsafe trait HasField true, + crate::STRUCT_VARIANT_ID + | crate::UNION_VARIANT_ID + | crate::REPR_C_UNION_VARIANT_ID => true, _enum_variant => { use crate::invariant::{Validity, ValidityKind}; match I::Validity::KIND { diff --git a/zerocopy/src/wrappers.rs b/zerocopy/src/wrappers.rs index 43f1e73485..7938902131 100644 --- a/zerocopy/src/wrappers.rs +++ b/zerocopy/src/wrappers.rs @@ -777,13 +777,13 @@ unsafe impl + ?Sized, Client> HasTag for ReadOnly { // SAFETY: `ReadOnly` is a `#[repr(transparent)]` wrapper around `T`, and so // has the same fields at the same offsets. Thus, it satisfies the safety -// invariants of `HasField` for field `f` exactly -// when `T` does, as guaranteed by the `T: HasField` bound: -// - If `VARIANT_ID` is `STRUCT_VARIANT_ID` or `UNION_VARIANT_ID`, then `T` has -// the layout of a struct or union type. Since `ReadOnly` is a transparent -// wrapper around `T`, it does too. Otherwise, if `VARIANT_ID` is an enum -// variant index, then `T` has the layout of an enum type, and `ReadOnly` -// does too. +// invariants of `HasField` for field `f` +// exactly when `T` does, as guaranteed by the `T: HasField` bound: +// - If `VARIANT_ID` is `STRUCT_VARIANT_ID`, `UNION_VARIANT_ID`, or +// `REPR_C_UNION_VARIANT_ID`, then `T` has the layout of the corresponding +// struct or union type. Since `ReadOnly` is a transparent wrapper around +// `T`, it does too. Otherwise, `VARIANT_ID` is the identifier ID of an enum +// variant; `T` has the layout of an enum type, and `ReadOnly` does too. // - By `T: HasField<_, _, _, FIELD_ID>`: // - `T` has a field `f` with name `n` such that // `FIELD_ID = zerocopy::ident_id!(n)` or at index `i` such that diff --git a/zerocopy/zerocopy-derive/src/derive/mod.rs b/zerocopy/zerocopy-derive/src/derive/mod.rs index 28b56b16a6..174434561e 100644 --- a/zerocopy/zerocopy-derive/src/derive/mod.rs +++ b/zerocopy/zerocopy-derive/src/derive/mod.rs @@ -3,6 +3,7 @@ pub mod from_bytes; pub mod into_bytes; pub mod known_layout; +pub mod project; pub mod try_from_bytes; pub mod unaligned; diff --git a/zerocopy/zerocopy-derive/src/derive/project.rs b/zerocopy/zerocopy-derive/src/derive/project.rs new file mode 100644 index 0000000000..a78915a1a4 --- /dev/null +++ b/zerocopy/zerocopy-derive/src/derive/project.rs @@ -0,0 +1,579 @@ +// SPDX-License-Identifier: BSD-2-Clause OR Apache-2.0 OR MIT +// + +use proc_macro2::TokenStream; +use quote::quote; +use syn::{ + parse_quote, spanned::Spanned as _, Data, DataEnum, DeriveInput, Error, Expr, Fields, Ident, + Index, Type, +}; + +use crate::{ + repr::{EnumRepr, StructUnionRepr}, + util::{ + const_block, generate_tag_enum, Client, Ctx, DataExt, FieldBounds, ImplBlockBuilder, Trait, + }, +}; + +pub(crate) fn tag_ident(variant: &Ident) -> Ident { + ident!(("___ZEROCOPY_TAG_{}", variant), variant.span()) +} + +pub(crate) fn variant_struct_ident(variant: &Ident) -> Ident { + ident!(("___ZerocopyVariantStruct_{}", variant), variant.span()) +} + +pub(crate) fn variants_union_field_ident(variant: &Ident) -> Ident { + ident!(("__field_{}", variant), variant.span()) +} + +/// Generates a constant for the tag associated with each variant of the enum. +/// When we match on the enum's tag, each arm matches one of these constants. We +/// have to use constants here because: +/// +/// - The type that we're matching on is not the type of the tag, it's an +/// integer of the same size as the tag type and with the same bit patterns. +/// - We can't read the enum tag as an enum because the bytes may not represent +/// a valid variant. +/// - Patterns do not currently support const expressions, so we have to assign +/// these constants to names rather than use them inline in the `match` +/// statement. +pub(crate) fn generate_tag_consts(data: &DataEnum) -> TokenStream { + let tags = data.variants.iter().map(|variant| { + let variant_ident = &variant.ident; + let tag = tag_ident(variant_ident); + + quote! { + // This casts the enum variant to its discriminant, and then + // converts the discriminant to the target integral type via a + // numeric cast [1]. + // + // Because these are the same size, this is defined to be a no-op + // and therefore is a lossless conversion [2]. + // + // [1] Per https://doc.rust-lang.org/1.81.0/reference/expressions/operator-expr.html#enum-cast: + // + // Casts an enum to its discriminant. + // + // [2] Per https://doc.rust-lang.org/1.81.0/reference/expressions/operator-expr.html#numeric-cast: + // + // Casting between two integers of the same size (e.g. i32 -> u32) + // is a no-op. + const #tag: ___ZerocopyTagPrimitive = + ___ZerocopyTag::#variant_ident as ___ZerocopyTagPrimitive; + } + }); + + quote! { + #(#tags)* + } +} + +fn field_alignment(ctx: &Ctx) -> TokenStream { + let zerocopy_crate = &ctx.zerocopy_crate; + let fields_preserve_alignment = StructUnionRepr::from_attrs(&ctx.ast.attrs) + .map(|repr| repr.get_packed().is_none()) + .unwrap(); + if fields_preserve_alignment { + quote! { ___ZcAlignment } + } else { + quote! { #zerocopy_crate::invariant::Unaligned } + } +} + +#[derive(Clone)] +struct FieldProjection { + variant_id: Box, + field: Box, + field_id: Box, +} + +struct ProjectionInvariants { + input_validity: Type, + output_validity: Type, + output_alignment: TokenStream, +} + +fn derive_project_field( + ctx: &Ctx, + data: &dyn DataExt, + client: Client, + projection: FieldProjection, + invariants: ProjectionInvariants, +) -> TokenStream { + let FieldProjection { variant_id, field, field_id } = projection; + let ProjectionInvariants { input_validity, output_validity, output_alignment } = invariants; + let zerocopy_crate = &ctx.zerocopy_crate; + ImplBlockBuilder::new( + ctx, + data, + Trait::ProjectField { + client, + variant_id, + field, + field_id, + invariants: parse_quote!((___ZcAliasing, ___ZcAlignment, #input_validity)), + }, + FieldBounds::None, + ) + .param_extras(vec![ + parse_quote!(___ZcAliasing: #zerocopy_crate::invariant::Aliasing), + parse_quote!(___ZcAlignment: #zerocopy_crate::invariant::Alignment), + ]) + .inner_extras(quote! { + // SAFETY: Struct and union projections do not depend on the value of + // the referent, and are therefore infallible. + type Error = #zerocopy_crate::util::macro_util::core_reexport::convert::Infallible; + + // SAFETY: Projection preserves aliasing. It also preserves alignment + // unless the containing type is packed. The caller-selected validity + // mapping is justified by the kind of product or sum type being + // projected. + type Invariants = (___ZcAliasing, #output_alignment, #output_validity); + }) + .build() +} + +/// Generates field projection implementations for a struct or union. +/// +/// `repr_c_union` selects `REPR_C_UNION_VARIANT_ID` for unions whose +/// projections must additionally implement `pointer::cast::Cast`. +pub(crate) fn derive_has_field_struct_union( + ctx: &Ctx, + data: &dyn DataExt, + client: Client, + repr_c_union: bool, +) -> TokenStream { + let fields = ctx.ast.data.fields(); + if fields.is_empty() { + return quote! {}; + } + + let field_tokens = fields.iter().map(|(vis, ident, _)| { + let ident = ident!(("ẕ{}", ident), ident.span()); + quote! { + #vis enum #ident {} + } + }); + + let zerocopy_crate = &ctx.zerocopy_crate; + let variant_id: Box = match &ctx.ast.data { + Data::Struct(_) => parse_quote!({ #zerocopy_crate::STRUCT_VARIANT_ID }), + Data::Union(_) if repr_c_union => { + debug_assert!(StructUnionRepr::from_attrs(&ctx.ast.attrs) + .map(|repr| repr.is_c()) + .unwrap_or(false)); + parse_quote!({ #zerocopy_crate::REPR_C_UNION_VARIANT_ID }) + } + Data::Union(_) => parse_quote!({ #zerocopy_crate::UNION_VARIANT_ID }), + Data::Enum(_) => unreachable!(), + }; + + let core = ctx.core_path(); + let has_tag = ImplBlockBuilder::new(ctx, data, Trait::HasTag { client }, FieldBounds::None) + .inner_extras(quote! { + type Tag = (); + type ProjectToTag = #zerocopy_crate::pointer::cast::CastToUnit; + }) + .build(); + + let output_alignment = field_alignment(ctx); + let has_fields = fields.iter().map(move |(_, ident, ty)| { + let field_token = ident!(("ẕ{}", ident), ident.span()); + let projection = FieldProjection { + variant_id: variant_id.clone(), + field: parse_quote!(#field_token), + field_id: parse_quote!({ #zerocopy_crate::ident_id!(#ident) }), + }; + let has_field_trait = Trait::HasField { + client, + variant_id: projection.variant_id.clone(), + field: projection.field.clone(), + field_id: projection.field_id.clone(), + }; + let has_field_path = has_field_trait.crate_path(ctx); + let has_field = ImplBlockBuilder::new(ctx, data, has_field_trait, FieldBounds::None) + .inner_extras(quote! { + type Type = #ty; + + #[inline(always)] + fn project( + slf: #zerocopy_crate::pointer::PtrInner<'_, Self>, + ) -> *mut ::Type { + let slf = slf.as_ptr(); + // SAFETY: By invariant on `PtrInner`, `slf` is a non-null + // pointer whose referent is zero-sized or lives in a valid + // allocation. Since `#ident` is a struct or union field of + // `Self`, this projection preserves or shrinks the referent + // size, and so the resulting referent also fits in the same + // allocation. + unsafe { #core::ptr::addr_of_mut!((*slf).#ident) } + } + }) + .build(); + + let uninit = derive_project_field( + ctx, + data, + client, + projection.clone(), + ProjectionInvariants { + input_validity: parse_quote!(#zerocopy_crate::invariant::Uninit), + output_validity: parse_quote!(#zerocopy_crate::invariant::Uninit), + output_alignment: output_alignment.clone(), + }, + ); + let initialized = derive_project_field( + ctx, + data, + client, + projection.clone(), + ProjectionInvariants { + input_validity: parse_quote!(#zerocopy_crate::invariant::Initialized), + output_validity: parse_quote!(#zerocopy_crate::invariant::Initialized), + output_alignment: output_alignment.clone(), + }, + ); + let valid_output = if matches!(&ctx.ast.data, Data::Struct(_)) { + parse_quote!(#zerocopy_crate::invariant::Valid) + } else { + // A valid union need not contain a valid (or initialized) instance + // of any particular field. `Uninit` is the strongest validity + // invariant that holds for every field projection. + parse_quote!(#zerocopy_crate::invariant::Uninit) + }; + let valid = derive_project_field( + ctx, + data, + client, + projection, + ProjectionInvariants { + input_validity: parse_quote!(#zerocopy_crate::invariant::Valid), + output_validity: valid_output, + output_alignment: output_alignment.clone(), + }, + ); + + quote! { + #has_field + #uninit + #initialized + #valid + } + }); + + const_block(field_tokens.into_iter().chain(Some(has_tag)).chain(has_fields).map(Some)) +} + +fn generate_project_variant_structs(ctx: &Ctx, data: &DataEnum, client: Client) -> TokenStream { + let (impl_generics, ty_generics, where_clause) = ctx.ast.generics.split_for_impl(); + let enum_name = &ctx.ast.ident; + let core = ctx.core_path(); + let phantom_ty = quote! { + #core::marker::PhantomData<#enum_name #ty_generics> + }; + let variant_structs = data.variants.iter().filter_map(|variant| { + if matches!(variant.fields, Fields::Unit) { + return None; + } + + let ident = variant_struct_ident(&variant.ident); + let field_types = variant.fields.iter().map(|field| &field.ty); + let variant_struct: DeriveInput = parse_quote! { + #[repr(C)] + struct #ident #impl_generics ( + #core::mem::MaybeUninit<___ZerocopyInnerTag>, + #(#field_types,)* + #phantom_ty, + ) #where_clause; + }; + let projections = derive_has_field_struct_union( + &ctx.with_input(&variant_struct), + &variant_struct.data, + client, + false, + ); + + Some(quote! { + #variant_struct + #projections + }) + }); + + quote! { + #(#variant_structs)* + } +} + +fn generate_project_variants_union(ctx: &Ctx, data: &DataEnum, client: Client) -> TokenStream { + let generics = &ctx.ast.generics; + let (_, ty_generics, _) = generics.split_for_impl(); + let core = ctx.core_path(); + let fields = data.variants.iter().filter_map(|variant| { + if matches!(variant.fields, Fields::Unit) { + return None; + } + let field_name = variants_union_field_ident(&variant.ident); + let variant_struct = variant_struct_ident(&variant.ident); + Some(quote! { + #field_name: #core::mem::ManuallyDrop<#variant_struct #ty_generics>, + }) + }); + + let variants_union: DeriveInput = parse_quote! { + #[repr(C)] + union ___ZerocopyVariants #generics { + #(#fields)* + // A fieldless enum produces no variant structs, but a union must + // have at least one field. This unit does not affect `repr(C)` + // layout. + __nonempty: (), + } + }; + let projections = derive_has_field_struct_union( + &ctx.with_input(&variants_union), + &variants_union.data, + client, + true, + ); + + quote! { + #variants_union + #projections + } +} + +fn derive_enum_project_field( + ctx: &Ctx, + data: &DataEnum, + client: Client, + projection: FieldProjection, + validity: Type, + variant_tag: Option<&Ident>, +) -> TokenStream { + let FieldProjection { variant_id, field, field_id } = projection; + let zerocopy_crate = &ctx.zerocopy_crate; + let project_field_trait = Trait::ProjectField { + client, + variant_id, + field, + field_id, + invariants: parse_quote!((___ZcAliasing, ___ZcAlignment, #validity)), + }; + + let mut params = vec![ + parse_quote!(___ZcAliasing: #zerocopy_crate::invariant::Aliasing), + parse_quote!(___ZcAlignment: #zerocopy_crate::invariant::Alignment), + ]; + let (error, is_projectable) = if let Some(variant_tag) = variant_tag { + params[0] = parse_quote!(___ZcAliasing: #zerocopy_crate::invariant::Reference); + let has_tag_path = Trait::HasTag { client }.crate_path(ctx); + let core = ctx.core_path(); + ( + quote! { () }, + quote! { + #[inline(always)] + fn is_projectable( + tag: #zerocopy_crate::pointer::Ptr< + '_, + ::Tag, + ( + ___ZcAliasing, + ___ZcAlignment, + #zerocopy_crate::invariant::Valid, + ), + >, + ) -> #core::result::Result<(), ()> { + let tag = tag.read::<#zerocopy_crate::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == #variant_tag { + #core::result::Result::Ok(()) + } else { + #core::result::Result::Err(()) + } + } + }, + ) + } else { + ( + quote! { #zerocopy_crate::util::macro_util::core_reexport::convert::Infallible }, + quote! {}, + ) + }; + + ImplBlockBuilder::new(ctx, data, project_field_trait, FieldBounds::None) + .param_extras(params) + .inner_extras(quote! { + type Error = #error; + type Invariants = (___ZcAliasing, ___ZcAlignment, #validity); + #is_projectable + }) + .build() +} + +pub(crate) fn derive_has_field_enum(ctx: &Ctx, data: &DataEnum, client: Client) -> TokenStream { + let zerocopy_crate = &ctx.zerocopy_crate; + let has_fields = data.variants().into_iter().flat_map(|(variant, fields)| { + let variant_ident = &variant.unwrap().ident; + let variants_union_field = variants_union_field_ident(variant_ident); + let variant_id: Box = + parse_quote!({ #zerocopy_crate::ident_id!(#variant_ident) }); + let variant_tag = tag_ident(variant_ident); + + fields.into_iter().enumerate().map(move |(idx, (vis, ident, ty))| { + // Rust does not presently support explicit visibility modifiers on + // enum fields. Keep this assertion so that a future language + // change cannot silently invalidate the visibility invariant. + assert!(matches!(vis, syn::Visibility::Inherited)); + let projection = FieldProjection { + variant_id: variant_id.clone(), + field: parse_quote!(()), + field_id: parse_quote!({ #zerocopy_crate::ident_id!(#ident) }), + }; + let variant_struct_field_index = Index::from(idx + 1); + let (_, ty_generics, _) = ctx.ast.generics.split_for_impl(); + let has_field_trait = Trait::HasField { + client, + variant_id: projection.variant_id.clone(), + field: projection.field.clone(), + field_id: projection.field_id.clone(), + }; + let has_field_path = has_field_trait.crate_path(ctx); + let client_path = client.crate_path(ctx); + let has_field = ImplBlockBuilder::new(ctx, data, has_field_trait, FieldBounds::None) + .inner_extras(quote! { + type Type = #ty; + + #[inline(always)] + fn project( + slf: #zerocopy_crate::pointer::PtrInner<'_, Self>, + ) -> *mut ::Type { + use #zerocopy_crate::pointer::cast::{CastSized, Projection}; + + slf.project::<___ZerocopyRawEnum #ty_generics, CastSized>() + .project::<_, Projection<#client_path, _, { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(variants) }>>() + .project::<_, Projection<#client_path, _, { #zerocopy_crate::REPR_C_UNION_VARIANT_ID }, { #zerocopy_crate::ident_id!(#variants_union_field) }>>() + .project::<_, Projection<#client_path, _, { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(value) }>>() + .project::<_, Projection<#client_path, _, { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(#variant_struct_field_index) }>>() + .as_ptr() + } + }) + .build(); + + let uninit = derive_enum_project_field( + ctx, + data, + client, + projection.clone(), + parse_quote!(#zerocopy_crate::invariant::Uninit), + None, + ); + let initialized = derive_enum_project_field( + ctx, + data, + client, + projection.clone(), + parse_quote!(#zerocopy_crate::invariant::Initialized), + None, + ); + let valid = derive_enum_project_field( + ctx, + data, + client, + projection, + parse_quote!(#zerocopy_crate::invariant::Valid), + Some(&variant_tag), + ); + + quote! { + #has_field + #uninit + #initialized + #valid + } + }) + }); + + quote! { + #(#has_fields)* + } +} + +fn derive_enum(ctx: &Ctx, data: &DataEnum, client: Client) -> Result { + // With no fields, there are no `HasField` or `ProjectField` impls to emit, + // and therefore no representation requirement to enforce. + if data.fields().is_empty() { + return Ok(TokenStream::new()); + } + + let repr = EnumRepr::from_attrs(&ctx.ast.attrs)?; + let (outer_tag_type, inner_tag_type) = if repr.is_c() { + (quote! { ___ZerocopyTag }, quote! { () }) + } else if repr.is_primitive() { + (quote! { () }, quote! { ___ZerocopyTag }) + } else { + return Err(Error::new( + ctx.ast.span(), + "must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout", + )); + }; + + let tag_enum = generate_tag_enum(ctx, &repr, data); + let tag_consts = generate_tag_consts(data); + let variant_structs = generate_project_variant_structs(ctx, data, client); + let variants_union = generate_project_variants_union(ctx, data, client); + let zerocopy_crate = &ctx.zerocopy_crate; + let core = ctx.core_path(); + let (_, ty_generics, _) = ctx.ast.generics.split_for_impl(); + let generics = &ctx.ast.generics; + let raw_enum: DeriveInput = parse_quote! { + #[repr(C)] + struct ___ZerocopyRawEnum #generics { + tag: ___ZerocopyOuterTag, + variants: ___ZerocopyVariants #ty_generics, + } + }; + let raw_projections = + derive_has_field_struct_union(&ctx.with_input(&raw_enum), &raw_enum.data, client, false); + let has_tag = ImplBlockBuilder::new(ctx, data, Trait::HasTag { client }, FieldBounds::None) + .inner_extras(quote! { + type Tag = ___ZerocopyTag; + type ProjectToTag = #zerocopy_crate::pointer::cast::CastSized; + }) + .build(); + let has_fields = derive_has_field_enum(ctx, data, client); + + Ok(quote! { + #tag_enum + + type ___ZerocopyTagPrimitive = #zerocopy_crate::util::macro_util::SizeToTag< + { #core::mem::size_of::<___ZerocopyTag>() }, + >; + + #tag_consts + + type ___ZerocopyOuterTag = #outer_tag_type; + type ___ZerocopyInnerTag = #inner_tag_type; + + #variant_structs + #variants_union + + #raw_enum + #raw_projections + + #has_tag + #has_fields + }) +} + +pub(crate) fn derive(ctx: &Ctx, _top_level: Trait) -> Result { + match &ctx.ast.data { + Data::Struct(strct) => { + Ok(derive_has_field_struct_union(ctx, strct, Client::ProjectDerive, false)) + } + Data::Union(unn) => { + Ok(derive_has_field_struct_union(ctx, unn, Client::ProjectDerive, false)) + } + Data::Enum(enm) => derive_enum(ctx, enm, Client::ProjectDerive), + } +} diff --git a/zerocopy/zerocopy-derive/src/derive/try_from_bytes.rs b/zerocopy/zerocopy-derive/src/derive/try_from_bytes.rs index 6a58e22d6c..9b48acf786 100644 --- a/zerocopy/zerocopy-derive/src/derive/try_from_bytes.rs +++ b/zerocopy/zerocopy-derive/src/derive/try_from_bytes.rs @@ -4,65 +4,20 @@ use proc_macro2::TokenStream; use quote::quote; use syn::{ parse_quote, spanned::Spanned as _, Data, DataEnum, DataStruct, DataUnion, DeriveInput, Error, - Expr, Fields, Ident, Index, Type, + Fields, }; use crate::{ - repr::{EnumRepr, StructUnionRepr}, + derive::project::{ + derive_has_field_enum, derive_has_field_struct_union, generate_tag_consts, tag_ident, + variant_struct_ident, variants_union_field_ident, + }, + repr::EnumRepr, util::{ - const_block, enum_size_from_repr, generate_tag_enum, Client, Ctx, DataExt, FieldBounds, + enum_size_from_repr, generate_tag_enum, Client, Ctx, DataExt, FieldBounds, ImplBlockBuilder, Trait, TraitBound, }, }; -fn tag_ident(variant_ident: &Ident) -> Ident { - ident!(("___ZEROCOPY_TAG_{}", variant_ident), variant_ident.span()) -} - -/// Generates a constant for the tag associated with each variant of the enum. -/// When we match on the enum's tag, each arm matches one of these constants. We -/// have to use constants here because: -/// -/// - The type that we're matching on is not the type of the tag, it's an -/// integer of the same size as the tag type and with the same bit patterns. -/// - We can't read the enum tag as an enum because the bytes may not represent -/// a valid variant. -/// - Patterns do not currently support const expressions, so we have to assign -/// these constants to names rather than use them inline in the `match` -/// statement. -fn generate_tag_consts(data: &DataEnum) -> TokenStream { - let tags = data.variants.iter().map(|v| { - let variant_ident = &v.ident; - let tag_ident = tag_ident(variant_ident); - - quote! { - // This casts the enum variant to its discriminant, and then - // converts the discriminant to the target integral type via a - // numeric cast [1]. - // - // Because these are the same size, this is defined to be a no-op - // and therefore is a lossless conversion [2]. - // - // [1] Per https://doc.rust-lang.org/1.81.0/reference/expressions/operator-expr.html#enum-cast: - // - // Casts an enum to its discriminant. - // - // [2] Per https://doc.rust-lang.org/1.81.0/reference/expressions/operator-expr.html#numeric-cast: - // - // Casting between two integers of the same size (e.g. i32 -> u32) - // is a no-op. - const #tag_ident: ___ZerocopyTagPrimitive = - ___ZerocopyTag::#variant_ident as ___ZerocopyTagPrimitive; - } - }); - - quote! { - #(#tags)* - } -} - -fn variant_struct_ident(variant_ident: &Ident) -> Ident { - ident!(("___ZerocopyVariantStruct_{}", variant_ident), variant_ident.span()) -} /// Generates variant structs for the given enum variant. /// @@ -124,12 +79,6 @@ fn generate_variant_structs(ctx: &Ctx, data: &DataEnum) -> TokenStream { } } -fn variants_union_field_ident(ident: &Ident) -> Ident { - // Field names are prefixed with `__field_` to prevent name collision - // with the `__nonempty` field. - ident!(("__field_{}", ident), ident.span()) -} - fn generate_variants_union(ctx: &Ctx, data: &DataEnum) -> TokenStream { let generics = &ctx.ast.generics; let (_, ty_generics, _) = generics.split_for_impl(); @@ -163,8 +112,12 @@ fn generate_variants_union(ctx: &Ctx, data: &DataEnum) -> TokenStream { } }; - let has_field = - derive_has_field_struct_union(&ctx.with_input(&variants_union), &variants_union.data); + let has_field = derive_has_field_struct_union( + &ctx.with_input(&variants_union), + &variants_union.data, + Client::TryFromBytesDerive, + true, + ); quote! { #variants_union @@ -231,81 +184,7 @@ pub(crate) fn derive_is_bit_valid( type ProjectToTag = #zerocopy_crate::pointer::cast::CastSized; }) .build(); - let has_fields = data.variants().into_iter().flat_map(|(variant, fields)| { - let variant_ident = &variant.unwrap().ident; - let variants_union_field_ident = variants_union_field_ident(variant_ident); - let field: Box = parse_quote!(()); - fields.into_iter().enumerate().map(move |(idx, (vis, ident, ty))| { - // Rust does not presently support explicit visibility modifiers on - // enum fields, but we guard against the possibility to ensure this - // derive remains sound. - assert!(matches!(vis, syn::Visibility::Inherited)); - let variant_struct_field_index = Index::from(idx + 1); - let (_, ty_generics, _) = ctx.ast.generics.split_for_impl(); - let has_field_trait = Trait::HasField { - client: Client::TryFromBytesDerive, - variant_id: parse_quote!({ #zerocopy_crate::ident_id!(#variant_ident) }), - // Since Rust does not presently support explicit visibility - // modifiers on enum fields, any public type is suitable here; - // we use `()`. - field: field.clone(), - field_id: parse_quote!({ #zerocopy_crate::ident_id!(#ident) }), - }; - let has_field_path = has_field_trait.crate_path(ctx); - let has_field = ImplBlockBuilder::new( - ctx, - data, - has_field_trait, - FieldBounds::None, - ) - .inner_extras(quote! { - type Type = #ty; - - #[inline(always)] - fn project(slf: #zerocopy_crate::pointer::PtrInner<'_, Self>) -> *mut ::Type { - use #zerocopy_crate::pointer::cast::{CastSized, Projection}; - - slf.project::<___ZerocopyRawEnum #ty_generics, CastSized>() - .project::<_, Projection<#zerocopy_crate::TryFromBytesDerive, _, { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(variants) }>>() - .project::<_, Projection<#zerocopy_crate::TryFromBytesDerive, _, { #zerocopy_crate::REPR_C_UNION_VARIANT_ID }, { #zerocopy_crate::ident_id!(#variants_union_field_ident) }>>() - .project::<_, Projection<#zerocopy_crate::TryFromBytesDerive, _, { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(value) }>>() - .project::<_, Projection<#zerocopy_crate::TryFromBytesDerive, _, { #zerocopy_crate::STRUCT_VARIANT_ID }, { #zerocopy_crate::ident_id!(#variant_struct_field_index) }>>() - .as_ptr() - } - }) - .build(); - - let project = ImplBlockBuilder::new( - ctx, - data, - Trait::ProjectField { - client: Client::TryFromBytesDerive, - variant_id: parse_quote!({ #zerocopy_crate::ident_id!(#variant_ident) }), - // Since Rust does not presently support explicit visibility - // modifiers on enum fields, any public type is suitable - // here; we use `()`. - field: field.clone(), - field_id: parse_quote!({ #zerocopy_crate::ident_id!(#ident) }), - invariants: parse_quote!((Aliasing, Alignment, #zerocopy_crate::invariant::Initialized)), - }, - FieldBounds::None, - ) - .param_extras(vec![ - parse_quote!(Aliasing: #zerocopy_crate::invariant::Aliasing), - parse_quote!(Alignment: #zerocopy_crate::invariant::Alignment), - ]) - .inner_extras(quote! { - type Error = #zerocopy_crate::util::macro_util::core_reexport::convert::Infallible; - type Invariants = (Aliasing, Alignment, #zerocopy_crate::invariant::Initialized); - }) - .build(); - - quote! { - #has_field - #project - } - }) - }); + let has_fields = derive_has_field_enum(ctx, data, Client::TryFromBytesDerive); let core = ctx.core_path(); let match_arms = data.variants.iter().map(|variant| { @@ -365,8 +244,12 @@ pub(crate) fn derive_is_bit_valid( unsafe impl #impl_generics #zerocopy_crate::pointer::InvariantsEq<___ZerocopyRawEnum #ty_generics> for #self_ident #ty_generics #where_clause {} }; - let raw_enum_projections = - derive_has_field_struct_union(&ctx.with_input(&raw_enum), &raw_enum.data); + let raw_enum_projections = derive_has_field_struct_union( + &ctx.with_input(&raw_enum), + &raw_enum.data, + Client::TryFromBytesDerive, + false, + ); let raw_enum = quote! { #raw_enum @@ -405,7 +288,7 @@ pub(crate) fn derive_is_bit_valid( #has_tag - #(#has_fields)* + #has_fields let tag = { // SAFETY: @@ -459,122 +342,6 @@ pub(crate) fn derive_try_from_bytes(ctx: &Ctx, top_level: Trait) -> Result Ok(derive_try_from_bytes_union(ctx, unn, top_level)), } } -fn derive_has_field_struct_union(ctx: &Ctx, data: &dyn DataExt) -> TokenStream { - let fields = ctx.ast.data.fields(); - if fields.is_empty() { - return quote! {}; - } - - let field_tokens = fields.iter().map(|(vis, ident, _)| { - let ident = ident!(("ẕ{}", ident), ident.span()); - quote!( - #vis enum #ident {} - ) - }); - - let zerocopy_crate = &ctx.zerocopy_crate; - let variant_id: Box = match &ctx.ast.data { - Data::Struct(_) => parse_quote!({ #zerocopy_crate::STRUCT_VARIANT_ID }), - Data::Union(_) => { - let is_repr_c = StructUnionRepr::from_attrs(&ctx.ast.attrs) - .map(|repr| repr.is_c()) - .unwrap_or(false); - if is_repr_c { - parse_quote!({ #zerocopy_crate::REPR_C_UNION_VARIANT_ID }) - } else { - parse_quote!({ #zerocopy_crate::UNION_VARIANT_ID }) - } - } - _ => unreachable!(), - }; - - let core = ctx.core_path(); - let has_tag = ImplBlockBuilder::new( - ctx, - data, - Trait::HasTag { client: Client::TryFromBytesDerive }, - FieldBounds::None, - ) - .inner_extras(quote! { - type Tag = (); - type ProjectToTag = #zerocopy_crate::pointer::cast::CastToUnit; - }) - .build(); - let has_fields = fields.iter().map(move |(_, ident, ty)| { - let field_token = ident!(("ẕ{}", ident), ident.span()); - let field: Box = parse_quote!(#field_token); - let field_id: Box = parse_quote!({ #zerocopy_crate::ident_id!(#ident) }); - let has_field_trait = Trait::HasField { - client: Client::TryFromBytesDerive, - variant_id: variant_id.clone(), - field: field.clone(), - field_id: field_id.clone(), - }; - let has_field_path = has_field_trait.crate_path(ctx); - ImplBlockBuilder::new( - ctx, - data, - has_field_trait, - FieldBounds::None, - ) - .inner_extras(quote! { - type Type = #ty; - - #[inline(always)] - fn project(slf: #zerocopy_crate::pointer::PtrInner<'_, Self>) -> *mut ::Type { - let slf = slf.as_ptr(); - // SAFETY: By invariant on `PtrInner`, `slf` is a non-null - // pointer whose referent is zero-sized or lives in a valid - // allocation. Since `#ident` is a struct or union field of - // `Self`, this projection preserves or shrinks the referent - // size, and so the resulting referent also fits in the same - // allocation. - unsafe { #core::ptr::addr_of_mut!((*slf).#ident) } - } - }).outer_extras(if matches!(&ctx.ast.data, Data::Struct(..)) { - let fields_preserve_alignment = StructUnionRepr::from_attrs(&ctx.ast.attrs) - .map(|repr| repr.get_packed().is_none()) - .unwrap(); - let alignment = if fields_preserve_alignment { - quote! { Alignment } - } else { - quote! { #zerocopy_crate::invariant::Unaligned } - }; - // SAFETY: See comments on items. - ImplBlockBuilder::new( - ctx, - data, - Trait::ProjectField { - client: Client::TryFromBytesDerive, - variant_id: variant_id.clone(), - field, - field_id, - invariants: parse_quote!((Aliasing, Alignment, #zerocopy_crate::invariant::Initialized)), - }, - FieldBounds::None, - ) - .param_extras(vec![ - parse_quote!(Aliasing: #zerocopy_crate::invariant::Aliasing), - parse_quote!(Alignment: #zerocopy_crate::invariant::Alignment), - ]) - .inner_extras(quote! { - // SAFETY: Projection into structs is always infallible. - type Error = #zerocopy_crate::util::macro_util::core_reexport::convert::Infallible; - // SAFETY: The alignment of the projected `Ptr` is `Unaligned` - // if the structure is packed; otherwise inherited from the - // outer `Ptr`. If the validity of the outer pointer is - // `Initialized`, so too is the validity of its fields. - type Invariants = (Aliasing, #alignment, #zerocopy_crate::invariant::Initialized); - }) - .build() - } else { - quote! {} - }) - .build() - }); - - const_block(field_tokens.into_iter().chain(Some(has_tag)).chain(has_fields).map(Some)) -} fn derive_try_from_bytes_struct( ctx: &Ctx, strct: &DataStruct, @@ -600,7 +367,7 @@ fn derive_try_from_bytes_struct( ___ZcAlignment: #zerocopy_crate::invariant::Alignment, { true #(&& { - let field_candidate = #zerocopy_crate::into_inner!(candidate.reborrow().project::< + let field_candidate = #zerocopy_crate::into_inner!(candidate.reborrow().project::< #zerocopy_crate::TryFromBytesDerive, _, { #zerocopy_crate::STRUCT_VARIANT_ID }, @@ -613,23 +380,13 @@ fn derive_try_from_bytes_struct( }); Ok(ImplBlockBuilder::new(ctx, strct, Trait::TryFromBytes, FieldBounds::ALL_SELF) .inner_extras(extras) - .outer_extras(derive_has_field_struct_union(ctx, strct)) + .outer_extras(derive_has_field_struct_union(ctx, strct, Client::TryFromBytesDerive, false)) .build()) } fn derive_try_from_bytes_union(ctx: &Ctx, unn: &DataUnion, top_level: Trait) -> TokenStream { let field_type_trait_bounds = FieldBounds::All(&[TraitBound::Slf]); let zerocopy_crate = &ctx.zerocopy_crate; - let variant_id: Box = { - let is_repr_c = - StructUnionRepr::from_attrs(&ctx.ast.attrs).map(|repr| repr.is_c()).unwrap_or(false); - if is_repr_c { - parse_quote!({ #zerocopy_crate::REPR_C_UNION_VARIANT_ID }) - } else { - parse_quote!({ #zerocopy_crate::UNION_VARIANT_ID }) - } - }; - let extras = try_gen_trivial_is_bit_valid(ctx, top_level).unwrap_or_else(|| { let fields = unn.fields(); let field_names = fields.iter().map(|(_vis, name, _ty)| name); @@ -649,25 +406,14 @@ fn derive_try_from_bytes_union(ctx: &Ctx, unn: &DataUnion, top_level: Trait) -> ___ZcAlignment: #zerocopy_crate::invariant::Alignment, { false #(|| { - // SAFETY: - // - Since `ReadOnly: Immutable` unconditionally, - // neither `*slf` nor the returned pointer's referent - // permit interior mutation. - // - Both source and destination validity are - // `Initialized`, which is always a sound - // transmutation. - let field_candidate = unsafe { - candidate.reborrow().project_transmute_unchecked::< - _, + let field_candidate = #zerocopy_crate::into_inner!( + candidate.reborrow().project::< + #zerocopy_crate::TryFromBytesDerive, _, - #zerocopy_crate::pointer::cast::Projection< - #zerocopy_crate::TryFromBytesDerive, - _, - #variant_id, - { #zerocopy_crate::ident_id!(#field_names) } - > + { #zerocopy_crate::UNION_VARIANT_ID }, + { #zerocopy_crate::ident_id!(#field_names) }, >() - }; + ); <#field_tys as #zerocopy_crate::TryFromBytes>::is_bit_valid(field_candidate) })* @@ -676,7 +422,7 @@ fn derive_try_from_bytes_union(ctx: &Ctx, unn: &DataUnion, top_level: Trait) -> }); ImplBlockBuilder::new(ctx, unn, Trait::TryFromBytes, field_type_trait_bounds) .inner_extras(extras) - .outer_extras(derive_has_field_struct_union(ctx, unn)) + .outer_extras(derive_has_field_struct_union(ctx, unn, Client::TryFromBytesDerive, false)) .build() } fn derive_try_from_bytes_enum( diff --git a/zerocopy/zerocopy-derive/src/lib.rs b/zerocopy/zerocopy-derive/src/lib.rs index 078c84417b..9b5a9db193 100644 --- a/zerocopy/zerocopy-derive/src/lib.rs +++ b/zerocopy/zerocopy-derive/src/lib.rs @@ -79,7 +79,8 @@ use crate::util::*; /// are currently required to live at the crate root, and so the caller must /// specify the name in order to avoid name collisions. macro_rules! derive { - ($trait:ident => $outer:ident => $inner:path) => { + ($(#[$attr:meta])* $trait:ident => $outer:ident => $inner:path) => { + $(#[$attr])* #[proc_macro_derive($trait, attributes(zerocopy))] pub fn $outer(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { let ast = syn::parse_macro_input!(ts as DeriveInput); @@ -120,6 +121,7 @@ impl IntoTokenStream for Result { derive!(KnownLayout => derive_known_layout => crate::derive::known_layout::derive); derive!(Immutable => derive_immutable => crate::derive::derive_immutable); +derive!(#[doc(hidden)] Project => derive_project => crate::derive::project::derive); derive!(TryFromBytes => derive_try_from_bytes => crate::derive::try_from_bytes::derive_try_from_bytes); derive!(FromZeros => derive_from_zeros => crate::derive::from_bytes::derive_from_zeros); derive!(FromBytes => derive_from_bytes => crate::derive::from_bytes::derive_from_bytes); diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/from_bytes_union.expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/from_bytes_union.expected.rs index 37d2273285..93f81f74b5 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/from_bytes_union.expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/from_bytes_union.expected.rs @@ -106,6 +106,102 @@ const _: () = { } } }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕa, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(a) }, + > for Foo { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕa, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(a) }, + > for Foo { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕa, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(a) }, + > for Foo { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; }; }; #[allow( diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(C).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(C).expected.rs index afc8572d9a..99e697b678 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(C).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(C).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(C)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i128).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i128).expected.rs index 952eb8f55e..182460a3ed 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i128).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i128).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(i128)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i16).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i16).expected.rs index cb9d9c4844..a1a1414dfb 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i16).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i16).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(i16)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i32).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i32).expected.rs index f2b9ff9585..6ec90a6b4a 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i32).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i32).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(i32)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i64).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i64).expected.rs index 4e629c46be..ddc3e50661 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i64).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i64).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(i64)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i8).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i8).expected.rs index 1b06fe641c..c1ba87480d 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i8).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(i8).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(i8)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(isize).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(isize).expected.rs index 58eebe53e8..26f7ee40dc 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(isize).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(isize).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(isize)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u128).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u128).expected.rs index 53a656bdf2..9780f3d1cf 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u128).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u128).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(u128)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u16).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u16).expected.rs index 75b965d323..12ba3bb73d 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u16).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u16).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(u16)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u32).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u32).expected.rs index 8aff94e03d..5eb3b28329 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u32).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u32).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(u32)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u64).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u64).expected.rs index 586d17146d..82033828ca 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u64).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u64).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(u64)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u8).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u8).expected.rs index 3a01bc84ec..ddb91ec9da 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u8).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(u8).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(u8)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(usize).expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(usize).expected.rs index b800bb6620..5abb7ecba5 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(usize).expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/into_bytes_enum.repr(usize).expected.rs @@ -18,6 +18,7 @@ const _: () = { { #[repr(usize)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { Bar, } diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/project_struct.expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/project_struct.expected.rs new file mode 100644 index 0000000000..622e789923 --- /dev/null +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/project_struct.expected.rs @@ -0,0 +1,169 @@ +#[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, +)] +#[deny(ambiguous_associated_items)] +#[automatically_derived] +const _: () = { + enum ẕfield {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl ::zerocopy::HasTag<::zerocopy::ProjectDerive> for Foo { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl ::zerocopy::HasField< + ::zerocopy::ProjectDerive, + ẕfield, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(field) }, + > for Foo { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Type = u8; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).field + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + > ::zerocopy::ProjectField< + ::zerocopy::ProjectDerive, + ẕfield, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(field) }, + > for Foo { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + > ::zerocopy::ProjectField< + ::zerocopy::ProjectDerive, + ẕfield, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(field) }, + > for Foo { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + > ::zerocopy::ProjectField< + ::zerocopy::ProjectDerive, + ẕfield, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(field) }, + > for Foo { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; +}; diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_1.expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_1.expected.rs index f6a1809c05..4cb0e91117 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_1.expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_1.expected.rs @@ -34,6 +34,7 @@ const _: () = { { #[repr(u8)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { UnitLike, StructLike, @@ -303,45 +304,135 @@ const _: () = { } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ0, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } }; #[allow( deprecated, @@ -389,45 +480,6 @@ const _: () = { } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ1, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -446,74 +498,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ2, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, + { ::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 = X; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).2 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ2, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -532,74 +541,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ3, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, + { ::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 = X::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).3 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ3, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -618,74 +584,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ4, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(4) }, + { ::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 = Y::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).4 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ4, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -707,71 +630,32 @@ const _: () = { const N: usize, > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, - ẕ5, + ẕ2, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(5) }, + { ::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, Y); N]; + type Type = X; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).5 + (* slf).2 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ5, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -790,220 +674,32 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ6, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(6) }, + { ::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 = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).6 - ) - } - } - } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ6, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } }; - }; - }; - #[repr(C)] - struct ___ZerocopyVariantStruct_TupleLike< - 'a: 'static, - const N: usize, - X, - Y: Deref, - >( - ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >, - bool, - Y, - PhantomData<&'a [(X, Y); N]>, - ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >, - ) - where - X: Deref; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::TryFromBytes - for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> - where - X: Deref, - ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >: ::zerocopy::TryFromBytes, - bool: ::zerocopy::TryFromBytes, - Y: ::zerocopy::TryFromBytes, - PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, - ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >: ::zerocopy::TryFromBytes, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - #[inline] - fn is_bit_valid<___ZcAlignment>( - mut candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>, - ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool - where - ___ZcAlignment: ::zerocopy::invariant::Alignment, - { - true - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(0) - } > () - ); - <::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - > as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(1) - } > () - ); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(2) - } > () - ); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(3) - } > () - ); - as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(4) - } > () - ); - <::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - > as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - } - } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - enum ẕ0 {} - enum ẕ1 {} - enum ẕ2 {} - enum ẕ3 {} - enum ẕ4 {} #[allow( deprecated, private_bounds, @@ -1021,15 +717,30 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Tag = (); - type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -1049,76 +760,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ0, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(0) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + { ::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 = ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).0 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ0, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1140,71 +806,32 @@ const _: () = { const N: usize, > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, - ẕ1, + ẕ3, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + { ::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 = bool; + type Type = X::Target; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).1 + (* slf).3 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ1, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1223,74 +850,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ2, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + { ::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 = Y; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).2 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ2, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1309,74 +893,121 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), { ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(3) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = PhantomData<&'a [(X, Y); N]>; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).3 + (* slf).4 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ3, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1395,365 +1026,165 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(4) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).4 + (* slf).5 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ4, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; - }; - }; - #[repr(C)] - union ___ZerocopyVariants<'a: 'static, const N: usize, X, Y: Deref> { - __field_StructLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >, - __field_TupleLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >, - __nonempty: (), - } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - enum ẕ__field_StructLike {} - enum ẕ__field_TupleLike {} - enum ẕ__nonempty {} - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ___ZerocopyVariants<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Tag = (); - type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ__field_StructLike, - { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__field_StructLike - ) - } - } - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ__field_TupleLike, - { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__field_TupleLike - ) - } - } - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ__nonempty, - { ::zerocopy::REPR_C_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 >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__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( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - enum ẕtag {} - enum ẕvariants {} - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ___ZerocopyRawEnum<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Tag = (); - type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ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 >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).tag - ) - } - } - } #[allow( deprecated, private_bounds, @@ -1771,69 +1202,167 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕtag, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + ẕ5, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(tag) }, - > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + { ::zerocopy::ident_id!(5) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ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 ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕvariants, + ẕ5, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >>::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).variants - ) + { ::zerocopy::ident_id!(5) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ5, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).6 + ) + } } } - } + }; #[allow( deprecated, private_bounds, @@ -1851,27 +1380,2611 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕvariants, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + ẕ6, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + { ::zerocopy::ident_id!(6) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ6, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, + ___ZcAliasing, + ___ZcAlignment, ::zerocopy::invariant::Initialized, ); } }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ6, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; }; }; + #[repr(C)] + struct ___ZerocopyVariantStruct_TupleLike< + 'a: 'static, + const N: usize, + X, + Y: Deref, + >( + ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >, + bool, + Y, + PhantomData<&'a [(X, Y); N]>, + ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >, + ) + where + X: Deref; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::TryFromBytes + for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >: ::zerocopy::TryFromBytes, + bool: ::zerocopy::TryFromBytes, + Y: ::zerocopy::TryFromBytes, + PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, + ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >: ::zerocopy::TryFromBytes, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + #[inline] + fn is_bit_valid<___ZcAlignment>( + mut candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>, + ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool + where + ___ZcAlignment: ::zerocopy::invariant::Alignment, + { + true + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(0) + } > () + ); + <::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + > as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(1) + } > () + ); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(2) + } > () + ); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(3) + } > () + ); + as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(4) + } > () + ); + <::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + > as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + } + } + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + enum ẕ0 {} + enum ẕ1 {} + enum ẕ2 {} + enum ẕ3 {} + enum ẕ4 {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 = ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).0 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).1 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).2 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).3 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).4 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + }; + }; + #[repr(C)] + union ___ZerocopyVariants<'a: 'static, const N: usize, X, Y: Deref> { + __field_StructLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >, + __field_TupleLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >, + __nonempty: (), + } + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + enum ẕ__field_StructLike {} + enum ẕ__field_TupleLike {} + enum ẕ__nonempty {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__field_StructLike + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__field_TupleLike + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + { ::zerocopy::REPR_C_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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__nonempty + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + }; + #[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( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + enum ẕtag {} + enum ẕvariants {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).tag + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕtag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕtag, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕtag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).variants + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕvariants, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕvariants, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕvariants, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = ___ZerocopyTag; + type ProjectToTag = ::zerocopy::pointer::cast::CastSized; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + (), + { ::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 >::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(1) }, + >, + >() + .as_ptr() + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + (), + { ::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 >::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(2) }, + >, + >() + .as_ptr() + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + (), + { ::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 >::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(3) }, + >, + >() + .as_ptr() + } + } + }; #[allow( deprecated, private_bounds, @@ -1889,15 +4002,125 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ComplexWithGenerics<'a, { N }, X, Y> + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::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 Tag = ___ZerocopyTag; - type ProjectToTag = ::zerocopy::pointer::cast::CastSized; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; #[allow( @@ -1922,13 +4145,13 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, + { ::zerocopy::ident_id!(d) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = u8; + type Type = Y::Target; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, @@ -1936,7 +4159,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, + { ::zerocopy::ident_id!(d) }, >>::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -1973,7 +4196,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(4) }, >, >() .as_ptr() @@ -1997,15 +4220,54 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, + { ::zerocopy::ident_id!(d) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(d) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2013,8 +4275,8 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, + ___ZcAliasing, + ___ZcAlignment, ::zerocopy::invariant::Initialized, ); } @@ -2031,6 +4293,66 @@ const _: () = { )] #[deny(ambiguous_associated_items)] #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] const _: () = { unsafe impl< 'a: 'static, @@ -2041,13 +4363,13 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, + { ::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; + type Type = [(X, Y); N]; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, @@ -2055,7 +4377,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, + { ::zerocopy::ident_id!(e) }, >>::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2092,7 +4414,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, + { ::zerocopy::ident_id!(5) }, >, >() .as_ptr() @@ -2116,15 +4438,54 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, + { ::zerocopy::ident_id!(e) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(e) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2132,8 +4493,8 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, + ___ZcAliasing, + ___ZcAlignment, ::zerocopy::invariant::Initialized, ); } @@ -2150,6 +4511,66 @@ const _: () = { )] #[deny(ambiguous_associated_items)] #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] const _: () = { unsafe impl< 'a: 'static, @@ -2159,22 +4580,22 @@ const _: () = { > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(c) }, + { ::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 = X::Target; + type Type = bool; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2193,7 +4614,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, + { ::zerocopy::ident_id!(__field_TupleLike) }, >, >() .project::< @@ -2211,7 +4632,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, + { ::zerocopy::ident_id!(1) }, >, >() .as_ptr() @@ -2235,15 +4656,15 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(c) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::ident_id!(TupleLike) }, + { ::zerocopy::ident_id!(0) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2251,9 +4672,9 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; @@ -2274,67 +4695,26 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(d) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 = Y::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(4) }, - >, - >() - .as_ptr() - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -2354,26 +4734,47 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(d) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Error = (); type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_TupleLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; #[allow( @@ -2397,22 +4798,22 @@ const _: () = { > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(e) }, + { ::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 = [(X, Y); N]; + type Type = Y; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2431,7 +4832,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, + { ::zerocopy::ident_id!(__field_TupleLike) }, >, >() .project::< @@ -2449,7 +4850,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(5) }, + { ::zerocopy::ident_id!(2) }, >, >() .as_ptr() @@ -2473,15 +4874,15 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(e) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::ident_id!(TupleLike) }, + { ::zerocopy::ident_id!(1) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2489,9 +4890,9 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; @@ -2512,67 +4913,26 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(0) }, + { ::zerocopy::ident_id!(1) }, > 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 >::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - >, - >() - .as_ptr() - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -2592,26 +4952,47 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(0) }, + { ::zerocopy::ident_id!(1) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Error = (); type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_TupleLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; #[allow( @@ -2636,13 +5017,13 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = Y; + type Type = PhantomData<&'a [(X, Y); N]>; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, @@ -2650,7 +5031,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(2) }, >>::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2687,7 +5068,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, + { ::zerocopy::ident_id!(3) }, >, >() .as_ptr() @@ -2711,15 +5092,15 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2727,9 +5108,9 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; @@ -2750,10 +5131,13 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), { ::zerocopy::ident_id!(TupleLike) }, { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> @@ -2761,56 +5145,12 @@ const _: () = { 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 >::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, - >, - >() - .as_ptr() - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -2830,13 +5170,13 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), { ::zerocopy::ident_id!(TupleLike) }, { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> @@ -2844,12 +5184,33 @@ const _: () = { X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Error = (); type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_TupleLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; let tag = { diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_2.expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_2.expected.rs index a4ebb6161a..5aff60d172 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_2.expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_2.expected.rs @@ -34,6 +34,7 @@ const _: () = { { #[repr(u32)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { UnitLike, StructLike, @@ -303,45 +304,135 @@ const _: () = { } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ0, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } }; #[allow( deprecated, @@ -389,45 +480,6 @@ const _: () = { } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ1, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -446,74 +498,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ2, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, + { ::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 = X; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).2 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ2, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -532,74 +541,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ3, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, + { ::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 = X::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).3 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ3, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -618,74 +584,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ4, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(4) }, + { ::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 = Y::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).4 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ4, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -707,71 +630,32 @@ const _: () = { const N: usize, > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, - ẕ5, + ẕ2, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(5) }, + { ::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, Y); N]; + type Type = X; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).5 + (* slf).2 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ5, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -790,220 +674,32 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ6, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(6) }, + { ::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 = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).6 - ) - } - } - } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ6, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } }; - }; - }; - #[repr(C)] - struct ___ZerocopyVariantStruct_TupleLike< - 'a: 'static, - const N: usize, - X, - Y: Deref, - >( - ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >, - bool, - Y, - PhantomData<&'a [(X, Y); N]>, - ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >, - ) - where - X: Deref; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::TryFromBytes - for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> - where - X: Deref, - ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >: ::zerocopy::TryFromBytes, - bool: ::zerocopy::TryFromBytes, - Y: ::zerocopy::TryFromBytes, - PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, - ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >: ::zerocopy::TryFromBytes, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - #[inline] - fn is_bit_valid<___ZcAlignment>( - mut candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>, - ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool - where - ___ZcAlignment: ::zerocopy::invariant::Alignment, - { - true - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(0) - } > () - ); - <::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - > as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(1) - } > () - ); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(2) - } > () - ); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(3) - } > () - ); - as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(4) - } > () - ); - <::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - > as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - } - } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - enum ẕ0 {} - enum ẕ1 {} - enum ẕ2 {} - enum ẕ3 {} - enum ẕ4 {} #[allow( deprecated, private_bounds, @@ -1021,15 +717,30 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Tag = (); - type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -1049,76 +760,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ0, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(0) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + { ::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 = ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).0 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ0, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1140,71 +806,32 @@ const _: () = { const N: usize, > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, - ẕ1, + ẕ3, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + { ::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 = bool; + type Type = X::Target; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).1 + (* slf).3 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ1, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1223,74 +850,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ2, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + { ::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 = Y; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).2 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ2, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1309,74 +893,121 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), { ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(3) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = PhantomData<&'a [(X, Y); N]>; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).3 + (* slf).4 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ3, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1395,365 +1026,165 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(4) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).4 + (* slf).5 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ4, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; - }; - }; - #[repr(C)] - union ___ZerocopyVariants<'a: 'static, const N: usize, X, Y: Deref> { - __field_StructLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >, - __field_TupleLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >, - __nonempty: (), - } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - enum ẕ__field_StructLike {} - enum ẕ__field_TupleLike {} - enum ẕ__nonempty {} - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ___ZerocopyVariants<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Tag = (); - type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ__field_StructLike, - { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__field_StructLike - ) - } - } - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ__field_TupleLike, - { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__field_TupleLike - ) - } - } - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ__nonempty, - { ::zerocopy::REPR_C_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 >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__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( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - enum ẕtag {} - enum ẕvariants {} - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ___ZerocopyRawEnum<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Tag = (); - type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ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 >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).tag - ) - } - } - } #[allow( deprecated, private_bounds, @@ -1771,69 +1202,167 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕtag, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + ẕ5, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(tag) }, - > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + { ::zerocopy::ident_id!(5) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ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 ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕvariants, + ẕ5, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >>::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).variants - ) + { ::zerocopy::ident_id!(5) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ5, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).6 + ) + } } } - } + }; #[allow( deprecated, private_bounds, @@ -1851,27 +1380,2611 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕvariants, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + ẕ6, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + { ::zerocopy::ident_id!(6) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ6, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, + ___ZcAliasing, + ___ZcAlignment, ::zerocopy::invariant::Initialized, ); } }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ6, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; }; }; + #[repr(C)] + struct ___ZerocopyVariantStruct_TupleLike< + 'a: 'static, + const N: usize, + X, + Y: Deref, + >( + ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >, + bool, + Y, + PhantomData<&'a [(X, Y); N]>, + ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >, + ) + where + X: Deref; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::TryFromBytes + for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >: ::zerocopy::TryFromBytes, + bool: ::zerocopy::TryFromBytes, + Y: ::zerocopy::TryFromBytes, + PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, + ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >: ::zerocopy::TryFromBytes, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + #[inline] + fn is_bit_valid<___ZcAlignment>( + mut candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>, + ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool + where + ___ZcAlignment: ::zerocopy::invariant::Alignment, + { + true + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(0) + } > () + ); + <::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + > as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(1) + } > () + ); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(2) + } > () + ); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(3) + } > () + ); + as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(4) + } > () + ); + <::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + > as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + } + } + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + enum ẕ0 {} + enum ẕ1 {} + enum ẕ2 {} + enum ẕ3 {} + enum ẕ4 {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 = ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).0 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).1 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).2 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).3 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).4 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + }; + }; + #[repr(C)] + union ___ZerocopyVariants<'a: 'static, const N: usize, X, Y: Deref> { + __field_StructLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >, + __field_TupleLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >, + __nonempty: (), + } + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + enum ẕ__field_StructLike {} + enum ẕ__field_TupleLike {} + enum ẕ__nonempty {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__field_StructLike + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__field_TupleLike + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + { ::zerocopy::REPR_C_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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__nonempty + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + }; + #[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( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + enum ẕtag {} + enum ẕvariants {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).tag + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕtag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕtag, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕtag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).variants + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕvariants, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕvariants, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕvariants, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = ___ZerocopyTag; + type ProjectToTag = ::zerocopy::pointer::cast::CastSized; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + (), + { ::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 >::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(1) }, + >, + >() + .as_ptr() + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + (), + { ::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 >::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(2) }, + >, + >() + .as_ptr() + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + (), + { ::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 >::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(3) }, + >, + >() + .as_ptr() + } + } + }; #[allow( deprecated, private_bounds, @@ -1889,15 +4002,125 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ComplexWithGenerics<'a, { N }, X, Y> + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::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 Tag = ___ZerocopyTag; - type ProjectToTag = ::zerocopy::pointer::cast::CastSized; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; #[allow( @@ -1922,13 +4145,13 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, + { ::zerocopy::ident_id!(d) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = u8; + type Type = Y::Target; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, @@ -1936,7 +4159,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, + { ::zerocopy::ident_id!(d) }, >>::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -1973,7 +4196,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(4) }, >, >() .as_ptr() @@ -1997,15 +4220,54 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, + { ::zerocopy::ident_id!(d) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(d) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2013,8 +4275,8 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, + ___ZcAliasing, + ___ZcAlignment, ::zerocopy::invariant::Initialized, ); } @@ -2031,6 +4293,66 @@ const _: () = { )] #[deny(ambiguous_associated_items)] #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] const _: () = { unsafe impl< 'a: 'static, @@ -2041,13 +4363,13 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, + { ::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; + type Type = [(X, Y); N]; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, @@ -2055,7 +4377,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, + { ::zerocopy::ident_id!(e) }, >>::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2092,7 +4414,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, + { ::zerocopy::ident_id!(5) }, >, >() .as_ptr() @@ -2116,15 +4438,54 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, + { ::zerocopy::ident_id!(e) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(e) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2132,8 +4493,8 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, + ___ZcAliasing, + ___ZcAlignment, ::zerocopy::invariant::Initialized, ); } @@ -2150,6 +4511,66 @@ const _: () = { )] #[deny(ambiguous_associated_items)] #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] const _: () = { unsafe impl< 'a: 'static, @@ -2159,22 +4580,22 @@ const _: () = { > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(c) }, + { ::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 = X::Target; + type Type = bool; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2193,7 +4614,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, + { ::zerocopy::ident_id!(__field_TupleLike) }, >, >() .project::< @@ -2211,7 +4632,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, + { ::zerocopy::ident_id!(1) }, >, >() .as_ptr() @@ -2235,15 +4656,15 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(c) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::ident_id!(TupleLike) }, + { ::zerocopy::ident_id!(0) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2251,9 +4672,9 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; @@ -2274,67 +4695,26 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(d) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 = Y::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(4) }, - >, - >() - .as_ptr() - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -2354,26 +4734,47 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(d) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Error = (); type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_TupleLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; #[allow( @@ -2397,22 +4798,22 @@ const _: () = { > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(e) }, + { ::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 = [(X, Y); N]; + type Type = Y; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2431,7 +4832,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, + { ::zerocopy::ident_id!(__field_TupleLike) }, >, >() .project::< @@ -2449,7 +4850,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(5) }, + { ::zerocopy::ident_id!(2) }, >, >() .as_ptr() @@ -2473,15 +4874,15 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(e) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::ident_id!(TupleLike) }, + { ::zerocopy::ident_id!(1) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2489,9 +4890,9 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; @@ -2512,67 +4913,26 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(0) }, + { ::zerocopy::ident_id!(1) }, > 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 >::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - >, - >() - .as_ptr() - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -2592,26 +4952,47 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(0) }, + { ::zerocopy::ident_id!(1) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Error = (); type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_TupleLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; #[allow( @@ -2636,13 +5017,13 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = Y; + type Type = PhantomData<&'a [(X, Y); N]>; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, @@ -2650,7 +5031,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(2) }, >>::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2687,7 +5068,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, + { ::zerocopy::ident_id!(3) }, >, >() .as_ptr() @@ -2711,15 +5092,15 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2727,9 +5108,9 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; @@ -2750,10 +5131,13 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), { ::zerocopy::ident_id!(TupleLike) }, { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> @@ -2761,56 +5145,12 @@ const _: () = { 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 >::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, - >, - >() - .as_ptr() - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -2830,13 +5170,13 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), { ::zerocopy::ident_id!(TupleLike) }, { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> @@ -2844,12 +5184,33 @@ const _: () = { X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Error = (); type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_TupleLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; let tag = { diff --git a/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_3.expected.rs b/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_3.expected.rs index 2bb8eec8ad..8fe9120a63 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_3.expected.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/expected/try_from_bytes_enum_3.expected.rs @@ -34,6 +34,7 @@ const _: () = { { #[repr(C)] #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { UnitLike, StructLike, @@ -303,45 +304,135 @@ const _: () = { } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ0, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } }; #[allow( deprecated, @@ -389,45 +480,6 @@ const _: () = { } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ1, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -446,74 +498,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ2, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, + { ::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 = X; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).2 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ2, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -532,74 +541,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ3, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, + { ::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 = X::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).3 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ3, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -618,74 +584,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ4, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(4) }, + { ::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 = Y::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).4 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ4, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -707,71 +630,32 @@ const _: () = { const N: usize, > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, - ẕ5, + ẕ2, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(5) }, + { ::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, Y); N]; + type Type = X; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).5 + (* slf).2 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ5, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -790,220 +674,32 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ6, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(6) }, + { ::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 = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).6 - ) - } - } - } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ6, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } }; - }; - }; - #[repr(C)] - struct ___ZerocopyVariantStruct_TupleLike< - 'a: 'static, - const N: usize, - X, - Y: Deref, - >( - ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >, - bool, - Y, - PhantomData<&'a [(X, Y); N]>, - ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >, - ) - where - X: Deref; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::TryFromBytes - for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> - where - X: Deref, - ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >: ::zerocopy::TryFromBytes, - bool: ::zerocopy::TryFromBytes, - Y: ::zerocopy::TryFromBytes, - PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, - ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >: ::zerocopy::TryFromBytes, - { - fn only_derive_is_allowed_to_implement_this_trait() {} - #[inline] - fn is_bit_valid<___ZcAlignment>( - mut candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>, - ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool - where - ___ZcAlignment: ::zerocopy::invariant::Alignment, - { - true - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(0) - } > () - ); - <::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - > as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(1) - } > () - ); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(2) - } > () - ); - ::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(3) - } > () - ); - as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - && { - let field_candidate = ::zerocopy::into_inner!( - candidate.reborrow().project:: < - ::zerocopy::TryFromBytesDerive, _, { - ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(4) - } > () - ); - <::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - > as ::zerocopy::TryFromBytes>::is_bit_valid( - field_candidate, - ) - } - } - } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - enum ẕ0 {} - enum ẕ1 {} - enum ẕ2 {} - enum ẕ3 {} - enum ẕ4 {} #[allow( deprecated, private_bounds, @@ -1021,15 +717,30 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Tag = (); - type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -1049,76 +760,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ0, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(0) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + { ::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 = ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< - ___ZerocopyInnerTag, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).0 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ0, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1140,71 +806,32 @@ const _: () = { const N: usize, > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, - ẕ1, + ẕ3, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + { ::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 = bool; + type Type = X::Target; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).1 + (* slf).3 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ1, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1223,74 +850,31 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕ2, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + { ::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 = Y; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).2 - ) - } - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ2, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1309,74 +893,121 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), { ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(3) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = PhantomData<&'a [(X, Y); N]>; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).3 + (* slf).4 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ3, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; #[allow( deprecated, @@ -1395,365 +1026,165 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(4) }, - > for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< - ComplexWithGenerics<'a, N, X, Y>, - >; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { let slf = slf.as_ptr(); unsafe { ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).4 + (* slf).5 ) } } } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, - const N: usize, - > ::zerocopy::ProjectField< - ::zerocopy::TryFromBytesDerive, - ẕ4, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; - type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, - ); - } - }; }; - }; - }; - #[repr(C)] - union ___ZerocopyVariants<'a: 'static, const N: usize, X, Y: Deref> { - __field_StructLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >, - __field_TupleLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >, - __nonempty: (), - } - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - enum ẕ__field_StructLike {} - enum ẕ__field_TupleLike {} - enum ẕ__nonempty {} - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ___ZerocopyVariants<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Tag = (); - type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ__field_StructLike, - { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__field_StructLike - ) - } - } - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ__field_TupleLike, - { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< - ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, - >; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__field_TupleLike - ) - } - } - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ__nonempty, - { ::zerocopy::REPR_C_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 >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).__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( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - enum ẕtag {} - enum ẕvariants {} - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ___ZerocopyRawEnum<'a, { N }, X, Y> { - fn only_derive_is_allowed_to_implement_this_trait() {} - type Tag = (); - type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; - } - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ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 >::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).tag - ) - } - } - } #[allow( deprecated, private_bounds, @@ -1771,69 +1202,167 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕtag, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + ẕ5, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(tag) }, - > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + { ::zerocopy::ident_id!(5) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; - }; - #[allow( - deprecated, - private_bounds, - non_local_definitions, - non_camel_case_types, - non_upper_case_globals, - non_snake_case, - non_ascii_idents, - clippy::missing_inline_in_public_items, - )] - #[deny(ambiguous_associated_items)] - #[automatically_derived] - const _: () = { - unsafe impl< - 'a: 'static, - X, - Y: Deref, - const N: usize, - > ::zerocopy::HasField< - ::zerocopy::TryFromBytesDerive, - ẕ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 ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕvariants, + ẕ5, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >>::Type { - let slf = slf.as_ptr(); - unsafe { - ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( - (* slf).variants - ) + { ::zerocopy::ident_id!(5) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ5, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).6 + ) + } } } - } + }; #[allow( deprecated, private_bounds, @@ -1851,27 +1380,2611 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, - ẕvariants, - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + ẕ6, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + { ::zerocopy::ident_id!(6) }, + > for ___ZerocopyVariantStruct_StructLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ6, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, + ___ZcAliasing, + ___ZcAlignment, ::zerocopy::invariant::Initialized, ); } }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ6, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; }; }; + #[repr(C)] + struct ___ZerocopyVariantStruct_TupleLike< + 'a: 'static, + const N: usize, + X, + Y: Deref, + >( + ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >, + bool, + Y, + PhantomData<&'a [(X, Y); N]>, + ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >, + ) + where + X: Deref; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::TryFromBytes + for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >: ::zerocopy::TryFromBytes, + bool: ::zerocopy::TryFromBytes, + Y: ::zerocopy::TryFromBytes, + PhantomData<&'a [(X, Y); N]>: ::zerocopy::TryFromBytes, + ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >: ::zerocopy::TryFromBytes, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + #[inline] + fn is_bit_valid<___ZcAlignment>( + mut candidate: ::zerocopy::Maybe<'_, Self, ___ZcAlignment>, + ) -> ::zerocopy::util::macro_util::core_reexport::primitive::bool + where + ___ZcAlignment: ::zerocopy::invariant::Alignment, + { + true + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(0) + } > () + ); + <::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + > as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(1) + } > () + ); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(2) + } > () + ); + ::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(3) + } > () + ); + as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + && { + let field_candidate = ::zerocopy::into_inner!( + candidate.reborrow().project:: < + ::zerocopy::TryFromBytesDerive, _, { + ::zerocopy::STRUCT_VARIANT_ID }, { ::zerocopy::ident_id!(4) + } > () + ); + <::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + > as ::zerocopy::TryFromBytes>::is_bit_valid( + field_candidate, + ) + } + } + } + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + enum ẕ0 {} + enum ẕ1 {} + enum ẕ2 {} + enum ẕ3 {} + enum ẕ4 {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ___ZerocopyVariantStruct_TupleLike<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 = ::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit< + ___ZerocopyInnerTag, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).0 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ0, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).1 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ1, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).2 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ2, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).3 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ3, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 = ::zerocopy::util::macro_util::core_reexport::marker::PhantomData< + ComplexWithGenerics<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).4 + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ4, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + }; + }; + #[repr(C)] + union ___ZerocopyVariants<'a: 'static, const N: usize, X, Y: Deref> { + __field_StructLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >, + __field_TupleLike: ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >, + __nonempty: (), + } + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + enum ẕ__field_StructLike {} + enum ẕ__field_TupleLike {} + enum ẕ__nonempty {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_StructLike<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__field_StructLike + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_StructLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + { ::zerocopy::REPR_C_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 = ::zerocopy::util::macro_util::core_reexport::mem::ManuallyDrop< + ___ZerocopyVariantStruct_TupleLike<'a, N, X, Y>, + >; + #[inline(always)] + fn project( + slf: ::zerocopy::pointer::PtrInner<'_, Self>, + ) -> *mut >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__field_TupleLike + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__field_TupleLike, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_TupleLike) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + { ::zerocopy::REPR_C_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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).__nonempty + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕ__nonempty, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__nonempty) }, + > for ___ZerocopyVariants<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + }; + #[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( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + enum ẕtag {} + enum ẕvariants {} + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = (); + type ProjectToTag = ::zerocopy::pointer::cast::CastToUnit; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).tag + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕtag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕtag, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕtag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(tag) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + ẕ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 >::Type { + let slf = slf.as_ptr(); + unsafe { + ::zerocopy::util::macro_util::core_reexport::ptr::addr_of_mut!( + (* slf).variants + ) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕvariants, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕvariants, + ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + ẕvariants, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + > for ___ZerocopyRawEnum<'a, { N }, X, Y> { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + } + }; + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> + for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Tag = ___ZerocopyTag; + type ProjectToTag = ::zerocopy::pointer::cast::CastSized; + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + (), + { ::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 >::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(1) }, + >, + >() + .as_ptr() + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + (), + { ::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 >::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(2) }, + >, + >() + .as_ptr() + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + const N: usize, + > ::zerocopy::HasField< + ::zerocopy::TryFromBytesDerive, + (), + { ::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 >::Type { + use ::zerocopy::pointer::cast::{CastSized, Projection}; + slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(variants) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::REPR_C_UNION_VARIANT_ID }, + { ::zerocopy::ident_id!(__field_StructLike) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(value) }, + >, + >() + .project::< + _, + Projection< + ::zerocopy::TryFromBytesDerive, + _, + { ::zerocopy::STRUCT_VARIANT_ID }, + { ::zerocopy::ident_id!(3) }, + >, + >() + .as_ptr() + } + } + }; #[allow( deprecated, private_bounds, @@ -1889,15 +4002,125 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasTag<::zerocopy::TryFromBytesDerive> - for ComplexWithGenerics<'a, { N }, X, Y> + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::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 Tag = ___ZerocopyTag; - type ProjectToTag = ::zerocopy::pointer::cast::CastSized; + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; #[allow( @@ -1922,13 +4145,13 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, + { ::zerocopy::ident_id!(d) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = u8; + type Type = Y::Target; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, @@ -1936,7 +4159,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, + { ::zerocopy::ident_id!(d) }, >>::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -1973,7 +4196,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(4) }, >, >() .as_ptr() @@ -1997,15 +4220,54 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(a) }, + { ::zerocopy::ident_id!(d) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(d) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2013,8 +4275,8 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, + ___ZcAliasing, + ___ZcAlignment, ::zerocopy::invariant::Initialized, ); } @@ -2031,6 +4293,66 @@ const _: () = { )] #[deny(ambiguous_associated_items)] #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] const _: () = { unsafe impl< 'a: 'static, @@ -2041,13 +4363,13 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, + { ::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; + type Type = [(X, Y); N]; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, @@ -2055,7 +4377,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, + { ::zerocopy::ident_id!(e) }, >>::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2092,7 +4414,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, + { ::zerocopy::ident_id!(5) }, >, >() .as_ptr() @@ -2116,15 +4438,54 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(b) }, + { ::zerocopy::ident_id!(e) }, + > for ComplexWithGenerics<'a, { N }, X, Y> + where + X: Deref, + { + fn only_derive_is_allowed_to_implement_this_trait() {} + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, + ); + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::zerocopy::ident_id!(StructLike) }, + { ::zerocopy::ident_id!(e) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2132,8 +4493,8 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, + ___ZcAliasing, + ___ZcAlignment, ::zerocopy::invariant::Initialized, ); } @@ -2150,6 +4511,66 @@ const _: () = { )] #[deny(ambiguous_associated_items)] #[automatically_derived] + const _: () = { + unsafe impl< + 'a: 'static, + X, + Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, + const N: usize, + > ::zerocopy::ProjectField< + ::zerocopy::TryFromBytesDerive, + (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = (); + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, + ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_StructLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } + } + }; + #[allow( + deprecated, + private_bounds, + non_local_definitions, + non_camel_case_types, + non_upper_case_globals, + non_snake_case, + non_ascii_idents, + clippy::missing_inline_in_public_items, + )] + #[deny(ambiguous_associated_items)] + #[automatically_derived] const _: () = { unsafe impl< 'a: 'static, @@ -2159,22 +4580,22 @@ const _: () = { > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(c) }, + { ::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 = X::Target; + type Type = bool; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2193,7 +4614,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, + { ::zerocopy::ident_id!(__field_TupleLike) }, >, >() .project::< @@ -2211,7 +4632,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, + { ::zerocopy::ident_id!(1) }, >, >() .as_ptr() @@ -2235,15 +4656,15 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(c) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::ident_id!(TupleLike) }, + { ::zerocopy::ident_id!(0) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2251,9 +4672,9 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; @@ -2274,67 +4695,26 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(d) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), + { ::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 = Y::Target; - #[inline(always)] - fn project( - slf: ::zerocopy::pointer::PtrInner<'_, Self>, - ) -> *mut >::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(4) }, - >, - >() - .as_ptr() - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -2354,26 +4734,47 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(d) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + { ::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 Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Error = (); type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_TupleLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; #[allow( @@ -2397,22 +4798,22 @@ const _: () = { > ::zerocopy::HasField< ::zerocopy::TryFromBytesDerive, (), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(e) }, + { ::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 = [(X, Y); N]; + type Type = Y; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, ) -> *mut >::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2431,7 +4832,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_StructLike) }, + { ::zerocopy::ident_id!(__field_TupleLike) }, >, >() .project::< @@ -2449,7 +4850,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(5) }, + { ::zerocopy::ident_id!(2) }, >, >() .as_ptr() @@ -2473,15 +4874,15 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), - { ::zerocopy::ident_id!(StructLike) }, - { ::zerocopy::ident_id!(e) }, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), + { ::zerocopy::ident_id!(TupleLike) }, + { ::zerocopy::ident_id!(1) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2489,9 +4890,9 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; @@ -2512,67 +4913,26 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(0) }, + { ::zerocopy::ident_id!(1) }, > 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 >::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(1) }, - >, - >() - .as_ptr() - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -2592,26 +4952,47 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(0) }, + { ::zerocopy::ident_id!(1) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Error = (); type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_TupleLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; #[allow( @@ -2636,13 +5017,13 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Type = Y; + type Type = PhantomData<&'a [(X, Y); N]>; #[inline(always)] fn project( slf: ::zerocopy::pointer::PtrInner<'_, Self>, @@ -2650,7 +5031,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, (), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(2) }, >>::Type { use ::zerocopy::pointer::cast::{CastSized, Projection}; slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() @@ -2687,7 +5068,7 @@ const _: () = { ::zerocopy::TryFromBytesDerive, _, { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(2) }, + { ::zerocopy::ident_id!(3) }, >, >() .as_ptr() @@ -2711,15 +5092,15 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Uninit), { ::zerocopy::ident_id!(TupleLike) }, - { ::zerocopy::ident_id!(1) }, + { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> where X: Deref, @@ -2727,9 +5108,9 @@ const _: () = { fn only_derive_is_allowed_to_implement_this_trait() {} type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Uninit, ); } }; @@ -2750,10 +5131,13 @@ const _: () = { 'a: 'static, X, Y: Deref, + ___ZcAliasing: ::zerocopy::invariant::Aliasing, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, - > ::zerocopy::HasField< + > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Initialized), { ::zerocopy::ident_id!(TupleLike) }, { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> @@ -2761,56 +5145,12 @@ const _: () = { 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 >::Type { - use ::zerocopy::pointer::cast::{CastSized, Projection}; - slf.project::<___ZerocopyRawEnum<'a, N, X, Y>, CastSized>() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(variants) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::REPR_C_UNION_VARIANT_ID }, - { ::zerocopy::ident_id!(__field_TupleLike) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(value) }, - >, - >() - .project::< - _, - Projection< - ::zerocopy::TryFromBytesDerive, - _, - { ::zerocopy::STRUCT_VARIANT_ID }, - { ::zerocopy::ident_id!(3) }, - >, - >() - .as_ptr() - } + type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Invariants = ( + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Initialized, + ); } }; #[allow( @@ -2830,13 +5170,13 @@ const _: () = { 'a: 'static, X, Y: Deref, - Aliasing: ::zerocopy::invariant::Aliasing, - Alignment: ::zerocopy::invariant::Alignment, + ___ZcAliasing: ::zerocopy::invariant::Reference, + ___ZcAlignment: ::zerocopy::invariant::Alignment, const N: usize, > ::zerocopy::ProjectField< ::zerocopy::TryFromBytesDerive, (), - (Aliasing, Alignment, ::zerocopy::invariant::Initialized), + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), { ::zerocopy::ident_id!(TupleLike) }, { ::zerocopy::ident_id!(2) }, > for ComplexWithGenerics<'a, { N }, X, Y> @@ -2844,12 +5184,33 @@ const _: () = { X: Deref, { fn only_derive_is_allowed_to_implement_this_trait() {} - type Error = ::zerocopy::util::macro_util::core_reexport::convert::Infallible; + type Error = (); type Invariants = ( - Aliasing, - Alignment, - ::zerocopy::invariant::Initialized, + ___ZcAliasing, + ___ZcAlignment, + ::zerocopy::invariant::Valid, ); + #[inline(always)] + fn is_projectable( + tag: ::zerocopy::pointer::Ptr< + '_, + >::Tag, + (___ZcAliasing, ___ZcAlignment, ::zerocopy::invariant::Valid), + >, + ) -> ::zerocopy::util::macro_util::core_reexport::result::Result< + (), + (), + > { + let tag = tag.read::<::zerocopy::BecauseImmutable>() + as ___ZerocopyTagPrimitive; + if tag == ___ZEROCOPY_TAG_TupleLike { + ::zerocopy::util::macro_util::core_reexport::result::Result::Ok(()) + } else { + ::zerocopy::util::macro_util::core_reexport::result::Result::Err(()) + } + } } }; let tag = { diff --git a/zerocopy/zerocopy-derive/src/output_tests/mod.rs b/zerocopy/zerocopy-derive/src/output_tests/mod.rs index 836eb6c0a8..4b913105b6 100644 --- a/zerocopy/zerocopy-derive/src/output_tests/mod.rs +++ b/zerocopy/zerocopy-derive/src/output_tests/mod.rs @@ -24,6 +24,7 @@ macro_rules! use_as_trait_name { use_as_trait_name!( KnownLayout => super::derive::known_layout::derive, Immutable => super::derive::derive_immutable, + Project => super::derive::project::derive, TryFromBytes => super::derive::try_from_bytes::derive_try_from_bytes, FromZeros => super::derive::from_bytes::derive_from_zeros, FromBytes => super::derive::from_bytes::derive_from_bytes, @@ -158,6 +159,26 @@ fn test_immutable() { } } +#[test] +fn test_project_empty_struct() { + test! { + Project { + struct Foo; + } expands to {} + } +} + +#[test] +fn test_project_struct() { + test! { + Project { + struct Foo { + field: u8, + } + } expands to "expected/project_struct.expected.rs" + } +} + #[test] fn test_try_from_bytes() { test! { diff --git a/zerocopy/zerocopy-derive/src/util.rs b/zerocopy/zerocopy-derive/src/util.rs index a73af25e74..fd46d5373b 100644 --- a/zerocopy/zerocopy-derive/src/util.rs +++ b/zerocopy/zerocopy-derive/src/util.rs @@ -298,14 +298,16 @@ impl PaddingCheck { } } -#[derive(Clone)] +#[derive(Copy, Clone)] pub(crate) enum Client { + ProjectDerive, TryFromBytesDerive, } impl ToTokens for Client { fn to_tokens(&self, tokens: &mut TokenStream) { let s = match self { + Client::ProjectDerive => "ProjectDerive", Client::TryFromBytesDerive => "TryFromBytesDerive", }; let ident = Ident::new(s, Span::call_site()); @@ -340,6 +342,7 @@ pub(crate) enum Trait { invariants: Box, }, Immutable, + Project, TryFromBytes, FromZeros, FromBytes, @@ -368,6 +371,7 @@ impl ToTokens for Trait { Trait::KnownLayout => "KnownLayout", Trait::HasTag { .. } => "HasTag", Trait::Immutable => "Immutable", + Trait::Project => "Project", Trait::TryFromBytes => "TryFromBytes", Trait::FromZeros => "FromZeros", Trait::FromBytes => "FromBytes", @@ -389,6 +393,7 @@ impl ToTokens for Trait { } Trait::KnownLayout | Trait::Immutable + | Trait::Project | Trait::TryFromBytes | Trait::FromZeros | Trait::FromBytes @@ -825,6 +830,7 @@ pub(crate) fn generate_tag_enum(ctx: &Ctx, repr: &EnumRepr, data: &DataEnum) -> quote! { #repr #[allow(dead_code)] + #[derive(Copy, Clone)] pub enum ___ZerocopyTag { #(#variants,)* } diff --git a/zerocopy/zerocopy-derive/tests/project.rs b/zerocopy/zerocopy-derive/tests/project.rs new file mode 100644 index 0000000000..8dee8061d6 --- /dev/null +++ b/zerocopy/zerocopy-derive/tests/project.rs @@ -0,0 +1,359 @@ +// Copyright 2026 The Fuchsia Authors +// +// Licensed under a BSD-style license , Apache License, Version 2.0 +// , or the MIT +// license , at your option. +// This file may not be copied, modified, or distributed except according to +// those terms. + +// See comment in `include.rs` for why we disable the prelude. +#![no_implicit_prelude] +#![allow(warnings)] + +include!("include.rs"); + +type SharedAligned = (imp::invariant::Shared, imp::invariant::Aligned, V); +type SharedUnaligned = (imp::invariant::Shared, imp::invariant::Unaligned, V); + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +struct Named { + byte: u8, + word: u16, +} + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +struct Tuple(u8, u16); + +#[test] +fn struct_fields() { + let named = Named { byte: 1, word: 0x0203 }; + let word: imp::core::result::Result< + imp::Ptr<'_, u16, SharedAligned>, + imp::core::convert::Infallible, + > = imp::Ptr::from_ref(&named) + .project::(); + imp::assert_eq!(*word.unwrap().as_ref(), 0x0203); + + let tuple = Tuple(4, 0x0506); + let field: imp::core::result::Result< + imp::Ptr<'_, u16, SharedAligned>, + imp::core::convert::Infallible, + > = imp::Ptr::from_ref(&tuple) + .project::(); + imp::assert_eq!(*field.unwrap().as_ref(), 0x0506); +} + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +#[repr(C)] +struct NoPadding { + first: u8, + second: u8, +} + +#[test] +fn struct_validity_is_preserved() { + let value = NoPadding { first: 7, second: 8 }; + + // SAFETY: `Uninit` permits every bit pattern. + let uninit = unsafe { imp::Ptr::from_ref(&value).assume_validity::() }; + let projected: imp::core::result::Result< + imp::Ptr<'_, u8, SharedAligned>, + imp::core::convert::Infallible, + > = uninit + .project::(); + imp::assert!(projected.is_ok()); + + // SAFETY: `NoPadding` consists of two `u8` fields and has no padding, so + // all of its bytes are initialized. + let initialized = unsafe { imp::Ptr::from_ref(&value).assume_initialized() }; + let projected: imp::core::result::Result< + imp::Ptr<'_, u8, SharedAligned>, + imp::core::convert::Infallible, + > = initialized + .project::(); + imp::assert!(projected.is_ok()); + + let projected: imp::core::result::Result< + imp::Ptr<'_, u8, SharedAligned>, + imp::core::convert::Infallible, + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert_eq!(*projected.unwrap().as_ref(), 8); +} + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +#[repr(C, packed)] +struct Packed { + byte: u8, + word: u32, +} + +#[test] +fn packed_struct_loses_alignment() { + let value = Packed { byte: 1, word: 0x0203_0405 }; + let projected: imp::core::result::Result< + imp::Ptr<'_, u32, SharedUnaligned>, + imp::core::convert::Infallible, + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert_eq!(projected.unwrap().read::(), 0x0203_0405); +} + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +#[repr(C)] +struct Unsized { + head: u8, + tail: T, +} + +fn project_unsized_tail( + value: imp::Ptr<'_, Unsized<[u8]>, SharedAligned>, +) -> imp::core::result::Result< + imp::Ptr<'_, [u8], SharedAligned>, + imp::core::convert::Infallible, +> { + value.project::() +} + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +#[repr(C)] +union Union { + unsigned: u32, + signed: i32, +} + +#[test] +fn union_uninit_and_initialized() { + let value = Union { unsigned: 0x0102_0304 }; + + // SAFETY: `Uninit` permits every bit pattern. + let uninit = unsafe { imp::Ptr::from_ref(&value).assume_validity::() }; + let projected: imp::core::result::Result< + imp::Ptr<'_, i32, SharedAligned>, + imp::core::convert::Infallible, + > = uninit + .project::(); + imp::assert!(projected.is_ok()); + + // SAFETY: `value` was initialized through its `u32` field, which occupies + // every byte of this union. + let initialized = unsafe { imp::Ptr::from_ref(&value).assume_initialized() }; + let projected: imp::core::result::Result< + imp::Ptr<'_, i32, SharedAligned>, + imp::core::convert::Infallible, + > = initialized + .project::(); + imp::assert!(projected.is_ok()); + + let projected: imp::core::result::Result< + imp::Ptr<'_, i32, SharedAligned>, + imp::core::convert::Infallible, + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert!(projected.is_ok()); +} + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +enum Fieldless { + A, + B, +} + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +#[repr(C)] +enum CEnum { + Number(u32), + Flag { value: u16 }, +} + +#[test] +fn repr_c_enum_checks_its_tag() { + let value = CEnum::Flag { value: 0x1234 }; + let projected: imp::core::result::Result< + imp::Ptr<'_, u16, SharedAligned>, + (), + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert_eq!(*projected.unwrap().as_ref(), 0x1234); + + let wrong_variant: imp::core::result::Result< + imp::Ptr<'_, u32, SharedAligned>, + (), + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert!(wrong_variant.is_err()); +} + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +#[repr(u8)] +enum U8Enum { + A(u8), + B(u8), +} + +#[test] +fn repr_u8_enum_validity_and_tag_checks() { + let value = U8Enum::A(11); + + let projected: imp::core::result::Result< + imp::Ptr<'_, u8, SharedAligned>, + (), + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert_eq!(*projected.unwrap().as_ref(), 11); + + let wrong_variant: imp::core::result::Result< + imp::Ptr<'_, u8, SharedAligned>, + (), + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert!(wrong_variant.is_err()); + + // SAFETY: `Uninit` permits every bit pattern. Unlike a `Valid` + // projection, this projection must not inspect the tag. + let uninit = unsafe { imp::Ptr::from_ref(&value).assume_validity::() }; + let wrong_variant: imp::core::result::Result< + imp::Ptr<'_, u8, SharedAligned>, + imp::core::convert::Infallible, + > = uninit.project::(); + imp::assert!(wrong_variant.is_ok()); + + imp::assert_eq!(imp::core::mem::size_of::(), 2); + // SAFETY: The primitive tag and the `A` variant's `u8` field occupy both + // bytes of `value`, with no padding. + let initialized = unsafe { imp::Ptr::from_ref(&value).assume_initialized() }; + let wrong_variant: imp::core::result::Result< + imp::Ptr<'_, u8, SharedAligned>, + imp::core::convert::Infallible, + > = initialized + .project::(); + imp::assert!(wrong_variant.is_ok()); +} + +// Projection must not add zerocopy trait bounds to field types. +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +struct Generic { + first: T, + second: U, +} + +#[test] +fn generic_fields_need_no_zerocopy_bounds() { + let value = Generic { first: util::NotZerocopy(1u8), second: util::NotZerocopy(0x0203u16) }; + let projected: imp::core::result::Result< + imp::Ptr<'_, util::NotZerocopy, SharedAligned>, + imp::core::convert::Infallible, + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert_eq!(projected.unwrap().as_ref().0, 0x0203); +} + +#[derive(imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +#[repr(u8)] +enum GenericEnum<'a, T, const N: usize> { + Borrowed(&'a T), + Array([T; N]), +} + +#[test] +fn generic_enum_fields_need_no_zerocopy_bounds() { + let inner = util::NotZerocopy(0x1234u16); + let value: GenericEnum<'_, util::NotZerocopy, 2> = GenericEnum::Borrowed(&inner); + let projected: imp::core::result::Result< + imp::Ptr<'_, &util::NotZerocopy, SharedAligned>, + (), + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert_eq!((**projected.unwrap().as_ref()).0, 0x1234); +} + +mod visibility { + #[derive(super::imp::Project)] + #[zerocopy(crate = "zerocopy_renamed")] + pub struct Public { + pub field: u16, + private: u8, + } + + pub fn new() -> Public { + Public { field: 0x1234, private: 0 } + } +} + +#[test] +fn public_marker_is_inferred_across_module_boundary() { + let value = visibility::new(); + let projected: imp::core::result::Result< + imp::Ptr<'_, u16, SharedAligned>, + imp::core::convert::Infallible, + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert_eq!(*projected.unwrap().as_ref(), 0x1234); +} + +#[derive(imp::Project, imp::TryFromBytes)] +#[zerocopy(crate = "zerocopy_renamed")] +struct ProjectThenTryFromBytes { + field: u8, +} + +#[derive(imp::TryFromBytes, imp::Project)] +#[zerocopy(crate = "zerocopy_renamed")] +#[repr(C)] +union TryFromBytesThenProject { + field: u8, +} + +#[derive(imp::Project, imp::TryFromBytes)] +#[zerocopy(crate = "zerocopy_renamed")] +#[repr(u8)] +enum ProjectAndTryFromBytes { + A(u8), + B { field: bool }, +} + +fn assert_try_from_bytes() {} + +#[test] +fn project_and_try_from_bytes_impls_coexist() { + assert_try_from_bytes::(); + assert_try_from_bytes::(); + assert_try_from_bytes::(); + + let value = ProjectThenTryFromBytes { field: 42 }; + let projected: imp::core::result::Result< + imp::Ptr<'_, u8, SharedAligned>, + imp::core::convert::Infallible, + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert_eq!(*projected.unwrap().as_ref(), 42); + + let value = TryFromBytesThenProject { field: 43 }; + // SAFETY: `Uninit` permits every bit pattern. + let value = unsafe { imp::Ptr::from_ref(&value).assume_validity::() }; + let projected: imp::core::result::Result< + imp::Ptr<'_, u8, SharedAligned>, + imp::core::convert::Infallible, + > = value + .project::(); + imp::assert!(projected.is_ok()); + + let value = ProjectAndTryFromBytes::B { field: true }; + let projected: imp::core::result::Result< + imp::Ptr<'_, bool, SharedAligned>, + (), + > = imp::Ptr::from_ref(&value) + .project::(); + imp::assert!(*projected.unwrap().as_ref()); +}