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, Opaque, ThreadLocalIndex, error};
12
13/// A function ABI definition.
14#[derive(#[automatically_derived]
impl ::core::clone::Clone for FnAbi {
    #[inline]
    fn clone(&self) -> FnAbi {
        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::cmp::PartialEq for FnAbi {
    #[inline]
    fn eq(&self, other: &FnAbi) -> 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 non-variadic arguments.
23    ///
24    /// Should only be different from `args.len()` when a function is a C variadic function.
25    pub fixed_count: u32,
26
27    /// The ABI convention.
28    pub conv: CallConvention,
29
30    /// Whether this is a variadic C function,
31    pub c_variadic: bool,
32}
33
34/// Information about the ABI of a function's argument, or return value.
35#[derive(#[automatically_derived]
impl ::core::clone::Clone for ArgAbi {
    #[inline]
    fn clone(&self) -> ArgAbi {
        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::cmp::PartialEq for ArgAbi {
    #[inline]
    fn eq(&self, other: &ArgAbi) -> 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)]
36pub struct ArgAbi {
37    pub ty: Ty,
38    pub layout: Layout,
39    pub mode: PassMode,
40}
41
42/// How a function argument should be passed in to the target function.
43#[derive(#[automatically_derived]
impl ::core::clone::Clone for PassMode {
    #[inline]
    fn clone(&self) -> PassMode {
        match self {
            PassMode::Ignore => PassMode::Ignore,
            PassMode::Direct(__self_0) =>
                PassMode::Direct(::core::clone::Clone::clone(__self_0)),
            PassMode::Pair(__self_0, __self_1) =>
                PassMode::Pair(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            PassMode::Cast { pad_i32: __self_0, cast: __self_1 } =>
                PassMode::Cast {
                    pad_i32: ::core::clone::Clone::clone(__self_0),
                    cast: ::core::clone::Clone::clone(__self_1),
                },
            PassMode::Indirect {
                attrs: __self_0, meta_attrs: __self_1, on_stack: __self_2 } =>
                PassMode::Indirect {
                    attrs: ::core::clone::Clone::clone(__self_0),
                    meta_attrs: ::core::clone::Clone::clone(__self_1),
                    on_stack: ::core::clone::Clone::clone(__self_2),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for PassMode {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            PassMode::Ignore =>
                ::core::fmt::Formatter::write_str(f, "Ignore"),
            PassMode::Direct(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Direct",
                    &__self_0),
            PassMode::Pair(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Pair",
                    __self_0, &__self_1),
            PassMode::Cast { pad_i32: __self_0, cast: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Cast",
                    "pad_i32", __self_0, "cast", &__self_1),
            PassMode::Indirect {
                attrs: __self_0, meta_attrs: __self_1, on_stack: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "Indirect", "attrs", __self_0, "meta_attrs", __self_1,
                    "on_stack", &__self_2),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for PassMode {
    #[inline]
    fn eq(&self, other: &PassMode) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (PassMode::Direct(__self_0), PassMode::Direct(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (PassMode::Pair(__self_0, __self_1),
                    PassMode::Pair(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (PassMode::Cast { pad_i32: __self_0, cast: __self_1 },
                    PassMode::Cast { pad_i32: __arg1_0, cast: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (PassMode::Indirect {
                    attrs: __self_0, meta_attrs: __self_1, on_stack: __self_2 },
                    PassMode::Indirect {
                    attrs: __arg1_0, meta_attrs: __arg1_1, on_stack: __arg1_2 })
                    =>
                    __self_2 == __arg1_2 && __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<Opaque>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for PassMode {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            PassMode::Direct(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            PassMode::Pair(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            PassMode::Cast { pad_i32: __self_0, cast: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            PassMode::Indirect {
                attrs: __self_0, meta_attrs: __self_1, on_stack: __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 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, 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", pad_i32)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "cast", cast)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    PassMode::Indirect { ref attrs, ref meta_attrs, ref on_stack
                        } => {
                        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,
                                "meta_attrs", meta_attrs)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "on_stack", on_stack)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
44pub enum PassMode {
45    /// Ignore the argument.
46    ///
47    /// The argument is either uninhabited or a ZST.
48    Ignore,
49    /// Pass the argument directly.
50    ///
51    /// The argument has a layout abi of `Scalar` or `Vector`.
52    Direct(Opaque),
53    /// Pass a pair's elements directly in two arguments.
54    ///
55    /// The argument has a layout abi of `ScalarPair`.
56    Pair(Opaque, Opaque),
57    /// Pass the argument after casting it.
58    Cast { pad_i32: bool, cast: Opaque },
59    /// Pass the argument indirectly via a hidden pointer.
60    Indirect { attrs: Opaque, meta_attrs: Opaque, on_stack: bool },
61}
62
63/// The layout of a type, alongside the type itself.
64#[derive(#[automatically_derived]
impl ::core::marker::Copy for TyAndLayout { }Copy, #[automatically_derived]
impl ::core::clone::Clone for TyAndLayout {
    #[inline]
    fn clone(&self) -> TyAndLayout {
        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::cmp::PartialEq for TyAndLayout {
    #[inline]
    fn eq(&self, other: &TyAndLayout) -> 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)]
65pub struct TyAndLayout {
66    pub ty: Ty,
67    pub layout: Layout,
68}
69
70/// The layout of a type in memory.
71#[derive(#[automatically_derived]
impl ::core::clone::Clone for LayoutShape {
    #[inline]
    fn clone(&self) -> LayoutShape {
        LayoutShape {
            fields: ::core::clone::Clone::clone(&self.fields),
            variants: ::core::clone::Clone::clone(&self.variants),
            abi: ::core::clone::Clone::clone(&self.abi),
            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, "abi",
            &self.abi, "abi_align", &self.abi_align, "size", &&self.size)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for LayoutShape {
    #[inline]
    fn eq(&self, other: &LayoutShape) -> bool {
        self.fields == other.fields && self.variants == other.variants &&
                    self.abi == other.abi && 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<ValueAbi>;
        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.abi, 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,
                        "abi", &self.abi)?;
                _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)]
72pub struct LayoutShape {
73    /// The fields location within the layout
74    pub fields: FieldsShape,
75
76    /// Encodes information about multi-variant layouts.
77    /// Even with `Multiple` variants, a layout still has its own fields! Those are then
78    /// shared between all variants.
79    ///
80    /// To access all fields of this layout, both `fields` and the fields of the active variant
81    /// must be taken into account.
82    pub variants: VariantsShape,
83
84    /// The `abi` defines how this data is passed between functions.
85    pub abi: ValueAbi,
86
87    /// The ABI mandated alignment in bytes.
88    pub abi_align: Align,
89
90    /// The size of this layout in bytes.
91    pub size: Size,
92}
93
94impl LayoutShape {
95    /// Returns `true` if the layout corresponds to an unsized type.
96    #[inline]
97    pub fn is_unsized(&self) -> bool {
98        self.abi.is_unsized()
99    }
100
101    #[inline]
102    pub fn is_sized(&self) -> bool {
103        !self.abi.is_unsized()
104    }
105
106    /// Returns `true` if the type is sized and a 1-ZST (meaning it has size 0 and alignment 1).
107    pub fn is_1zst(&self) -> bool {
108        self.is_sized() && self.size.bits() == 0 && self.abi_align == 1
109    }
110}
111
112#[derive(#[automatically_derived]
impl ::core::marker::Copy for Layout { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Layout {
    #[inline]
    fn clone(&self) -> Layout {
        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::cmp::PartialEq for Layout {
    #[inline]
    fn eq(&self, other: &Layout) -> 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)]
113pub struct Layout(usize, ThreadLocalIndex);
114impl 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);
115
116impl Layout {
117    pub fn shape(self) -> LayoutShape {
118        with(|cx| cx.layout_shape(self))
119    }
120}
121
122/// Describes how the fields of a type are shaped in memory.
123#[derive(#[automatically_derived]
impl ::core::clone::Clone for FieldsShape {
    #[inline]
    fn clone(&self) -> FieldsShape {
        match self {
            FieldsShape::Primitive => FieldsShape::Primitive,
            FieldsShape::Union(__self_0) =>
                FieldsShape::Union(::core::clone::Clone::clone(__self_0)),
            FieldsShape::Array { stride: __self_0, count: __self_1 } =>
                FieldsShape::Array {
                    stride: ::core::clone::Clone::clone(__self_0),
                    count: ::core::clone::Clone::clone(__self_1),
                },
            FieldsShape::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 {
            FieldsShape::Primitive =>
                ::core::fmt::Formatter::write_str(f, "Primitive"),
            FieldsShape::Union(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Union",
                    &__self_0),
            FieldsShape::Array { stride: __self_0, count: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Array",
                    "stride", __self_0, "count", &__self_1),
            FieldsShape::Arbitrary { offsets: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Arbitrary", "offsets", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for FieldsShape {
    #[inline]
    fn eq(&self, other: &FieldsShape) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (FieldsShape::Union(__self_0), FieldsShape::Union(__arg1_0))
                    => __self_0 == __arg1_0,
                (FieldsShape::Array { stride: __self_0, count: __self_1 },
                    FieldsShape::Array { stride: __arg1_0, count: __arg1_1 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0,
                (FieldsShape::Arbitrary { offsets: __self_0 },
                    FieldsShape::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) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            FieldsShape::Union(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            FieldsShape::Array { stride: __self_0, count: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            FieldsShape::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)]
124pub enum FieldsShape {
125    /// Scalar primitives and `!`, which never have fields.
126    Primitive,
127
128    /// All fields start at no offset. The `usize` is the field count.
129    Union(NonZero<usize>),
130
131    /// Array/vector-like placement, with all fields of identical types.
132    Array { stride: Size, count: u64 },
133
134    /// Struct-like placement, with precomputed offsets.
135    ///
136    /// Fields are guaranteed to not overlap, but note that gaps
137    /// before, between and after all the fields are NOT always
138    /// padding, and as such their contents may not be discarded.
139    /// For example, enum variants leave a gap at the start,
140    /// where the discriminant field in the enum layout goes.
141    Arbitrary {
142        /// Offsets for the first byte of each field,
143        /// ordered to match the source definition order.
144        /// I.e.: It follows the same order as [super::ty::VariantDef::fields()].
145        /// This vector does not go in increasing order.
146        offsets: Vec<Size>,
147    },
148}
149
150impl FieldsShape {
151    pub fn fields_by_offset_order(&self) -> Vec<FieldIdx> {
152        match self {
153            FieldsShape::Primitive => ::alloc::vec::Vec::new()vec![],
154            FieldsShape::Union(_) | FieldsShape::Array { .. } => (0..self.count()).collect(),
155            FieldsShape::Arbitrary { offsets, .. } => {
156                let mut indices = (0..offsets.len()).collect::<Vec<_>>();
157                indices.sort_by_key(|idx| offsets[*idx]);
158                indices
159            }
160        }
161    }
162
163    pub fn count(&self) -> usize {
164        match self {
165            FieldsShape::Primitive => 0,
166            FieldsShape::Union(count) => count.get(),
167            FieldsShape::Array { count, .. } => *count as usize,
168            FieldsShape::Arbitrary { offsets, .. } => offsets.len(),
169        }
170    }
171}
172
173#[derive(#[automatically_derived]
impl ::core::clone::Clone for VariantsShape {
    #[inline]
    fn clone(&self) -> VariantsShape {
        match self {
            VariantsShape::Empty => VariantsShape::Empty,
            VariantsShape::Single { index: __self_0 } =>
                VariantsShape::Single {
                    index: ::core::clone::Clone::clone(__self_0),
                },
            VariantsShape::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 {
            VariantsShape::Empty =>
                ::core::fmt::Formatter::write_str(f, "Empty"),
            VariantsShape::Single { index: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Single", "index", &__self_0),
            VariantsShape::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::cmp::PartialEq for VariantsShape {
    #[inline]
    fn eq(&self, other: &VariantsShape) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (VariantsShape::Single { index: __self_0 },
                    VariantsShape::Single { index: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                (VariantsShape::Multiple {
                    tag: __self_0,
                    tag_encoding: __self_1,
                    tag_field: __self_2,
                    variants: __self_3 }, VariantsShape::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) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            VariantsShape::Single { index: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
            VariantsShape::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)]
174pub enum VariantsShape {
175    /// A type with no valid variants. Must be uninhabited.
176    Empty,
177
178    /// Single enum variants, structs/tuples, unions, and all non-ADTs.
179    Single { index: VariantIdx },
180
181    /// Enum-likes with more than one inhabited variant: each variant comes with
182    /// a *discriminant* (usually the same as the variant index but the user can
183    /// assign explicit discriminant values). That discriminant is encoded
184    /// as a *tag* on the machine. The layout of each variant is
185    /// a struct, and they all have space reserved for the tag.
186    /// For enums, the tag is the sole field of the layout.
187    Multiple {
188        tag: Scalar,
189        tag_encoding: TagEncoding,
190        tag_field: usize,
191        variants: Vec<VariantFields>,
192    },
193}
194
195#[derive(#[automatically_derived]
impl ::core::clone::Clone for VariantFields {
    #[inline]
    fn clone(&self) -> VariantFields {
        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::cmp::PartialEq for VariantFields {
    #[inline]
    fn eq(&self, other: &VariantFields) -> 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)]
196pub struct VariantFields {
197    /// Offsets for the first byte of each field,
198    /// ordered to match the source definition order.
199    /// I.e.: It follows the same order as [super::ty::VariantDef::fields()].
200    /// This vector does not go in increasing order.
201    pub offsets: Vec<Size>,
202}
203
204impl VariantFields {
205    pub fn fields_by_offset_order(&self) -> Vec<FieldIdx> {
206        let mut indices = (0..self.offsets.len()).collect::<Vec<_>>();
207        indices.sort_by_key(|idx| self.offsets[*idx]);
208        indices
209    }
210}
211
212#[derive(#[automatically_derived]
impl ::core::clone::Clone for TagEncoding {
    #[inline]
    fn clone(&self) -> TagEncoding {
        match self {
            TagEncoding::Direct => TagEncoding::Direct,
            TagEncoding::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 {
            TagEncoding::Direct =>
                ::core::fmt::Formatter::write_str(f, "Direct"),
            TagEncoding::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::cmp::PartialEq for TagEncoding {
    #[inline]
    fn eq(&self, other: &TagEncoding) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (TagEncoding::Niche {
                    untagged_variant: __self_0,
                    niche_variants: __self_1,
                    niche_start: __self_2 }, TagEncoding::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) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            TagEncoding::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)]
213pub enum TagEncoding {
214    /// The tag directly stores the discriminant, but possibly with a smaller layout
215    /// (so converting the tag to the discriminant can require sign extension).
216    Direct,
217
218    /// Niche (values invalid for a type) encoding the discriminant:
219    /// Discriminant and variant index coincide.
220    /// The variant `untagged_variant` contains a niche at an arbitrary
221    /// offset (field `tag_field` of the enum), which for a variant with
222    /// discriminant `d` is set to
223    /// `(d - niche_variants.start).wrapping_add(niche_start)`.
224    ///
225    /// For example, `Option<(usize, &T)>`  is represented such that
226    /// `None` has a null pointer for the second tuple field, and
227    /// `Some` is the identity function (with a non-null reference).
228    Niche {
229        untagged_variant: VariantIdx,
230        niche_variants: RangeInclusive<VariantIdx>,
231        niche_start: u128,
232    },
233}
234
235/// How many scalable vectors are in a `ValueAbi::ScalableVector`?
236#[derive(#[automatically_derived]
impl ::core::clone::Clone for NumScalableVectors {
    #[inline]
    fn clone(&self) -> NumScalableVectors {
        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::cmp::PartialEq for NumScalableVectors {
    #[inline]
    fn eq(&self, other: &NumScalableVectors) -> 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)]
237pub struct NumScalableVectors(pub(crate) u8);
238
239/// Describes how values of the type are passed by target ABIs,
240/// in terms of categories of C types there are ABI rules for.
241#[derive(#[automatically_derived]
impl ::core::clone::Clone for ValueAbi {
    #[inline]
    fn clone(&self) -> ValueAbi {
        match self {
            ValueAbi::Scalar(__self_0) =>
                ValueAbi::Scalar(::core::clone::Clone::clone(__self_0)),
            ValueAbi::ScalarPair(__self_0, __self_1) =>
                ValueAbi::ScalarPair(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            ValueAbi::Vector { element: __self_0, count: __self_1 } =>
                ValueAbi::Vector {
                    element: ::core::clone::Clone::clone(__self_0),
                    count: ::core::clone::Clone::clone(__self_1),
                },
            ValueAbi::ScalableVector {
                element: __self_0,
                count: __self_1,
                number_of_vectors: __self_2 } =>
                ValueAbi::ScalableVector {
                    element: ::core::clone::Clone::clone(__self_0),
                    count: ::core::clone::Clone::clone(__self_1),
                    number_of_vectors: ::core::clone::Clone::clone(__self_2),
                },
            ValueAbi::Aggregate { sized: __self_0 } =>
                ValueAbi::Aggregate {
                    sized: ::core::clone::Clone::clone(__self_0),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ValueAbi {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ValueAbi::Scalar(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Scalar",
                    &__self_0),
            ValueAbi::ScalarPair(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "ScalarPair", __self_0, &__self_1),
            ValueAbi::Vector { element: __self_0, count: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "Vector", "element", __self_0, "count", &__self_1),
            ValueAbi::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),
            ValueAbi::Aggregate { sized: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Aggregate", "sized", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for ValueAbi {
    #[inline]
    fn eq(&self, other: &ValueAbi) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (ValueAbi::Scalar(__self_0), ValueAbi::Scalar(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (ValueAbi::ScalarPair(__self_0, __self_1),
                    ValueAbi::ScalarPair(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (ValueAbi::Vector { element: __self_0, count: __self_1 },
                    ValueAbi::Vector { element: __arg1_0, count: __arg1_1 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0,
                (ValueAbi::ScalableVector {
                    element: __self_0,
                    count: __self_1,
                    number_of_vectors: __self_2 }, ValueAbi::ScalableVector {
                    element: __arg1_0,
                    count: __arg1_1,
                    number_of_vectors: __arg1_2 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0 &&
                        __self_2 == __arg1_2,
                (ValueAbi::Aggregate { sized: __self_0 },
                    ValueAbi::Aggregate { sized: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ValueAbi {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Scalar>;
        let _: ::core::cmp::AssertParamIsEq<u64>;
        let _: ::core::cmp::AssertParamIsEq<NumScalableVectors>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for ValueAbi {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            ValueAbi::Scalar(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            ValueAbi::ScalarPair(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            ValueAbi::Vector { element: __self_0, count: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            ValueAbi::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)
            }
            ValueAbi::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 ValueAbi {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    ValueAbi::Scalar(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "ValueAbi", 0u32, "Scalar", __field0),
                    ValueAbi::ScalarPair(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "ValueAbi", 1u32, "ScalarPair", 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)
                    }
                    ValueAbi::Vector { ref element, ref count } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "ValueAbi", 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)
                    }
                    ValueAbi::ScalableVector {
                        ref element, ref count, ref number_of_vectors } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "ValueAbi", 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)
                    }
                    ValueAbi::Aggregate { ref sized } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "ValueAbi", 4u32, "Aggregate", 0 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "sized", sized)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
242pub enum ValueAbi {
243    Scalar(Scalar),
244    ScalarPair(Scalar, Scalar),
245    Vector {
246        element: Scalar,
247        count: u64,
248    },
249    ScalableVector {
250        element: Scalar,
251        count: u64,
252        number_of_vectors: NumScalableVectors,
253    },
254    Aggregate {
255        /// If true, the size is exact, otherwise it's only a lower bound.
256        sized: bool,
257    },
258}
259
260impl ValueAbi {
261    /// Returns `true` if the layout corresponds to an unsized type.
262    pub fn is_unsized(&self) -> bool {
263        match *self {
264            ValueAbi::Scalar(_)
265            | ValueAbi::ScalarPair(..)
266            | ValueAbi::Vector { .. }
267            // FIXME(rustc_scalable_vector): Scalable vectors are `Sized` while the
268            // `sized_hierarchy` feature is not yet fully implemented. After `sized_hierarchy` is
269            // fully implemented, scalable vectors will remain `Sized`, they just won't be
270            // `const Sized` - whether `is_unsized` continues to return `false` at that point will
271            // need to be revisited and will depend on what `is_unsized` is used for.
272            | ValueAbi::ScalableVector { .. } => false,
273            ValueAbi::Aggregate { sized } => !sized,
274        }
275    }
276}
277
278/// Information about one scalar component of a Rust type.
279#[derive(#[automatically_derived]
impl ::core::clone::Clone for Scalar {
    #[inline]
    fn clone(&self) -> Scalar {
        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::cmp::PartialEq for Scalar {
    #[inline]
    fn eq(&self, other: &Scalar) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (Scalar::Initialized { value: __self_0, valid_range: __self_1
                    }, Scalar::Initialized {
                    value: __arg1_0, valid_range: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (Scalar::Union { value: __self_0 }, Scalar::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) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            Scalar::Initialized { value: __self_0, valid_range: __self_1 } =>
                {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Scalar::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 {
            Scalar::Initialized { value: __self_0, valid_range: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "Initialized", "value", __self_0, "valid_range", &__self_1),
            Scalar::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)]
280pub enum Scalar {
281    Initialized {
282        /// The primitive type used to represent this value.
283        value: Primitive,
284        /// The range that represents valid values.
285        /// The range must be valid for the `primitive` size.
286        valid_range: WrappingRange,
287    },
288    Union {
289        /// Unions never have niches, so there is no `valid_range`.
290        /// Even for unions, we need to use the correct registers for the kind of
291        /// values inside the union, so we keep the `Primitive` type around.
292        /// It is also used to compute the size of the scalar.
293        value: Primitive,
294    },
295}
296
297impl Scalar {
298    pub fn has_niche(&self, target: &MachineInfo) -> bool {
299        match self {
300            Scalar::Initialized { value, valid_range } => {
301                !valid_range.is_full(value.size(target)).unwrap()
302            }
303            Scalar::Union { .. } => false,
304        }
305    }
306}
307
308/// Fundamental unit of memory access and layout.
309#[derive(#[automatically_derived]
impl ::core::marker::Copy for Primitive { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Primitive {
    #[inline]
    fn clone(&self) -> Primitive {
        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::cmp::PartialEq for Primitive {
    #[inline]
    fn eq(&self, other: &Primitive) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (Primitive::Int { length: __self_0, signed: __self_1 },
                    Primitive::Int { length: __arg1_0, signed: __arg1_1 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0,
                (Primitive::Float { length: __self_0 }, Primitive::Float {
                    length: __arg1_0 }) => __self_0 == __arg1_0,
                (Primitive::Pointer(__self_0), Primitive::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) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            Primitive::Int { length: __self_0, signed: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Primitive::Float { length: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
            Primitive::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 {
            Primitive::Int { length: __self_0, signed: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Int",
                    "length", __self_0, "signed", &__self_1),
            Primitive::Float { length: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Float",
                    "length", &__self_0),
            Primitive::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)]
310pub enum Primitive {
311    /// The `bool` is the signedness of the `Integer` type.
312    ///
313    /// One would think we would not care about such details this low down,
314    /// but some ABIs are described in terms of C types and ISAs where the
315    /// integer arithmetic is done on {sign,zero}-extended registers, e.g.
316    /// a negative integer passed by zero-extension will appear positive in
317    /// the callee, and most operations on it will produce the wrong values.
318    Int {
319        length: IntegerLength,
320        signed: bool,
321    },
322    Float {
323        length: FloatLength,
324    },
325    Pointer(AddressSpace),
326}
327
328impl Primitive {
329    pub fn size(self, target: &MachineInfo) -> Size {
330        match self {
331            Primitive::Int { length, .. } => Size::from_bits(length.bits()),
332            Primitive::Float { length } => Size::from_bits(length.bits()),
333            Primitive::Pointer(_) => target.pointer_width,
334        }
335    }
336}
337
338/// Enum representing the existing integer lengths.
339#[derive(#[automatically_derived]
impl ::core::marker::Copy for IntegerLength { }Copy, #[automatically_derived]
impl ::core::clone::Clone for IntegerLength {
    #[inline]
    fn clone(&self) -> IntegerLength { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for IntegerLength {
    #[inline]
    fn eq(&self, other: &IntegerLength) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for IntegerLength {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for IntegerLength {
    #[inline]
    fn partial_cmp(&self, other: &IntegerLength)
        -> ::core::option::Option<::core::cmp::Ordering> {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for IntegerLength {
    #[inline]
    fn cmp(&self, other: &IntegerLength) -> ::core::cmp::Ordering {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for IntegerLength {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, 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)]
340pub enum IntegerLength {
341    I8,
342    I16,
343    I32,
344    I64,
345    I128,
346}
347
348/// Enum representing the existing float lengths.
349#[derive(#[automatically_derived]
impl ::core::marker::Copy for FloatLength { }Copy, #[automatically_derived]
impl ::core::clone::Clone for FloatLength {
    #[inline]
    fn clone(&self) -> FloatLength { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for FloatLength {
    #[inline]
    fn eq(&self, other: &FloatLength) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FloatLength {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for FloatLength {
    #[inline]
    fn partial_cmp(&self, other: &FloatLength)
        -> ::core::option::Option<::core::cmp::Ordering> {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for FloatLength {
    #[inline]
    fn cmp(&self, other: &FloatLength) -> ::core::cmp::Ordering {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for FloatLength {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, 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::F32 => "F32",
                FloatLength::F64 => "F64",
                FloatLength::F128 => "F128",
            })
    }
}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::F32 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FloatLength", 1u32, "F32"),
                    FloatLength::F64 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FloatLength", 2u32, "F64"),
                    FloatLength::F128 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FloatLength", 3u32, "F128"),
                }
            }
        }
    };Serialize)]
350pub enum FloatLength {
351    F16,
352    F32,
353    F64,
354    F128,
355}
356
357impl IntegerLength {
358    pub fn bits(self) -> usize {
359        match self {
360            IntegerLength::I8 => 8,
361            IntegerLength::I16 => 16,
362            IntegerLength::I32 => 32,
363            IntegerLength::I64 => 64,
364            IntegerLength::I128 => 128,
365        }
366    }
367}
368
369impl FloatLength {
370    pub fn bits(self) -> usize {
371        match self {
372            FloatLength::F16 => 16,
373            FloatLength::F32 => 32,
374            FloatLength::F64 => 64,
375            FloatLength::F128 => 128,
376        }
377    }
378}
379
380/// An identifier that specifies the address space that some operation
381/// should operate on. Special address spaces have an effect on code generation,
382/// depending on the target and the address spaces it implements.
383#[derive(#[automatically_derived]
impl ::core::marker::Copy for AddressSpace { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AddressSpace {
    #[inline]
    fn clone(&self) -> AddressSpace {
        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::cmp::PartialEq for AddressSpace {
    #[inline]
    fn eq(&self, other: &AddressSpace) -> 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: &AddressSpace)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0)
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for AddressSpace {
    #[inline]
    fn cmp(&self, other: &AddressSpace) -> ::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)]
384pub struct AddressSpace(pub u32);
385
386impl AddressSpace {
387    /// The default address space, corresponding to data space.
388    pub const DATA: Self = AddressSpace(0);
389}
390
391/// Inclusive wrap-around range of valid values (bitwise representation), that is, if
392/// start > end, it represents `start..=MAX`, followed by `0..=end`.
393///
394/// That is, for an i8 primitive, a range of `254..=2` means following
395/// sequence:
396///
397///    254 (-2), 255 (-1), 0, 1, 2
398#[derive(#[automatically_derived]
impl ::core::clone::Clone for WrappingRange {
    #[inline]
    fn clone(&self) -> WrappingRange {
        let _: ::core::clone::AssertParamIsClone<u128>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for WrappingRange { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for WrappingRange {
    #[inline]
    fn eq(&self, other: &WrappingRange) -> 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)]
399pub struct WrappingRange {
400    pub start: u128,
401    pub end: u128,
402}
403
404impl WrappingRange {
405    /// Returns `true` if `size` completely fills the range.
406    #[inline]
407    pub fn is_full(&self, size: Size) -> Result<bool, Error> {
408        let Some(max_value) = size.unsigned_int_max() else {
409            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()));
410        };
411        if self.start <= max_value && self.end <= max_value {
412            Ok(self.start == (self.end.wrapping_add(1) & max_value))
413        } else {
414            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()))
415        }
416    }
417
418    /// Returns `true` if `v` is contained in the range.
419    #[inline(always)]
420    pub fn contains(&self, v: u128) -> bool {
421        if self.wraps_around() {
422            self.start <= v || v <= self.end
423        } else {
424            self.start <= v && v <= self.end
425        }
426    }
427
428    /// Returns `true` if the range wraps around.
429    /// I.e., the range represents the union of `self.start..=MAX` and `0..=self.end`.
430    /// Returns `false` if this is a non-wrapping range, i.e.: `self.start..=self.end`.
431    #[inline]
432    pub fn wraps_around(&self) -> bool {
433        self.start > self.end
434    }
435}
436
437impl Debug for WrappingRange {
438    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
439        if self.start > self.end {
440            fmt.write_fmt(format_args!("(..={0}) | ({1}..)", self.end, self.start))write!(fmt, "(..={}) | ({}..)", self.end, self.start)?;
441        } else {
442            fmt.write_fmt(format_args!("{0}..={1}", self.start, self.end))write!(fmt, "{}..={}", self.start, self.end)?;
443        }
444        Ok(())
445    }
446}
447
448/// General language calling conventions.
449#[derive(#[automatically_derived]
impl ::core::marker::Copy for CallConvention { }Copy, #[automatically_derived]
impl ::core::clone::Clone for CallConvention {
    #[inline]
    fn clone(&self) -> CallConvention { *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::Custom => "Custom",
                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::cmp::PartialEq for CallConvention {
    #[inline]
    fn eq(&self, other: &CallConvention) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CallConvention {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for CallConvention {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, 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::Custom =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 6u32, "Custom"),
                    CallConvention::ArmAapcs =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 7u32, "ArmAapcs"),
                    CallConvention::CCmseNonSecureCall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 8u32, "CCmseNonSecureCall"),
                    CallConvention::CCmseNonSecureEntry =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 9u32, "CCmseNonSecureEntry"),
                    CallConvention::Msp430Intr =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 10u32, "Msp430Intr"),
                    CallConvention::PtxKernel =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 11u32, "PtxKernel"),
                    CallConvention::GpuKernel =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 12u32, "GpuKernel"),
                    CallConvention::X86Fastcall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 13u32, "X86Fastcall"),
                    CallConvention::X86Intr =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 14u32, "X86Intr"),
                    CallConvention::X86Stdcall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 15u32, "X86Stdcall"),
                    CallConvention::X86ThisCall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 16u32, "X86ThisCall"),
                    CallConvention::X86VectorCall =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 17u32, "X86VectorCall"),
                    CallConvention::X86_64SysV =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 18u32, "X86_64SysV"),
                    CallConvention::X86_64Win64 =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 19u32, "X86_64Win64"),
                    CallConvention::AvrInterrupt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 20u32, "AvrInterrupt"),
                    CallConvention::AvrNonBlockingInterrupt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 21u32, "AvrNonBlockingInterrupt"),
                    CallConvention::RiscvInterrupt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CallConvention", 22u32, "RiscvInterrupt"),
                }
            }
        }
    };Serialize)]
450pub enum CallConvention {
451    C,
452    Rust,
453
454    Cold,
455    PreserveMost,
456    PreserveAll,
457    PreserveNone,
458
459    Custom,
460
461    // Target-specific calling conventions.
462    ArmAapcs,
463    CCmseNonSecureCall,
464    CCmseNonSecureEntry,
465
466    Msp430Intr,
467
468    PtxKernel,
469
470    GpuKernel,
471
472    X86Fastcall,
473    X86Intr,
474    X86Stdcall,
475    X86ThisCall,
476    X86VectorCall,
477
478    X86_64SysV,
479    X86_64Win64,
480
481    AvrInterrupt,
482    AvrNonBlockingInterrupt,
483
484    RiscvInterrupt,
485}
486
487#[non_exhaustive]
488#[derive(#[automatically_derived]
impl ::core::marker::Copy for ReprFlags { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ReprFlags {
    #[inline]
    fn clone(&self) -> ReprFlags {
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for ReprFlags {
    #[inline]
    fn eq(&self, other: &ReprFlags) -> 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: &ReprFlags)
        -> ::core::option::Option<::core::cmp::Ordering> {
        match ::core::cmp::PartialOrd::partial_cmp(&self.is_simd,
                &other.is_simd) {
            ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
                match ::core::cmp::PartialOrd::partial_cmp(&self.is_c,
                        &other.is_c) {
                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                        =>
                        match ::core::cmp::PartialOrd::partial_cmp(&self.is_transparent,
                                &other.is_transparent) {
                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                =>
                                ::core::cmp::PartialOrd::partial_cmp(&self.is_linear,
                                    &other.is_linear),
                            cmp => cmp,
                        },
                    cmp => cmp,
                },
            cmp => cmp,
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for ReprFlags {
    #[inline]
    fn cmp(&self, other: &ReprFlags) -> ::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)]
489pub struct ReprFlags {
490    pub is_simd: bool,
491    pub is_c: bool,
492    pub is_transparent: bool,
493    pub is_linear: bool,
494}
495
496#[derive(#[automatically_derived]
impl ::core::marker::Copy for IntegerType { }Copy, #[automatically_derived]
impl ::core::clone::Clone for IntegerType {
    #[inline]
    fn clone(&self) -> IntegerType {
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<IntegerLength>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for IntegerType {
    #[inline]
    fn eq(&self, other: &IntegerType) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (IntegerType::Pointer { is_signed: __self_0 },
                    IntegerType::Pointer { is_signed: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                (IntegerType::Fixed { length: __self_0, is_signed: __self_1 },
                    IntegerType::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: &IntegerType)
        -> ::core::option::Option<::core::cmp::Ordering> {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        match (self, other) {
            (IntegerType::Pointer { is_signed: __self_0 },
                IntegerType::Pointer { is_signed: __arg1_0 }) =>
                ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
            (IntegerType::Fixed { length: __self_0, is_signed: __self_1 },
                IntegerType::Fixed { length: __arg1_0, is_signed: __arg1_1 })
                =>
                match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0)
                    {
                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                        => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1),
                    cmp => cmp,
                },
            _ =>
                ::core::cmp::PartialOrd::partial_cmp(&__self_discr,
                    &__arg1_discr),
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for IntegerType {
    #[inline]
    fn cmp(&self, other: &IntegerType) -> ::core::cmp::Ordering {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) {
            ::core::cmp::Ordering::Equal =>
                match (self, other) {
                    (IntegerType::Pointer { is_signed: __self_0 },
                        IntegerType::Pointer { is_signed: __arg1_0 }) =>
                        ::core::cmp::Ord::cmp(__self_0, __arg1_0),
                    (IntegerType::Fixed { length: __self_0, is_signed: __self_1
                        }, IntegerType::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,
                        },
                    _ => unsafe { ::core::intrinsics::unreachable() }
                },
            cmp => cmp,
        }
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for IntegerType {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            IntegerType::Pointer { is_signed: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
            IntegerType::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 {
            IntegerType::Pointer { is_signed: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Pointer", "is_signed", &__self_0),
            IntegerType::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)]
497pub enum IntegerType {
498    /// Pointer-sized integer type, i.e. `isize` and `usize`.
499    Pointer {
500        /// Signedness. e.g. `true` for `isize`
501        is_signed: bool,
502    },
503    /// Fixed-sized integer type, e.g. `i8`, `u32`, `i128`.
504    Fixed {
505        /// Length of this integer type. e.g. `IntegerLength::I8` for `u8`.
506        length: IntegerLength,
507        /// Signedness. e.g. `false` for `u8`
508        is_signed: bool,
509    },
510}
511
512/// Representation options provided by the user
513#[non_exhaustive]
514#[derive(#[automatically_derived]
impl ::core::marker::Copy for ReprOptions { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ReprOptions {
    #[inline]
    fn clone(&self) -> ReprOptions {
        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::cmp::PartialEq for ReprOptions {
    #[inline]
    fn eq(&self, other: &ReprOptions) -> 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: &ReprOptions)
        -> ::core::option::Option<::core::cmp::Ordering> {
        match ::core::cmp::PartialOrd::partial_cmp(&self.int, &other.int) {
            ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
                match ::core::cmp::PartialOrd::partial_cmp(&self.align,
                        &other.align) {
                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                        =>
                        match ::core::cmp::PartialOrd::partial_cmp(&self.pack,
                                &other.pack) {
                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                =>
                                ::core::cmp::PartialOrd::partial_cmp(&self.flags,
                                    &other.flags),
                            cmp => cmp,
                        },
                    cmp => cmp,
                },
            cmp => cmp,
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for ReprOptions {
    #[inline]
    fn cmp(&self, other: &ReprOptions) -> ::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)]
515pub struct ReprOptions {
516    pub int: Option<IntegerType>,
517    pub align: Option<Align>,
518    pub pack: Option<Align>,
519    pub flags: ReprFlags,
520}