Skip to main content

rustc_public/
abi.rs

1use std::fmt::{self, Debug};
2use std::num::NonZero;
3use std::ops::RangeInclusive;
4
5use serde::Serialize;
6
7use crate::compiler_interface::with;
8use crate::mir::FieldIdx;
9use crate::target::{MachineInfo, MachineSize as Size};
10use crate::ty::{Align, Ty, VariantIdx, index_impl};
11use crate::{Error, ThreadLocalIndex, error};
12
13/// A function ABI definition.
14#[derive(#[automatically_derived]
impl ::core::clone::Clone for FnAbi {
    #[inline]
    fn clone(&self) -> Self {
        FnAbi {
            args: ::core::clone::Clone::clone(&self.args),
            ret: ::core::clone::Clone::clone(&self.ret),
            fixed_count: ::core::clone::Clone::clone(&self.fixed_count),
            conv: ::core::clone::Clone::clone(&self.conv),
            c_variadic: ::core::clone::Clone::clone(&self.c_variadic),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for FnAbi {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "FnAbi", "args",
            &self.args, "ret", &self.ret, "fixed_count", &self.fixed_count,
            "conv", &self.conv, "c_variadic", &&self.c_variadic)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FnAbi { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FnAbi {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.fixed_count == other.fixed_count &&
                        self.c_variadic == other.c_variadic &&
                    self.args == other.args && self.ret == other.ret &&
            self.conv == other.conv
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FnAbi {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Vec<ArgAbi>>;
        let _: ::core::cmp::AssertParamIsEq<ArgAbi>;
        let _: ::core::cmp::AssertParamIsEq<u32>;
        let _: ::core::cmp::AssertParamIsEq<CallConvention>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for FnAbi {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.args, state);
        ::core::hash::Hash::hash(&self.ret, state);
        ::core::hash::Hash::hash(&self.fixed_count, state);
        ::core::hash::Hash::hash(&self.conv, state);
        ::core::hash::Hash::hash(&self.c_variadic, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for FnAbi {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer, "FnAbi",
                            false as usize + 1 + 1 + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "args", &self.args)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "ret", &self.ret)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "fixed_count", &self.fixed_count)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "conv", &self.conv)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "c_variadic", &self.c_variadic)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
15pub struct FnAbi {
16    /// The types of each argument.
17    pub args: Vec<ArgAbi>,
18
19    /// The expected return type.
20    pub ret: ArgAbi,
21
22    /// The count of declared arguments (excluding variadic and implicit arguments).
23    ///
24    /// This may be less than `args.len()` for C variadic functions (which have
25    /// additional variadic arguments) or `#[track_caller]` functions (which have
26    /// an implicit caller location argument).
27    pub fixed_count: u32,
28
29    /// The ABI convention.
30    pub conv: CallConvention,
31
32    /// Whether this is a variadic C function,
33    pub c_variadic: bool,
34}
35
36/// Information about the ABI of a function's argument, or return value.
37#[derive(#[automatically_derived]
impl ::core::clone::Clone for ArgAbi {
    #[inline]
    fn clone(&self) -> Self {
        ArgAbi {
            ty: ::core::clone::Clone::clone(&self.ty),
            layout: ::core::clone::Clone::clone(&self.layout),
            mode: ::core::clone::Clone::clone(&self.mode),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ArgAbi {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "ArgAbi", "ty",
            &self.ty, "layout", &self.layout, "mode", &&self.mode)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for ArgAbi { }
#[automatically_derived]
impl ::core::cmp::PartialEq for ArgAbi {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.ty == other.ty && self.layout == other.layout &&
            self.mode == other.mode
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ArgAbi {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Ty>;
        let _: ::core::cmp::AssertParamIsEq<Layout>;
        let _: ::core::cmp::AssertParamIsEq<PassMode>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for ArgAbi {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.ty, state);
        ::core::hash::Hash::hash(&self.layout, state);
        ::core::hash::Hash::hash(&self.mode, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for ArgAbi {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer, "ArgAbi",
                            false as usize + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "ty", &self.ty)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "layout", &self.layout)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "mode", &self.mode)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
38pub struct ArgAbi {
39    pub ty: Ty,
40    pub layout: Layout,
41    pub mode: PassMode,
42}
43
44/// Different modes in which indirect arguments can be passed.
45#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for IndirectMode { }
#[automatically_derived]
impl ::core::clone::Clone for IndirectMode {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for IndirectMode { }Copy, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for IndirectMode { }
#[automatically_derived]
impl ::core::cmp::PartialEq for IndirectMode {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for IndirectMode { }Eq, #[automatically_derived]
impl ::core::hash::Hash for IndirectMode {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state)
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for IndirectMode {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                IndirectMode::Pointer => "Pointer",
                IndirectMode::OnStack => "OnStack",
                IndirectMode::AmdgpuKernelArg => "AmdgpuKernelArg",
            })
    }
}Debug, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for IndirectMode {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    IndirectMode::Pointer =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "IndirectMode", 0u32, "Pointer"),
                    IndirectMode::OnStack =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "IndirectMode", 1u32, "OnStack"),
                    IndirectMode::AmdgpuKernelArg =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "IndirectMode", 2u32, "AmdgpuKernelArg"),
                }
            }
        }
    };Serialize)]
46pub enum IndirectMode {
47    /// Passed as a normal pointer, nothing special.
48    Pointer,
49    /// The value is placed at a fixed stack offset rather than passed as a regular pointer
50    /// argument.
51    OnStack,
52    /// Similar to `OnStack` except that the pointer does not necessarily point to the stack, no
53    /// extra copy is made, and the passed argument should not be modified.
54    AmdgpuKernelArg,
55}
56
57/// How a function argument should be passed in to the target function.
58///
59/// The pass mode is determined by the platform's calling convention and the
60/// argument's type layout. The same Rust type may use different pass modes
61/// on different targets or when register availability changes.
62///
63/// Note: for the Rust ABI, pass modes may not correspond to any valid C
64/// calling convention (e.g., using more return registers than the platform
65/// C ABI allows). Further processing may be needed depending on the target.
66#[derive(#[automatically_derived]
impl ::core::clone::Clone for PassMode {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::Ignore => PassMode::Ignore,
            Self::Direct(__self_0) =>
                PassMode::Direct(::core::clone::Clone::clone(__self_0)),
            Self::Pair(__self_0, __self_1) =>
                PassMode::Pair(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            Self::Cast { pad_i32_count: __self_0, cast: __self_1 } =>
                PassMode::Cast {
                    pad_i32_count: ::core::clone::Clone::clone(__self_0),
                    cast: ::core::clone::Clone::clone(__self_1),
                },
            Self::Indirect {
                attrs: __self_0, address_space: __self_1, mode: __self_2 } =>
                PassMode::Indirect {
                    attrs: ::core::clone::Clone::clone(__self_0),
                    address_space: ::core::clone::Clone::clone(__self_1),
                    mode: ::core::clone::Clone::clone(__self_2),
                },
            Self::IndirectUnsized { attrs: __self_0, meta_attrs: __self_1 } =>
                PassMode::IndirectUnsized {
                    attrs: ::core::clone::Clone::clone(__self_0),
                    meta_attrs: ::core::clone::Clone::clone(__self_1),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for PassMode {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Ignore => ::core::fmt::Formatter::write_str(f, "Ignore"),
            Self::Direct(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Direct",
                    &__self_0),
            Self::Pair(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Pair",
                    __self_0, &__self_1),
            Self::Cast { pad_i32_count: __self_0, cast: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Cast",
                    "pad_i32_count", __self_0, "cast", &__self_1),
            Self::Indirect {
                attrs: __self_0, address_space: __self_1, mode: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "Indirect", "attrs", __self_0, "address_space", __self_1,
                    "mode", &__self_2),
            Self::IndirectUnsized { attrs: __self_0, meta_attrs: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "IndirectUnsized", "attrs", __self_0, "meta_attrs",
                    &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for PassMode { }
#[automatically_derived]
impl ::core::cmp::PartialEq for PassMode {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Direct(__self_0), Self::Direct(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::Pair(__self_0, __self_1),
                    Self::Pair(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (Self::Cast { pad_i32_count: __self_0, cast: __self_1 },
                    Self::Cast { pad_i32_count: __arg1_0, cast: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (Self::Indirect {
                    attrs: __self_0, address_space: __self_1, mode: __self_2 },
                    Self::Indirect {
                    attrs: __arg1_0, address_space: __arg1_1, mode: __arg1_2 })
                    =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (Self::IndirectUnsized { attrs: __self_0, meta_attrs: __self_1
                    }, Self::IndirectUnsized {
                    attrs: __arg1_0, meta_attrs: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for PassMode {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<ArgAttributes>;
        let _: ::core::cmp::AssertParamIsEq<u8>;
        let _: ::core::cmp::AssertParamIsEq<CastTarget>;
        let _: ::core::cmp::AssertParamIsEq<Option<AddressSpace>>;
        let _: ::core::cmp::AssertParamIsEq<IndirectMode>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for PassMode {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::Direct(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::Pair(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Self::Cast { pad_i32_count: __self_0, cast: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Self::Indirect {
                attrs: __self_0, address_space: __self_1, mode: __self_2 } =>
                {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            Self::IndirectUnsized { attrs: __self_0, meta_attrs: __self_1 } =>
                {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            _ => {}
        }
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for PassMode {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    PassMode::Ignore =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "PassMode", 0u32, "Ignore"),
                    PassMode::Direct(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "PassMode", 1u32, "Direct", __field0),
                    PassMode::Pair(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "PassMode", 2u32, "Pair", 0 + 1 + 1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field0)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field1)?;
                        _serde::ser::SerializeTupleVariant::end(__serde_state)
                    }
                    PassMode::Cast { ref pad_i32_count, ref cast } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "PassMode", 3u32, "Cast", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "pad_i32_count", pad_i32_count)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "cast", cast)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    PassMode::Indirect { ref attrs, ref address_space, ref mode
                        } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "PassMode", 4u32, "Indirect", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "attrs", attrs)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "address_space", address_space)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "mode", mode)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    PassMode::IndirectUnsized { ref attrs, ref meta_attrs } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "PassMode", 5u32, "IndirectUnsized", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "attrs", attrs)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "meta_attrs", meta_attrs)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
67pub enum PassMode {
68    /// Ignore the argument.
69    ///
70    /// The argument is either uninhabited or a ZST (zero-sized type).
71    Ignore,
72    /// Pass the argument directly in a single register.
73    ///
74    /// Used for primitive types and small values that fit in one register.
75    Direct(ArgAttributes),
76    /// Pass the argument directly in two registers.
77    ///
78    /// Used for types represented as a pair of values (e.g., a fat pointer
79    /// consisting of a data pointer and a length/vtable pointer).
80    Pair(ArgAttributes, ArgAttributes),
81    /// Pass the argument after reinterpreting it as a different register layout.
82    ///
83    /// Used for aggregates (structs, tuples) that the platform ABI passes in
84    /// registers. The argument's bytes are reinterpreted as the register
85    /// sequence described by [`CastTarget`]. See its documentation for details.
86    Cast { pad_i32_count: u8, cast: CastTarget },
87    /// Pass the argument indirectly via a pointer.
88    ///
89    /// The caller places the value in memory and depending on mode passes a
90    /// pointer to it, stores it at a fixed stack offset or stores it at a
91    /// fixed location in a different address space.
92    Indirect { attrs: ArgAttributes, address_space: Option<AddressSpace>, mode: IndirectMode },
93    /// Pass the unsized argument indirectly via a hidden pointer.
94    ///
95    /// The caller places the value in memory and passes a pointer to it.
96    IndirectUnsized {
97        attrs: ArgAttributes,
98        /// Attributes for the metadata pointer (vtable or length) of unsized arguments.
99        meta_attrs: ArgAttributes,
100    },
101}
102
103/// Attributes of a function argument or return value.
104#[derive(#[automatically_derived]
impl ::core::clone::Clone for ArgAttributes {
    #[inline]
    fn clone(&self) -> Self {
        ArgAttributes {
            regular: ::core::clone::Clone::clone(&self.regular),
            arg_ext: ::core::clone::Clone::clone(&self.arg_ext),
            pointee_size: ::core::clone::Clone::clone(&self.pointee_size),
            pointee_align: ::core::clone::Clone::clone(&self.pointee_align),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ArgAttributes {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "ArgAttributes",
            "regular", &self.regular, "arg_ext", &self.arg_ext,
            "pointee_size", &self.pointee_size, "pointee_align",
            &&self.pointee_align)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for ArgAttributes { }
#[automatically_derived]
impl ::core::cmp::PartialEq for ArgAttributes {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.regular == other.regular && self.arg_ext == other.arg_ext &&
                self.pointee_size == other.pointee_size &&
            self.pointee_align == other.pointee_align
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ArgAttributes {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<ArgAttributeFlags>;
        let _: ::core::cmp::AssertParamIsEq<ArgExtension>;
        let _: ::core::cmp::AssertParamIsEq<Size>;
        let _: ::core::cmp::AssertParamIsEq<Option<Align>>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for ArgAttributes {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.regular, state);
        ::core::hash::Hash::hash(&self.arg_ext, state);
        ::core::hash::Hash::hash(&self.pointee_size, state);
        ::core::hash::Hash::hash(&self.pointee_align, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for ArgAttributes {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "ArgAttributes", false as usize + 1 + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "regular", &self.regular)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "arg_ext", &self.arg_ext)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "pointee_size", &self.pointee_size)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "pointee_align", &self.pointee_align)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
105pub struct ArgAttributes {
106    pub(crate) regular: ArgAttributeFlags,
107    pub(crate) arg_ext: ArgExtension,
108    pub(crate) pointee_size: Size,
109    pub(crate) pointee_align: Option<Align>,
110}
111
112impl ArgAttributes {
113    /// Return the calling convention and optimization flags for this argument.
114    pub fn regular(&self) -> ArgAttributeFlags {
115        self.regular
116    }
117
118    /// Return how this argument should be extended when passed in a register.
119    ///
120    /// Relevant for integer arguments smaller than the register width.
121    pub fn arg_extension(&self) -> ArgExtension {
122        self.arg_ext
123    }
124
125    /// Return the minimum alignment of the pointee, if applicable.
126    ///
127    /// This is relevant for `PassMode::Indirect` arguments where the pointer
128    /// must satisfy a particular alignment.
129    pub fn pointee_align(&self) -> Option<Align> {
130        self.pointee_align
131    }
132
133    /// Return the minimum dereferenceable size of the pointee, if it is non-null,
134    /// at function entry (for arguments) or return (for return values).
135    ///
136    /// This alone does not guarantee dereferenceability for the duration of the call.
137    pub fn pointee_size(&self) -> Size {
138        self.pointee_size
139    }
140}
141
142/// Calling convention and optimization flags for a function argument or return value.
143///
144/// The capture flags overlap: `captures_none` implies `captures_address`, which
145/// implies `captures_read_only`.
146#[non_exhaustive]
147#[derive(#[automatically_derived]
impl ::core::marker::Copy for ArgAttributeFlags { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ArgAttributeFlags { }
#[automatically_derived]
impl ::core::clone::Clone for ArgAttributeFlags {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ArgAttributeFlags {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["captures_none", "captures_address", "captures_read_only",
                        "no_alias", "non_null", "read_only", "in_reg", "no_undef",
                        "writable", "no_free"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.captures_none, &self.captures_address,
                        &self.captures_read_only, &self.no_alias, &self.non_null,
                        &self.read_only, &self.in_reg, &self.no_undef,
                        &self.writable, &&self.no_free];
        ::core::fmt::Formatter::debug_struct_fields_finish(f,
            "ArgAttributeFlags", names, values)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for ArgAttributeFlags { }
#[automatically_derived]
impl ::core::cmp::PartialEq for ArgAttributeFlags {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.captures_none == other.captures_none &&
                                            self.captures_address == other.captures_address &&
                                        self.captures_read_only == other.captures_read_only &&
                                    self.no_alias == other.no_alias &&
                                self.non_null == other.non_null &&
                            self.read_only == other.read_only &&
                        self.in_reg == other.in_reg &&
                    self.no_undef == other.no_undef &&
                self.writable == other.writable &&
            self.no_free == other.no_free
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ArgAttributeFlags {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for ArgAttributeFlags {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.captures_none, state);
        ::core::hash::Hash::hash(&self.captures_address, state);
        ::core::hash::Hash::hash(&self.captures_read_only, state);
        ::core::hash::Hash::hash(&self.no_alias, state);
        ::core::hash::Hash::hash(&self.non_null, state);
        ::core::hash::Hash::hash(&self.read_only, state);
        ::core::hash::Hash::hash(&self.in_reg, state);
        ::core::hash::Hash::hash(&self.no_undef, state);
        ::core::hash::Hash::hash(&self.writable, state);
        ::core::hash::Hash::hash(&self.no_free, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for ArgAttributeFlags {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "ArgAttributeFlags",
                            false as usize + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "captures_none", &self.captures_none)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "captures_address", &self.captures_address)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "captures_read_only", &self.captures_read_only)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "no_alias", &self.no_alias)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "non_null", &self.non_null)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "read_only", &self.read_only)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "in_reg", &self.in_reg)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "no_undef", &self.no_undef)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "writable", &self.writable)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "no_free", &self.no_free)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
148pub struct ArgAttributeFlags {
149    pub captures_none: bool,
150    pub captures_address: bool,
151    pub captures_read_only: bool,
152    pub no_alias: bool,
153    pub non_null: bool,
154    pub read_only: bool,
155    pub in_reg: bool,
156    pub no_undef: bool,
157    pub writable: bool,
158    pub no_free: bool,
159}
160
161/// How a small integer argument should be extended to fill a register.
162#[derive(#[automatically_derived]
impl ::core::marker::Copy for ArgExtension { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ArgExtension { }
#[automatically_derived]
impl ::core::clone::Clone for ArgExtension {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ArgExtension {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                ArgExtension::None => "None",
                ArgExtension::Zext => "Zext",
                ArgExtension::Sext => "Sext",
            })
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for ArgExtension { }
#[automatically_derived]
impl ::core::cmp::PartialEq for ArgExtension {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ArgExtension { }Eq, #[automatically_derived]
impl ::core::hash::Hash for ArgExtension {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for ArgExtension {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    ArgExtension::None =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "ArgExtension", 0u32, "None"),
                    ArgExtension::Zext =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "ArgExtension", 1u32, "Zext"),
                    ArgExtension::Sext =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "ArgExtension", 2u32, "Sext"),
                }
            }
        }
    };Serialize)]
163pub enum ArgExtension {
164    /// No extension required.
165    None,
166    /// Zero-extend to the register width.
167    Zext,
168    /// Sign-extend to the register width.
169    Sext,
170}
171
172/// Describes the ABI type that an argument is transmuted to for `PassMode::Cast`.
173///
174/// When an argument is "cast," its raw bytes are reinterpreted as a sequence of
175/// register-sized values for passing. This struct describes that target layout:
176///
177/// 1. The `prefix` registers are laid out first, like fields of a `repr(C)` struct
178///    (i.e., with alignment padding between them).
179/// 2. After the prefix, `rest.unit` is repeated enough times to cover `rest.total`,
180///    starting at `rest_offset` (or immediately after the prefix if `None`).
181///
182/// For example, on x86_64 a `struct { i32, f64 }` might be cast to a prefix of
183/// `[Reg::i64()]` followed by a rest of `Reg::f64()` — placing the first 8 bytes
184/// in an integer register and the second 8 bytes in a floating-point register.
185#[derive(#[automatically_derived]
impl ::core::clone::Clone for CastTarget {
    #[inline]
    fn clone(&self) -> Self {
        CastTarget {
            prefix: ::core::clone::Clone::clone(&self.prefix),
            rest_offset: ::core::clone::Clone::clone(&self.rest_offset),
            rest: ::core::clone::Clone::clone(&self.rest),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CastTarget {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "CastTarget",
            "prefix", &self.prefix, "rest_offset", &self.rest_offset, "rest",
            &&self.rest)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for CastTarget { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CastTarget {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.prefix == other.prefix && self.rest_offset == other.rest_offset
            && self.rest == other.rest
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CastTarget {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Vec<Reg>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Size>>;
        let _: ::core::cmp::AssertParamIsEq<Uniform>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for CastTarget {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.prefix, state);
        ::core::hash::Hash::hash(&self.rest_offset, state);
        ::core::hash::Hash::hash(&self.rest, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for CastTarget {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "CastTarget", false as usize + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "prefix", &self.prefix)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "rest_offset", &self.rest_offset)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "rest", &self.rest)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
186pub struct CastTarget {
187    /// Leading registers of potentially different types, laid out with `repr(C)` padding.
188    pub prefix: Vec<Reg>,
189    /// The byte offset where `rest` begins, if explicitly set.
190    /// When `None`, `rest` starts immediately after the prefix.
191    pub rest_offset: Option<Size>,
192    /// The repeated trailing register type filling the remainder of the value.
193    pub rest: Uniform,
194}
195
196impl CastTarget {
197    /// Return the total size of the ABI type this argument is cast to.
198    pub fn size(&self) -> Size {
199        let prefix_size: usize = self.prefix.iter().map(|r| r.size.bits()).sum();
200        Size::from_bits(prefix_size + self.rest.total.bits())
201    }
202}
203
204/// A sequence of registers of the same kind used to pass an argument.
205#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Uniform { }
#[automatically_derived]
impl ::core::clone::Clone for Uniform {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Reg>;
        let _: ::core::clone::AssertParamIsClone<Size>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Uniform { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for Uniform {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "Uniform",
            "unit", &self.unit, "total", &self.total, "is_consecutive",
            &&self.is_consecutive)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Uniform { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Uniform {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.is_consecutive == other.is_consecutive && self.unit == other.unit
            && self.total == other.total
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Uniform {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Reg>;
        let _: ::core::cmp::AssertParamIsEq<Size>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for Uniform {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.unit, state);
        ::core::hash::Hash::hash(&self.total, state);
        ::core::hash::Hash::hash(&self.is_consecutive, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for Uniform {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "Uniform", false as usize + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "unit", &self.unit)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "total", &self.total)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "is_consecutive", &self.is_consecutive)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
206pub struct Uniform {
207    /// The type of register used.
208    pub unit: Reg,
209    /// The total size of the argument, which can be:
210    /// * equal to `unit.size` (one scalar/vector),
211    /// * a multiple of `unit.size` (an array of scalar/vectors),
212    /// * if `unit.kind` is `Integer`, the last element can be shorter, i.e., `{ i64, i64, i32 }`
213    ///   for 64-bit integers with a total size of 20 bytes. When the argument is actually passed,
214    ///   this size will be rounded up to the nearest multiple of `unit.size`.
215    pub total: Size,
216    /// Whether the argument is consecutive: either all values are passed in registers, or all on
217    /// the stack with no additional padding between elements.
218    pub is_consecutive: bool,
219}
220
221impl Uniform {
222    /// Return the number of registers needed to cover `total`.
223    pub fn reg_count(&self) -> usize {
224        if self.unit.size.bits() == 0 {
225            return 0;
226        }
227        (self.total.bits() + self.unit.size.bits() - 1) / self.unit.size.bits()
228    }
229}
230
231/// A register type used in ABI calling conventions.
232#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Reg { }
#[automatically_derived]
impl ::core::clone::Clone for Reg {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<RegKind>;
        let _: ::core::clone::AssertParamIsClone<Size>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Reg { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for Reg {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "Reg", "kind",
            &self.kind, "size", &&self.size)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Reg { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Reg {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.kind == other.kind && self.size == other.size
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Reg {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<RegKind>;
        let _: ::core::cmp::AssertParamIsEq<Size>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for Reg {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.kind, state);
        ::core::hash::Hash::hash(&self.size, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for Reg {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer, "Reg",
                            false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "kind", &self.kind)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "size", &self.size)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
233pub struct Reg {
234    pub kind: RegKind,
235    pub size: Size,
236}
237
238/// The kind of a register used in calling conventions.
239#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for RegKind { }
#[automatically_derived]
impl ::core::clone::Clone for RegKind {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for RegKind { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for RegKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                RegKind::Integer => "Integer",
                RegKind::Float => "Float",
                RegKind::Vector => "Vector",
            })
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for RegKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for RegKind {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for RegKind { }Eq, #[automatically_derived]
impl ::core::hash::Hash for RegKind {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for RegKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    RegKind::Integer =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "RegKind", 0u32, "Integer"),
                    RegKind::Float =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "RegKind", 1u32, "Float"),
                    RegKind::Vector =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "RegKind", 2u32, "Vector"),
                }
            }
        }
    };Serialize)]
240pub enum RegKind {
241    Integer,
242    Float,
243    Vector,
244}
245
246/// The layout of a type, alongside the type itself.
247#[derive(#[automatically_derived]
impl ::core::marker::Copy for TyAndLayout { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for TyAndLayout { }
#[automatically_derived]
impl ::core::clone::Clone for TyAndLayout {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Ty>;
        let _: ::core::clone::AssertParamIsClone<Layout>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for TyAndLayout {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "TyAndLayout",
            "ty", &self.ty, "layout", &&self.layout)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for TyAndLayout { }
#[automatically_derived]
impl ::core::cmp::PartialEq for TyAndLayout {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.ty == other.ty && self.layout == other.layout
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for TyAndLayout {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Ty>;
        let _: ::core::cmp::AssertParamIsEq<Layout>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for TyAndLayout {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.ty, state);
        ::core::hash::Hash::hash(&self.layout, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for TyAndLayout {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "TyAndLayout", false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "ty", &self.ty)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "layout", &self.layout)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
248pub struct TyAndLayout {
249    pub ty: Ty,
250    pub layout: Layout,
251}
252
253/// The layout of a type, including its size, alignment, field offsets, and backend representation.
254#[derive(#[automatically_derived]
impl ::core::clone::Clone for LayoutShape {
    #[inline]
    fn clone(&self) -> Self {
        LayoutShape {
            fields: ::core::clone::Clone::clone(&self.fields),
            variants: ::core::clone::Clone::clone(&self.variants),
            value_repr: ::core::clone::Clone::clone(&self.value_repr),
            abi_align: ::core::clone::Clone::clone(&self.abi_align),
            size: ::core::clone::Clone::clone(&self.size),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for LayoutShape {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "LayoutShape",
            "fields", &self.fields, "variants", &self.variants, "value_repr",
            &self.value_repr, "abi_align", &self.abi_align, "size",
            &&self.size)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for LayoutShape { }
#[automatically_derived]
impl ::core::cmp::PartialEq for LayoutShape {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.fields == other.fields && self.variants == other.variants &&
                    self.value_repr == other.value_repr &&
                self.abi_align == other.abi_align && self.size == other.size
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for LayoutShape {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<FieldsShape>;
        let _: ::core::cmp::AssertParamIsEq<VariantsShape>;
        let _: ::core::cmp::AssertParamIsEq<ValueRepr>;
        let _: ::core::cmp::AssertParamIsEq<Align>;
        let _: ::core::cmp::AssertParamIsEq<Size>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for LayoutShape {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.fields, state);
        ::core::hash::Hash::hash(&self.variants, state);
        ::core::hash::Hash::hash(&self.value_repr, state);
        ::core::hash::Hash::hash(&self.abi_align, state);
        ::core::hash::Hash::hash(&self.size, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for LayoutShape {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "LayoutShape", false as usize + 1 + 1 + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "fields", &self.fields)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "variants", &self.variants)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "value_repr", &self.value_repr)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "abi_align", &self.abi_align)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "size", &self.size)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
255pub struct LayoutShape {
256    /// The fields location within the layout
257    pub fields: FieldsShape,
258
259    /// Encodes information about multi-variant layouts.
260    /// Even with `Multiple` variants, a layout still has its own fields! Those are then
261    /// shared between all variants.
262    ///
263    /// To access all fields of this layout, both `fields` and the fields of the active variant
264    /// must be taken into account.
265    pub variants: VariantsShape,
266
267    /// A hint for how backends should represent this type: as a scalar, vector, or aggregate.
268    pub value_repr: ValueRepr,
269
270    /// The ABI mandated alignment in bytes.
271    pub abi_align: Align,
272
273    /// The size of this layout in bytes.
274    pub size: Size,
275}
276
277impl LayoutShape {
278    /// Returns `true` if the layout corresponds to an unsized type.
279    #[inline]
280    pub fn is_unsized(&self) -> bool {
281        self.value_repr.is_unsized()
282    }
283
284    #[inline]
285    pub fn is_sized(&self) -> bool {
286        !self.value_repr.is_unsized()
287    }
288
289    /// Returns `true` if the type is sized and a 1-ZST (meaning it has size 0 and alignment 1).
290    pub fn is_1zst(&self) -> bool {
291        self.is_sized() && self.size.bits() == 0 && self.abi_align == 1
292    }
293}
294
295#[derive(#[automatically_derived]
impl ::core::marker::Copy for Layout { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Layout { }
#[automatically_derived]
impl ::core::clone::Clone for Layout {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<usize>;
        let _: ::core::clone::AssertParamIsClone<ThreadLocalIndex>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Layout {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Layout",
            &self.0, &&self.1)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Layout { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Layout {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0 && self.1 == other.1
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Layout {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<usize>;
        let _: ::core::cmp::AssertParamIsEq<ThreadLocalIndex>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for Layout {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.0, state);
        ::core::hash::Hash::hash(&self.1, state)
    }
}Hash)]
296pub struct Layout(usize, ThreadLocalIndex);
297impl crate::IndexedVal for Layout {
    fn to_val(index: usize) -> Self { Layout(index, crate::ThreadLocalIndex) }
    fn to_index(&self) -> usize { self.0 }
}
impl ::serde::Serialize for Layout {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
        S: ::serde::Serializer {
        let n: usize = self.0;
        ::serde::Serialize::serialize(&n, serializer)
    }
}index_impl!(Layout);
298
299impl Layout {
300    pub fn shape(self) -> LayoutShape {
301        with(|cx| cx.layout_shape(self))
302    }
303}
304
305/// Describes the number and position of fields within a type's layout.
306#[derive(#[automatically_derived]
impl ::core::clone::Clone for FieldsShape {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::Primitive => FieldsShape::Primitive,
            Self::Union(__self_0) =>
                FieldsShape::Union(::core::clone::Clone::clone(__self_0)),
            Self::Array { stride: __self_0, count: __self_1 } =>
                FieldsShape::Array {
                    stride: ::core::clone::Clone::clone(__self_0),
                    count: ::core::clone::Clone::clone(__self_1),
                },
            Self::Arbitrary { offsets: __self_0 } =>
                FieldsShape::Arbitrary {
                    offsets: ::core::clone::Clone::clone(__self_0),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for FieldsShape {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Primitive =>
                ::core::fmt::Formatter::write_str(f, "Primitive"),
            Self::Union(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Union",
                    &__self_0),
            Self::Array { stride: __self_0, count: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Array",
                    "stride", __self_0, "count", &__self_1),
            Self::Arbitrary { offsets: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Arbitrary", "offsets", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FieldsShape { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FieldsShape {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Union(__self_0), Self::Union(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::Array { stride: __self_0, count: __self_1 },
                    Self::Array { stride: __arg1_0, count: __arg1_1 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0,
                (Self::Arbitrary { offsets: __self_0 }, Self::Arbitrary {
                    offsets: __arg1_0 }) => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FieldsShape {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<NonZero<usize>>;
        let _: ::core::cmp::AssertParamIsEq<Size>;
        let _: ::core::cmp::AssertParamIsEq<u64>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Size>>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for FieldsShape {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::Union(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::Array { stride: __self_0, count: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Self::Arbitrary { offsets: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for FieldsShape {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    FieldsShape::Primitive =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FieldsShape", 0u32, "Primitive"),
                    FieldsShape::Union(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "FieldsShape", 1u32, "Union", __field0),
                    FieldsShape::Array { ref stride, ref count } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "FieldsShape", 2u32, "Array", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "stride", stride)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "count", count)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    FieldsShape::Arbitrary { ref offsets } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "FieldsShape", 3u32, "Arbitrary", 0 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "offsets", offsets)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
307pub enum FieldsShape {
308    /// Scalar primitives and `!`, which never have fields.
309    Primitive,
310
311    /// All fields start at no offset. The `usize` is the field count.
312    Union(NonZero<usize>),
313
314    /// Array/vector-like placement, with all fields of identical types.
315    Array { stride: Size, count: u64 },
316
317    /// Struct-like placement, with precomputed offsets.
318    ///
319    /// Fields are guaranteed to not overlap, but note that gaps
320    /// before, between and after all the fields are NOT always
321    /// padding, and as such their contents may not be discarded.
322    /// For example, enum variants leave a gap at the start,
323    /// where the discriminant field in the enum layout goes.
324    Arbitrary {
325        /// Offsets for the first byte of each field,
326        /// ordered to match the source definition order.
327        /// I.e.: It follows the same order as [super::ty::VariantDef::fields()].
328        /// This vector does not go in increasing order.
329        offsets: Vec<Size>,
330    },
331}
332
333impl FieldsShape {
334    pub fn fields_by_offset_order(&self) -> Vec<FieldIdx> {
335        match self {
336            FieldsShape::Primitive => ::alloc::vec::Vec::new()vec![],
337            FieldsShape::Union(_) | FieldsShape::Array { .. } => (0..self.count()).collect(),
338            FieldsShape::Arbitrary { offsets, .. } => {
339                let mut indices = (0..offsets.len()).collect::<Vec<_>>();
340                indices.sort_by_key(|idx| offsets[*idx]);
341                indices
342            }
343        }
344    }
345
346    pub fn count(&self) -> usize {
347        match self {
348            FieldsShape::Primitive => 0,
349            FieldsShape::Union(count) => count.get(),
350            FieldsShape::Array { count, .. } => *count as usize,
351            FieldsShape::Arbitrary { offsets, .. } => offsets.len(),
352        }
353    }
354}
355
356#[derive(#[automatically_derived]
impl ::core::clone::Clone for VariantsShape {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::Empty => VariantsShape::Empty,
            Self::Single { index: __self_0 } =>
                VariantsShape::Single {
                    index: ::core::clone::Clone::clone(__self_0),
                },
            Self::Multiple {
                tag: __self_0,
                tag_encoding: __self_1,
                tag_field: __self_2,
                variants: __self_3 } =>
                VariantsShape::Multiple {
                    tag: ::core::clone::Clone::clone(__self_0),
                    tag_encoding: ::core::clone::Clone::clone(__self_1),
                    tag_field: ::core::clone::Clone::clone(__self_2),
                    variants: ::core::clone::Clone::clone(__self_3),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for VariantsShape {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Empty => ::core::fmt::Formatter::write_str(f, "Empty"),
            Self::Single { index: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Single", "index", &__self_0),
            Self::Multiple {
                tag: __self_0,
                tag_encoding: __self_1,
                tag_field: __self_2,
                variants: __self_3 } =>
                ::core::fmt::Formatter::debug_struct_field4_finish(f,
                    "Multiple", "tag", __self_0, "tag_encoding", __self_1,
                    "tag_field", __self_2, "variants", &__self_3),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for VariantsShape { }
#[automatically_derived]
impl ::core::cmp::PartialEq for VariantsShape {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Single { index: __self_0 }, Self::Single {
                    index: __arg1_0 }) => __self_0 == __arg1_0,
                (Self::Multiple {
                    tag: __self_0,
                    tag_encoding: __self_1,
                    tag_field: __self_2,
                    variants: __self_3 }, Self::Multiple {
                    tag: __arg1_0,
                    tag_encoding: __arg1_1,
                    tag_field: __arg1_2,
                    variants: __arg1_3 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                            __self_2 == __arg1_2 && __self_3 == __arg1_3,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for VariantsShape {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<VariantIdx>;
        let _: ::core::cmp::AssertParamIsEq<Scalar>;
        let _: ::core::cmp::AssertParamIsEq<TagEncoding>;
        let _: ::core::cmp::AssertParamIsEq<usize>;
        let _: ::core::cmp::AssertParamIsEq<Vec<VariantFields>>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for VariantsShape {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::Single { index: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::Multiple {
                tag: __self_0,
                tag_encoding: __self_1,
                tag_field: __self_2,
                variants: __self_3 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state);
                ::core::hash::Hash::hash(__self_3, state)
            }
            _ => {}
        }
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for VariantsShape {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    VariantsShape::Empty =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "VariantsShape", 0u32, "Empty"),
                    VariantsShape::Single { ref index } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "VariantsShape", 1u32, "Single", 0 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "index", index)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    VariantsShape::Multiple {
                        ref tag, ref tag_encoding, ref tag_field, ref variants } =>
                        {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "VariantsShape", 2u32, "Multiple", 0 + 1 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "tag", tag)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "tag_encoding", tag_encoding)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "tag_field", tag_field)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "variants", variants)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
357pub enum VariantsShape {
358    /// A type with no valid variants. Must be uninhabited.
359    Empty,
360
361    /// Single enum variants, structs/tuples, unions, and all non-ADTs.
362    Single { index: VariantIdx },
363
364    /// Enum-likes with more than one inhabited variant: each variant comes with
365    /// a *discriminant* (usually the same as the variant index but the user can
366    /// assign explicit discriminant values). That discriminant is encoded
367    /// as a *tag* on the machine. The layout of each variant is
368    /// a struct, and they all have space reserved for the tag.
369    /// For enums, the tag is the sole field of the layout.
370    Multiple {
371        tag: Scalar,
372        tag_encoding: TagEncoding,
373        tag_field: usize,
374        variants: Vec<VariantFields>,
375    },
376}
377
378#[derive(#[automatically_derived]
impl ::core::clone::Clone for VariantFields {
    #[inline]
    fn clone(&self) -> Self {
        VariantFields { offsets: ::core::clone::Clone::clone(&self.offsets) }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for VariantFields {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "VariantFields",
            "offsets", &&self.offsets)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for VariantFields { }
#[automatically_derived]
impl ::core::cmp::PartialEq for VariantFields {
    #[inline]
    fn eq(&self, other: &Self) -> bool { self.offsets == other.offsets }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for VariantFields {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Vec<Size>>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for VariantFields {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.offsets, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for VariantFields {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "VariantFields", false as usize + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "offsets", &self.offsets)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
379pub struct VariantFields {
380    /// Offsets for the first byte of each field,
381    /// ordered to match the source definition order.
382    /// I.e.: It follows the same order as [super::ty::VariantDef::fields()].
383    /// This vector does not go in increasing order.
384    pub offsets: Vec<Size>,
385}
386
387impl VariantFields {
388    pub fn fields_by_offset_order(&self) -> Vec<FieldIdx> {
389        let mut indices = (0..self.offsets.len()).collect::<Vec<_>>();
390        indices.sort_by_key(|idx| self.offsets[*idx]);
391        indices
392    }
393}
394
395#[derive(#[automatically_derived]
impl ::core::clone::Clone for TagEncoding {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::Direct => TagEncoding::Direct,
            Self::Niche {
                untagged_variant: __self_0,
                niche_variants: __self_1,
                niche_start: __self_2 } =>
                TagEncoding::Niche {
                    untagged_variant: ::core::clone::Clone::clone(__self_0),
                    niche_variants: ::core::clone::Clone::clone(__self_1),
                    niche_start: ::core::clone::Clone::clone(__self_2),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for TagEncoding {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Direct => ::core::fmt::Formatter::write_str(f, "Direct"),
            Self::Niche {
                untagged_variant: __self_0,
                niche_variants: __self_1,
                niche_start: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f, "Niche",
                    "untagged_variant", __self_0, "niche_variants", __self_1,
                    "niche_start", &__self_2),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for TagEncoding { }
#[automatically_derived]
impl ::core::cmp::PartialEq for TagEncoding {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Niche {
                    untagged_variant: __self_0,
                    niche_variants: __self_1,
                    niche_start: __self_2 }, Self::Niche {
                    untagged_variant: __arg1_0,
                    niche_variants: __arg1_1,
                    niche_start: __arg1_2 }) =>
                    __self_2 == __arg1_2 && __self_0 == __arg1_0 &&
                        __self_1 == __arg1_1,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for TagEncoding {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<VariantIdx>;
        let _: ::core::cmp::AssertParamIsEq<RangeInclusive<VariantIdx>>;
        let _: ::core::cmp::AssertParamIsEq<u128>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for TagEncoding {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::Niche {
                untagged_variant: __self_0,
                niche_variants: __self_1,
                niche_start: __self_2 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            _ => {}
        }
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for TagEncoding {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    TagEncoding::Direct =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "TagEncoding", 0u32, "Direct"),
                    TagEncoding::Niche {
                        ref untagged_variant, ref niche_variants, ref niche_start }
                        => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "TagEncoding", 1u32, "Niche", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "untagged_variant", untagged_variant)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "niche_variants", niche_variants)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "niche_start", niche_start)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
396pub enum TagEncoding {
397    /// The tag directly stores the discriminant, but possibly with a smaller layout
398    /// (so converting the tag to the discriminant can require sign extension).
399    Direct,
400
401    /// Niche (values invalid for a type) encoding the discriminant:
402    /// Discriminant and variant index coincide.
403    /// The variant `untagged_variant` contains a niche at an arbitrary
404    /// offset (field `tag_field` of the enum), which for a variant with
405    /// discriminant `d` is set to
406    /// `(d - niche_variants.start).wrapping_add(niche_start)`.
407    ///
408    /// For example, `Option<(usize, &T)>`  is represented such that
409    /// `None` has a null pointer for the second tuple field, and
410    /// `Some` is the identity function (with a non-null reference).
411    Niche {
412        untagged_variant: VariantIdx,
413        niche_variants: RangeInclusive<VariantIdx>,
414        niche_start: u128,
415    },
416}
417
418/// The number of scalable vectors in a [`ValueRepr::ScalableVector`].
419#[derive(#[automatically_derived]
impl ::core::clone::Clone for NumScalableVectors {
    #[inline]
    fn clone(&self) -> Self {
        NumScalableVectors(::core::clone::Clone::clone(&self.0))
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for NumScalableVectors {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_tuple_field1_finish(f,
            "NumScalableVectors", &&self.0)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for NumScalableVectors { }
#[automatically_derived]
impl ::core::cmp::PartialEq for NumScalableVectors {
    #[inline]
    fn eq(&self, other: &Self) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for NumScalableVectors {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<u8>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for NumScalableVectors {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.0, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for NumScalableVectors {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                _serde::Serializer::serialize_newtype_struct(__serializer,
                    "NumScalableVectors", &self.0)
            }
        }
    };Serialize)]
420pub struct NumScalableVectors(pub(crate) u8);
421
422/// A hint for how backends should represent values of this type.
423///
424/// Distinguishes between types representable as scalars, pairs of scalars,
425/// SIMD vectors, or aggregates.
426#[derive(#[automatically_derived]
impl ::core::clone::Clone for ValueRepr {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::Scalar(__self_0) =>
                ValueRepr::Scalar(::core::clone::Clone::clone(__self_0)),
            Self::ScalarPair { a: __self_0, b: __self_1, b_offset: __self_2 }
                =>
                ValueRepr::ScalarPair {
                    a: ::core::clone::Clone::clone(__self_0),
                    b: ::core::clone::Clone::clone(__self_1),
                    b_offset: ::core::clone::Clone::clone(__self_2),
                },
            Self::Vector { element: __self_0, count: __self_1 } =>
                ValueRepr::Vector {
                    element: ::core::clone::Clone::clone(__self_0),
                    count: ::core::clone::Clone::clone(__self_1),
                },
            Self::ScalableVector {
                element: __self_0,
                count: __self_1,
                number_of_vectors: __self_2 } =>
                ValueRepr::ScalableVector {
                    element: ::core::clone::Clone::clone(__self_0),
                    count: ::core::clone::Clone::clone(__self_1),
                    number_of_vectors: ::core::clone::Clone::clone(__self_2),
                },
            Self::Aggregate { sized: __self_0 } =>
                ValueRepr::Aggregate {
                    sized: ::core::clone::Clone::clone(__self_0),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ValueRepr {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Scalar(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Scalar",
                    &__self_0),
            Self::ScalarPair { a: __self_0, b: __self_1, b_offset: __self_2 }
                =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "ScalarPair", "a", __self_0, "b", __self_1, "b_offset",
                    &__self_2),
            Self::Vector { element: __self_0, count: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "Vector", "element", __self_0, "count", &__self_1),
            Self::ScalableVector {
                element: __self_0,
                count: __self_1,
                number_of_vectors: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "ScalableVector", "element", __self_0, "count", __self_1,
                    "number_of_vectors", &__self_2),
            Self::Aggregate { sized: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Aggregate", "sized", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for ValueRepr { }
#[automatically_derived]
impl ::core::cmp::PartialEq for ValueRepr {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Scalar(__self_0), Self::Scalar(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::ScalarPair {
                    a: __self_0, b: __self_1, b_offset: __self_2 },
                    Self::ScalarPair {
                    a: __arg1_0, b: __arg1_1, b_offset: __arg1_2 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (Self::Vector { element: __self_0, count: __self_1 },
                    Self::Vector { element: __arg1_0, count: __arg1_1 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0,
                (Self::ScalableVector {
                    element: __self_0,
                    count: __self_1,
                    number_of_vectors: __self_2 }, Self::ScalableVector {
                    element: __arg1_0,
                    count: __arg1_1,
                    number_of_vectors: __arg1_2 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0 &&
                        __self_2 == __arg1_2,
                (Self::Aggregate { sized: __self_0 }, Self::Aggregate {
                    sized: __arg1_0 }) => __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ValueRepr {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Scalar>;
        let _: ::core::cmp::AssertParamIsEq<Size>;
        let _: ::core::cmp::AssertParamIsEq<u64>;
        let _: ::core::cmp::AssertParamIsEq<NumScalableVectors>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for ValueRepr {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::Scalar(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::ScalarPair { a: __self_0, b: __self_1, b_offset: __self_2 }
                => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            Self::Vector { element: __self_0, count: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Self::ScalableVector {
                element: __self_0,
                count: __self_1,
                number_of_vectors: __self_2 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            Self::Aggregate { sized: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
        }
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for ValueRepr {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    ValueRepr::Scalar(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "ValueRepr", 0u32, "Scalar", __field0),
                    ValueRepr::ScalarPair { ref a, ref b, ref b_offset } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "ValueRepr", 1u32, "ScalarPair", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "a", a)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "b", b)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "b_offset", b_offset)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    ValueRepr::Vector { ref element, ref count } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "ValueRepr", 2u32, "Vector", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "element", element)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "count", count)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    ValueRepr::ScalableVector {
                        ref element, ref count, ref number_of_vectors } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "ValueRepr", 3u32, "ScalableVector", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "element", element)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "count", count)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "number_of_vectors", number_of_vectors)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    ValueRepr::Aggregate { ref sized } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "ValueRepr", 4u32, "Aggregate", 0 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "sized", sized)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
427pub enum ValueRepr {
428    Scalar(Scalar),
429    ScalarPair {
430        a: Scalar,
431        b: Scalar,
432        b_offset: Size,
433    },
434    /// A fixed-length SIMD vector.
435    Vector {
436        element: Scalar,
437        count: u64,
438    },
439    /// A scalable SIMD vector (e.g., ARM SVE).
440    ScalableVector {
441        element: Scalar,
442        count: u64,
443        number_of_vectors: NumScalableVectors,
444    },
445    /// The type is not representable as a scalar or vector (e.g., aggregates, unsized types).
446    Aggregate {
447        /// If true, the size is exact, otherwise it's only a lower bound.
448        sized: bool,
449    },
450}
451
452impl ValueRepr {
453    /// Returns `true` if the layout corresponds to an unsized type.
454    pub fn is_unsized(&self) -> bool {
455        match *self {
456            ValueRepr::Scalar(_)
457            | ValueRepr::ScalarPair { .. }
458            | ValueRepr::Vector { .. }
459            // FIXME(rustc_scalable_vector): Scalable vectors are `Sized` while the
460            // `sized_hierarchy` feature is not yet fully implemented. After `sized_hierarchy` is
461            // fully implemented, scalable vectors will remain `Sized`, they just won't be
462            // `const Sized` - whether `is_unsized` continues to return `false` at that point will
463            // need to be revisited and will depend on what `is_unsized` is used for.
464            | ValueRepr::ScalableVector { .. } => false,
465            ValueRepr::Aggregate { sized } => !sized,
466        }
467    }
468}
469
470/// Information about one scalar component of a Rust type.
471#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Scalar { }
#[automatically_derived]
impl ::core::clone::Clone for Scalar {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Primitive>;
        let _: ::core::clone::AssertParamIsClone<WrappingRange>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Scalar { }Copy, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Scalar { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Scalar {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Initialized { value: __self_0, valid_range: __self_1 },
                    Self::Initialized { value: __arg1_0, valid_range: __arg1_1
                    }) => __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (Self::Union { value: __self_0 }, Self::Union {
                    value: __arg1_0 }) => __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Scalar {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Primitive>;
        let _: ::core::cmp::AssertParamIsEq<WrappingRange>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for Scalar {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::Initialized { value: __self_0, valid_range: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Self::Union { value: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
        }
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for Scalar {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Initialized { value: __self_0, valid_range: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "Initialized", "value", __self_0, "valid_range", &__self_1),
            Self::Union { value: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Union",
                    "value", &__self_0),
        }
    }
}Debug, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for Scalar {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    Scalar::Initialized { ref value, ref valid_range } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "Scalar", 0u32, "Initialized", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "value", value)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "valid_range", valid_range)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    Scalar::Union { ref value } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "Scalar", 1u32, "Union", 0 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "value", value)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
472pub enum Scalar {
473    Initialized {
474        /// The primitive type used to represent this value.
475        value: Primitive,
476        /// The range that represents valid values.
477        /// The range must be valid for the `primitive` size.
478        valid_range: WrappingRange,
479    },
480    Union {
481        /// Unions never have niches, so there is no `valid_range`.
482        /// The `Primitive` type is kept to inform the backend representation
483        /// and to compute the size of the scalar.
484        value: Primitive,
485    },
486}
487
488impl Scalar {
489    pub fn has_niche(&self, target: &MachineInfo) -> bool {
490        match self {
491            Scalar::Initialized { value, valid_range } => {
492                !valid_range.is_full(value.size(target)).unwrap()
493            }
494            Scalar::Union { .. } => false,
495        }
496    }
497}
498
499/// A primitive scalar type: integer, float, or pointer.
500#[derive(#[automatically_derived]
impl ::core::marker::Copy for Primitive { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Primitive { }
#[automatically_derived]
impl ::core::clone::Clone for Primitive {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<IntegerLength>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<FloatLength>;
        let _: ::core::clone::AssertParamIsClone<AddressSpace>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Primitive { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Primitive {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Int { length: __self_0, signed: __self_1 }, Self::Int {
                    length: __arg1_0, signed: __arg1_1 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0,
                (Self::Float { length: __self_0 }, Self::Float {
                    length: __arg1_0 }) => __self_0 == __arg1_0,
                (Self::Pointer(__self_0), Self::Pointer(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Primitive {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<IntegerLength>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<FloatLength>;
        let _: ::core::cmp::AssertParamIsEq<AddressSpace>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for Primitive {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::Int { length: __self_0, signed: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Self::Float { length: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::Pointer(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
        }
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for Primitive {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Int { length: __self_0, signed: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Int",
                    "length", __self_0, "signed", &__self_1),
            Self::Float { length: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Float",
                    "length", &__self_0),
            Self::Pointer(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Pointer", &__self_0),
        }
    }
}Debug, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for Primitive {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    Primitive::Int { ref length, ref signed } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "Primitive", 0u32, "Int", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "length", length)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "signed", signed)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    Primitive::Float { ref length } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "Primitive", 1u32, "Float", 0 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "length", length)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    Primitive::Pointer(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "Primitive", 2u32, "Pointer", __field0),
                }
            }
        }
    };Serialize)]
501pub enum Primitive {
502    /// An integer type with a given length and signedness.
503    ///
504    /// Signedness matters because some calling conventions require small integers
505    /// to be sign-extended or zero-extended when passed, and using the wrong
506    /// extension produces incorrect values in the callee.
507    Int { length: IntegerLength, signed: bool },
508    /// A floating-point type with a given length.
509    Float { length: FloatLength },
510    /// A pointer in the given address space.
511    Pointer(AddressSpace),
512}
513
514impl Primitive {
515    pub fn size(self, target: &MachineInfo) -> Size {
516        match self {
517            Primitive::Int { length, .. } => Size::from_bits(length.bits()),
518            Primitive::Float { length } => Size::from_bits(length.bits()),
519            Primitive::Pointer(_) => target.pointer_width,
520        }
521    }
522}
523
524/// Enum representing the existing integer lengths.
525#[derive(#[automatically_derived]
impl ::core::marker::Copy for IntegerLength { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for IntegerLength { }
#[automatically_derived]
impl ::core::clone::Clone for IntegerLength {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for IntegerLength { }
#[automatically_derived]
impl ::core::cmp::PartialEq for IntegerLength {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for IntegerLength { }Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for IntegerLength {
    #[inline]
    fn partial_cmp(&self, other: &Self)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for IntegerLength {
    #[inline]
    fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
        ::core::cmp::Ord::cmp(&::core::intrinsics::discriminant_value(self),
            &::core::intrinsics::discriminant_value(other))
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for IntegerLength {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state)
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for IntegerLength {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                IntegerLength::I8 => "I8",
                IntegerLength::I16 => "I16",
                IntegerLength::I32 => "I32",
                IntegerLength::I64 => "I64",
                IntegerLength::I128 => "I128",
            })
    }
}Debug, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for IntegerLength {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    IntegerLength::I8 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "IntegerLength", 0u32, "I8"),
                    IntegerLength::I16 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "IntegerLength", 1u32, "I16"),
                    IntegerLength::I32 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "IntegerLength", 2u32, "I32"),
                    IntegerLength::I64 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "IntegerLength", 3u32, "I64"),
                    IntegerLength::I128 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "IntegerLength", 4u32, "I128"),
                }
            }
        }
    };Serialize)]
526pub enum IntegerLength {
527    I8,
528    I16,
529    I32,
530    I64,
531    I128,
532}
533
534/// Enum representing the existing float lengths.
535#[derive(#[automatically_derived]
impl ::core::marker::Copy for FloatLength { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for FloatLength { }
#[automatically_derived]
impl ::core::clone::Clone for FloatLength {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FloatLength { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FloatLength {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FloatLength { }Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for FloatLength {
    #[inline]
    fn partial_cmp(&self, other: &Self)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for FloatLength {
    #[inline]
    fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
        ::core::cmp::Ord::cmp(&::core::intrinsics::discriminant_value(self),
            &::core::intrinsics::discriminant_value(other))
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for FloatLength {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state)
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for FloatLength {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                FloatLength::F16 => "F16",
                FloatLength::F16B => "F16B",
                FloatLength::F32 => "F32",
                FloatLength::F64 => "F64",
                FloatLength::F128 => "F128",
                FloatLength::PpcF128 => "PpcF128",
            })
    }
}Debug, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for FloatLength {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    FloatLength::F16 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FloatLength", 0u32, "F16"),
                    FloatLength::F16B =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FloatLength", 1u32, "F16B"),
                    FloatLength::F32 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FloatLength", 2u32, "F32"),
                    FloatLength::F64 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FloatLength", 3u32, "F64"),
                    FloatLength::F128 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FloatLength", 4u32, "F128"),
                    FloatLength::PpcF128 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FloatLength", 5u32, "PpcF128"),
                }
            }
        }
    };Serialize)]
536pub enum FloatLength {
537    F16,
538    F16B,
539    F32,
540    F64,
541    F128,
542    PpcF128,
543}
544
545impl IntegerLength {
546    pub fn bits(self) -> usize {
547        match self {
548            IntegerLength::I8 => 8,
549            IntegerLength::I16 => 16,
550            IntegerLength::I32 => 32,
551            IntegerLength::I64 => 64,
552            IntegerLength::I128 => 128,
553        }
554    }
555}
556
557impl FloatLength {
558    pub fn bits(self) -> usize {
559        match self {
560            FloatLength::F16 | FloatLength::F16B => 16,
561            FloatLength::F32 => 32,
562            FloatLength::F64 => 64,
563            FloatLength::F128 => 128,
564            FloatLength::PpcF128 => 128,
565        }
566    }
567}
568
569/// An identifier that specifies the address space that some operation
570/// should operate on. Special address spaces have an effect on code generation,
571/// depending on the target and the address spaces it implements.
572#[derive(#[automatically_derived]
impl ::core::marker::Copy for AddressSpace { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for AddressSpace { }
#[automatically_derived]
impl ::core::clone::Clone for AddressSpace {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<u32>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AddressSpace {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_tuple_field1_finish(f, "AddressSpace",
            &&self.0)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for AddressSpace { }
#[automatically_derived]
impl ::core::cmp::PartialEq for AddressSpace {
    #[inline]
    fn eq(&self, other: &Self) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for AddressSpace {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<u32>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for AddressSpace {
    #[inline]
    fn partial_cmp(&self, other: &Self)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for AddressSpace {
    #[inline]
    fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
        ::core::cmp::Ord::cmp(&self.0, &other.0)
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for AddressSpace {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.0, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for AddressSpace {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                _serde::Serializer::serialize_newtype_struct(__serializer,
                    "AddressSpace", &self.0)
            }
        }
    };Serialize)]
573pub struct AddressSpace(pub u32);
574
575impl AddressSpace {
576    /// The default address space, corresponding to data space.
577    pub const DATA: Self = AddressSpace(0);
578}
579
580/// Inclusive wrap-around range of valid values (bitwise representation), that is, if
581/// start > end, it represents `start..=MAX`, followed by `0..=end`.
582///
583/// That is, for an i8 primitive, a range of `254..=2` means following
584/// sequence:
585///
586///    254 (-2), 255 (-1), 0, 1, 2
587#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for WrappingRange { }
#[automatically_derived]
impl ::core::clone::Clone for WrappingRange {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<u128>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for WrappingRange { }Copy, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for WrappingRange { }
#[automatically_derived]
impl ::core::cmp::PartialEq for WrappingRange {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.start == other.start && self.end == other.end
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for WrappingRange {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<u128>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for WrappingRange {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.start, state);
        ::core::hash::Hash::hash(&self.end, state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for WrappingRange {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "WrappingRange", false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "start", &self.start)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "end", &self.end)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
588pub struct WrappingRange {
589    pub start: u128,
590    pub end: u128,
591}
592
593impl WrappingRange {
594    /// Returns `true` if `size` completely fills the range.
595    #[inline]
596    pub fn is_full(&self, size: Size) -> Result<bool, Error> {
597        let Some(max_value) = size.unsigned_int_max() else {
598            return Err(Error(::alloc::__export::must_use({
            ::alloc::fmt::format(format_args!("Expected size <= 128 bits, but found {0} instead",
                    size.bits()))
        }))error!("Expected size <= 128 bits, but found {} instead", size.bits()));
599        };
600        if self.start <= max_value && self.end <= max_value {
601            Ok(self.start == (self.end.wrapping_add(1) & max_value))
602        } else {
603            Err(Error(::alloc::__export::must_use({
            ::alloc::fmt::format(format_args!("Range `{1:?}` out of bounds for size `{0}` bits.",
                    size.bits(), self))
        }))error!("Range `{self:?}` out of bounds for size `{}` bits.", size.bits()))
604        }
605    }
606
607    /// Returns `true` if `v` is contained in the range.
608    #[inline(always)]
609    pub fn contains(&self, v: u128) -> bool {
610        if self.wraps_around() {
611            self.start <= v || v <= self.end
612        } else {
613            self.start <= v && v <= self.end
614        }
615    }
616
617    /// Returns `true` if the range wraps around.
618    /// I.e., the range represents the union of `self.start..=MAX` and `0..=self.end`.
619    /// Returns `false` if this is a non-wrapping range, i.e.: `self.start..=self.end`.
620    #[inline]
621    pub fn wraps_around(&self) -> bool {
622        self.start > self.end
623    }
624}
625
626impl Debug for WrappingRange {
627    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
628        if self.start > self.end {
629            fmt.write_fmt(format_args!("(..={0}) | ({1}..)", self.end, self.start))write!(fmt, "(..={}) | ({}..)", self.end, self.start)?;
630        } else {
631            fmt.write_fmt(format_args!("{0}..={1}", self.start, self.end))write!(fmt, "{}..={}", self.start, self.end)?;
632        }
633        Ok(())
634    }
635}
636
637/// General language calling conventions.
638#[derive(#[automatically_derived]
impl ::core::marker::Copy for CallConvention { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CallConvention { }
#[automatically_derived]
impl ::core::clone::Clone for CallConvention {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CallConvention {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CallConvention::C => "C",
                CallConvention::Rust => "Rust",
                CallConvention::Cold => "Cold",
                CallConvention::PreserveMost => "PreserveMost",
                CallConvention::PreserveAll => "PreserveAll",
                CallConvention::PreserveNone => "PreserveNone",
                CallConvention::Tail => "Tail",
                CallConvention::Custom => "Custom",
                CallConvention::Swift => "Swift",
                CallConvention::ArmAapcs => "ArmAapcs",
                CallConvention::CCmseNonSecureCall => "CCmseNonSecureCall",
                CallConvention::CCmseNonSecureEntry => "CCmseNonSecureEntry",
                CallConvention::Msp430Intr => "Msp430Intr",
                CallConvention::PtxKernel => "PtxKernel",
                CallConvention::GpuKernel => "GpuKernel",
                CallConvention::X86Fastcall => "X86Fastcall",
                CallConvention::X86Intr => "X86Intr",
                CallConvention::X86Stdcall => "X86Stdcall",
                CallConvention::X86ThisCall => "X86ThisCall",
                CallConvention::X86VectorCall => "X86VectorCall",
                CallConvention::X86_64SysV => "X86_64SysV",
                CallConvention::X86_64Win64 => "X86_64Win64",
                CallConvention::AvrInterrupt => "AvrInterrupt",
                CallConvention::AvrNonBlockingInterrupt =>
                    "AvrNonBlockingInterrupt",
                CallConvention::RiscvInterrupt => "RiscvInterrupt",
            })
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for CallConvention { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CallConvention {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CallConvention { }Eq, #[automatically_derived]
impl ::core::hash::Hash for CallConvention {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state)
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for CallConvention {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    CallConvention::C =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 0u32, "C"),
                    CallConvention::Rust =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 1u32, "Rust"),
                    CallConvention::Cold =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 2u32, "Cold"),
                    CallConvention::PreserveMost =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 3u32, "PreserveMost"),
                    CallConvention::PreserveAll =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 4u32, "PreserveAll"),
                    CallConvention::PreserveNone =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 5u32, "PreserveNone"),
                    CallConvention::Tail =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 6u32, "Tail"),
                    CallConvention::Custom =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 7u32, "Custom"),
                    CallConvention::Swift =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 8u32, "Swift"),
                    CallConvention::ArmAapcs =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 9u32, "ArmAapcs"),
                    CallConvention::CCmseNonSecureCall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 10u32, "CCmseNonSecureCall"),
                    CallConvention::CCmseNonSecureEntry =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 11u32, "CCmseNonSecureEntry"),
                    CallConvention::Msp430Intr =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 12u32, "Msp430Intr"),
                    CallConvention::PtxKernel =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 13u32, "PtxKernel"),
                    CallConvention::GpuKernel =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 14u32, "GpuKernel"),
                    CallConvention::X86Fastcall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 15u32, "X86Fastcall"),
                    CallConvention::X86Intr =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 16u32, "X86Intr"),
                    CallConvention::X86Stdcall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 17u32, "X86Stdcall"),
                    CallConvention::X86ThisCall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 18u32, "X86ThisCall"),
                    CallConvention::X86VectorCall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 19u32, "X86VectorCall"),
                    CallConvention::X86_64SysV =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 20u32, "X86_64SysV"),
                    CallConvention::X86_64Win64 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 21u32, "X86_64Win64"),
                    CallConvention::AvrInterrupt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 22u32, "AvrInterrupt"),
                    CallConvention::AvrNonBlockingInterrupt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 23u32, "AvrNonBlockingInterrupt"),
                    CallConvention::RiscvInterrupt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 24u32, "RiscvInterrupt"),
                }
            }
        }
    };Serialize)]
639pub enum CallConvention {
640    C,
641    Rust,
642
643    Cold,
644    PreserveMost,
645    PreserveAll,
646    PreserveNone,
647    Tail,
648
649    Custom,
650
651    Swift,
652
653    // Target-specific calling conventions.
654    ArmAapcs,
655    CCmseNonSecureCall,
656    CCmseNonSecureEntry,
657
658    Msp430Intr,
659
660    PtxKernel,
661
662    GpuKernel,
663
664    X86Fastcall,
665    X86Intr,
666    X86Stdcall,
667    X86ThisCall,
668    X86VectorCall,
669
670    X86_64SysV,
671    X86_64Win64,
672
673    AvrInterrupt,
674    AvrNonBlockingInterrupt,
675
676    RiscvInterrupt,
677}
678
679#[non_exhaustive]
680#[derive(#[automatically_derived]
impl ::core::marker::Copy for ReprFlags { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ReprFlags { }
#[automatically_derived]
impl ::core::clone::Clone for ReprFlags {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for ReprFlags { }
#[automatically_derived]
impl ::core::cmp::PartialEq for ReprFlags {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.is_simd == other.is_simd && self.is_c == other.is_c &&
                self.is_transparent == other.is_transparent &&
            self.is_linear == other.is_linear
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ReprFlags {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for ReprFlags {
    #[inline]
    fn partial_cmp(&self, other: &Self)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for ReprFlags {
    #[inline]
    fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
        match ::core::cmp::Ord::cmp(&self.is_simd, &other.is_simd) {
            ::core::cmp::Ordering::Equal =>
                match ::core::cmp::Ord::cmp(&self.is_c, &other.is_c) {
                    ::core::cmp::Ordering::Equal =>
                        match ::core::cmp::Ord::cmp(&self.is_transparent,
                                &other.is_transparent) {
                            ::core::cmp::Ordering::Equal =>
                                ::core::cmp::Ord::cmp(&self.is_linear, &other.is_linear),
                            cmp => cmp,
                        },
                    cmp => cmp,
                },
            cmp => cmp,
        }
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for ReprFlags {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.is_simd, state);
        ::core::hash::Hash::hash(&self.is_c, state);
        ::core::hash::Hash::hash(&self.is_transparent, state);
        ::core::hash::Hash::hash(&self.is_linear, state)
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for ReprFlags {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "ReprFlags",
            "is_simd", &self.is_simd, "is_c", &self.is_c, "is_transparent",
            &self.is_transparent, "is_linear", &&self.is_linear)
    }
}Debug, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for ReprFlags {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "ReprFlags", false as usize + 1 + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "is_simd", &self.is_simd)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "is_c", &self.is_c)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "is_transparent", &self.is_transparent)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "is_linear", &self.is_linear)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
681pub struct ReprFlags {
682    pub is_simd: bool,
683    pub is_c: bool,
684    pub is_transparent: bool,
685    pub is_linear: bool,
686}
687
688#[derive(#[automatically_derived]
impl ::core::marker::Copy for IntegerType { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for IntegerType { }
#[automatically_derived]
impl ::core::clone::Clone for IntegerType {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<IntegerLength>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for IntegerType { }
#[automatically_derived]
impl ::core::cmp::PartialEq for IntegerType {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Pointer { is_signed: __self_0 }, Self::Pointer {
                    is_signed: __arg1_0 }) => __self_0 == __arg1_0,
                (Self::Fixed { length: __self_0, is_signed: __self_1 },
                    Self::Fixed { length: __arg1_0, is_signed: __arg1_1 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for IntegerType {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<IntegerLength>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for IntegerType {
    #[inline]
    fn partial_cmp(&self, other: &Self)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for IntegerType {
    #[inline]
    fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
        match (self, other) {
            (Self::Pointer { is_signed: __self_0 }, Self::Pointer {
                is_signed: __arg1_0 }) =>
                ::core::cmp::Ord::cmp(__self_0, __arg1_0),
            (Self::Fixed { length: __self_0, is_signed: __self_1 },
                Self::Fixed { length: __arg1_0, is_signed: __arg1_1 }) =>
                match ::core::cmp::Ord::cmp(__self_0, __arg1_0) {
                    ::core::cmp::Ordering::Equal =>
                        ::core::cmp::Ord::cmp(__self_1, __arg1_1),
                    cmp => cmp,
                },
            _ =>
                ::core::cmp::Ord::cmp(&::core::intrinsics::discriminant_value(self),
                    &::core::intrinsics::discriminant_value(other)),
        }
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for IntegerType {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::Pointer { is_signed: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::Fixed { length: __self_0, is_signed: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
        }
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for IntegerType {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Pointer { is_signed: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Pointer", "is_signed", &__self_0),
            Self::Fixed { length: __self_0, is_signed: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Fixed",
                    "length", __self_0, "is_signed", &__self_1),
        }
    }
}Debug, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for IntegerType {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    IntegerType::Pointer { ref is_signed } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "IntegerType", 0u32, "Pointer", 0 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "is_signed", is_signed)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    IntegerType::Fixed { ref length, ref is_signed } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "IntegerType", 1u32, "Fixed", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "length", length)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "is_signed", is_signed)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
689pub enum IntegerType {
690    /// Pointer-sized integer type, i.e. `isize` and `usize`.
691    Pointer {
692        /// Signedness. e.g. `true` for `isize`
693        is_signed: bool,
694    },
695    /// Fixed-sized integer type, e.g. `i8`, `u32`, `i128`.
696    Fixed {
697        /// Length of this integer type. e.g. `IntegerLength::I8` for `u8`.
698        length: IntegerLength,
699        /// Signedness. e.g. `false` for `u8`
700        is_signed: bool,
701    },
702}
703
704/// Representation options provided by the user
705#[non_exhaustive]
706#[derive(#[automatically_derived]
impl ::core::marker::Copy for ReprOptions { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ReprOptions { }
#[automatically_derived]
impl ::core::clone::Clone for ReprOptions {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Option<IntegerType>>;
        let _: ::core::clone::AssertParamIsClone<Option<Align>>;
        let _: ::core::clone::AssertParamIsClone<Option<Align>>;
        let _: ::core::clone::AssertParamIsClone<ReprFlags>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for ReprOptions { }
#[automatically_derived]
impl ::core::cmp::PartialEq for ReprOptions {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.int == other.int && self.align == other.align &&
                self.pack == other.pack && self.flags == other.flags
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ReprOptions {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Option<IntegerType>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Align>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Align>>;
        let _: ::core::cmp::AssertParamIsEq<ReprFlags>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for ReprOptions {
    #[inline]
    fn partial_cmp(&self, other: &Self)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for ReprOptions {
    #[inline]
    fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
        match ::core::cmp::Ord::cmp(&self.int, &other.int) {
            ::core::cmp::Ordering::Equal =>
                match ::core::cmp::Ord::cmp(&self.align, &other.align) {
                    ::core::cmp::Ordering::Equal =>
                        match ::core::cmp::Ord::cmp(&self.pack, &other.pack) {
                            ::core::cmp::Ordering::Equal =>
                                ::core::cmp::Ord::cmp(&self.flags, &other.flags),
                            cmp => cmp,
                        },
                    cmp => cmp,
                },
            cmp => cmp,
        }
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for ReprOptions {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.int, state);
        ::core::hash::Hash::hash(&self.align, state);
        ::core::hash::Hash::hash(&self.pack, state);
        ::core::hash::Hash::hash(&self.flags, state)
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for ReprOptions {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "ReprOptions",
            "int", &self.int, "align", &self.align, "pack", &self.pack,
            "flags", &&self.flags)
    }
}Debug, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for ReprOptions {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                let mut __serde_state =
                    _serde::Serializer::serialize_struct(__serializer,
                            "ReprOptions", false as usize + 1 + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "int", &self.int)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "align", &self.align)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "pack", &self.pack)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "flags", &self.flags)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
707pub struct ReprOptions {
708    pub int: Option<IntegerType>,
709    pub align: Option<Align>,
710    pub pack: Option<Align>,
711    pub flags: ReprFlags,
712}