Skip to main content

rustc_public/mir/
body.rs

1use std::io;
2
3use serde::Serialize;
4
5use crate::compiler_interface::with;
6use crate::mir::pretty::function_body;
7use crate::ty::{
8    AdtDef, ClosureDef, CoroutineClosureDef, CoroutineDef, GenericArgs, MirConst, Movability,
9    Region, RigidTy, Ty, TyConst, TyKind, VariantIdx,
10};
11use crate::{Error, Opaque, Span, Symbol};
12
13/// The rustc_public's IR representation of a single function.
14#[derive(#[automatically_derived]
impl ::core::clone::Clone for Body {
    #[inline]
    fn clone(&self) -> Body {
        Body {
            blocks: ::core::clone::Clone::clone(&self.blocks),
            locals: ::core::clone::Clone::clone(&self.locals),
            arg_count: ::core::clone::Clone::clone(&self.arg_count),
            var_debug_info: ::core::clone::Clone::clone(&self.var_debug_info),
            spread_arg: ::core::clone::Clone::clone(&self.spread_arg),
            span: ::core::clone::Clone::clone(&self.span),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Body {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["blocks", "locals", "arg_count", "var_debug_info", "spread_arg",
                        "span"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.blocks, &self.locals, &self.arg_count,
                        &self.var_debug_info, &self.spread_arg, &&self.span];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "Body", names,
            values)
    }
}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 Body {
            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, "Body",
                            false as usize + 1 + 1 + 1 + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "blocks", &self.blocks)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "locals", &self.locals)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "arg_count", &self.arg_count)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "var_debug_info", &self.var_debug_info)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "spread_arg", &self.spread_arg)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "span", &self.span)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
15pub struct Body {
16    pub blocks: Vec<BasicBlock>,
17
18    /// Declarations of locals within the function.
19    ///
20    /// The first local is the return value pointer, followed by `arg_count`
21    /// locals for the function arguments, followed by any user-declared
22    /// variables and temporaries.
23    pub(super) locals: LocalDecls,
24
25    /// The number of arguments this function takes.
26    pub(super) arg_count: usize,
27
28    /// Debug information pertaining to user variables, including captures.
29    pub var_debug_info: Vec<VarDebugInfo>,
30
31    /// Mark an argument (which must be a tuple) as getting passed as its individual components.
32    ///
33    /// This is used for the "rust-call" ABI such as closures.
34    pub(super) spread_arg: Option<Local>,
35
36    /// The span that covers the entire function body.
37    pub span: Span,
38}
39
40pub type BasicBlockIdx = usize;
41
42impl Body {
43    /// Constructs a `Body`.
44    ///
45    /// A constructor is required to build a `Body` from outside the crate
46    /// because the `arg_count` and `locals` fields are private.
47    pub fn new(
48        blocks: Vec<BasicBlock>,
49        locals: LocalDecls,
50        arg_count: usize,
51        var_debug_info: Vec<VarDebugInfo>,
52        spread_arg: Option<Local>,
53        span: Span,
54    ) -> Self {
55        // If locals doesn't contain enough entries, it can lead to panics in
56        // `ret_local`, `arg_locals`, and `inner_locals`.
57        if !(locals.len() > arg_count) {
    {
        ::core::panicking::panic_fmt(format_args!("A Body must contain at least a local for the return value and each of the function\'s arguments"));
    }
};assert!(
58            locals.len() > arg_count,
59            "A Body must contain at least a local for the return value and each of the function's arguments"
60        );
61        Self { blocks, locals, arg_count, var_debug_info, spread_arg, span }
62    }
63
64    /// Return local that holds this function's return value.
65    pub fn ret_local(&self) -> &LocalDecl {
66        &self.locals[RETURN_LOCAL]
67    }
68
69    /// Locals in `self` that correspond to this function's arguments.
70    pub fn arg_locals(&self) -> &[LocalDecl] {
71        &self.locals[1..][..self.arg_count]
72    }
73
74    /// Inner locals for this function. These are the locals that are
75    /// neither the return local nor the argument locals.
76    pub fn inner_locals(&self) -> &[LocalDecl] {
77        &self.locals[self.arg_count + 1..]
78    }
79
80    /// Returns a mutable reference to the local that holds this function's return value.
81    pub(crate) fn ret_local_mut(&mut self) -> &mut LocalDecl {
82        &mut self.locals[RETURN_LOCAL]
83    }
84
85    /// Returns a mutable slice of locals corresponding to this function's arguments.
86    pub(crate) fn arg_locals_mut(&mut self) -> &mut [LocalDecl] {
87        &mut self.locals[1..][..self.arg_count]
88    }
89
90    /// Returns a mutable slice of inner locals for this function.
91    /// Inner locals are those that are neither the return local nor the argument locals.
92    pub(crate) fn inner_locals_mut(&mut self) -> &mut [LocalDecl] {
93        &mut self.locals[self.arg_count + 1..]
94    }
95
96    /// Convenience function to get all the locals in this function.
97    ///
98    /// Locals are typically accessed via the more specific methods `ret_local`,
99    /// `arg_locals`, and `inner_locals`.
100    pub fn locals(&self) -> &[LocalDecl] {
101        &self.locals
102    }
103
104    /// Get the local declaration for this local.
105    pub fn local_decl(&self, local: Local) -> Option<&LocalDecl> {
106        self.locals.get(local)
107    }
108
109    /// Get an iterator for all local declarations.
110    pub fn local_decls(&self) -> impl Iterator<Item = (Local, &LocalDecl)> {
111        self.locals.iter().enumerate()
112    }
113
114    /// Emit the body using the provided name for the signature.
115    pub fn dump<W: io::Write>(&self, w: &mut W, fn_name: &str) -> io::Result<()> {
116        function_body(w, self, fn_name)
117    }
118
119    pub fn spread_arg(&self) -> Option<Local> {
120        self.spread_arg
121    }
122}
123
124type LocalDecls = Vec<LocalDecl>;
125
126#[derive(#[automatically_derived]
impl ::core::clone::Clone for LocalDecl {
    #[inline]
    fn clone(&self) -> LocalDecl {
        LocalDecl {
            ty: ::core::clone::Clone::clone(&self.ty),
            span: ::core::clone::Clone::clone(&self.span),
            mutability: ::core::clone::Clone::clone(&self.mutability),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for LocalDecl {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "LocalDecl",
            "ty", &self.ty, "span", &self.span, "mutability",
            &&self.mutability)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for LocalDecl {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Ty>;
        let _: ::core::cmp::AssertParamIsEq<Span>;
        let _: ::core::cmp::AssertParamIsEq<Mutability>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for LocalDecl {
    #[inline]
    fn eq(&self, other: &LocalDecl) -> bool {
        self.ty == other.ty && self.span == other.span &&
            self.mutability == other.mutability
    }
}PartialEq, #[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 LocalDecl {
            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,
                            "LocalDecl", 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,
                        "span", &self.span)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "mutability", &self.mutability)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
127pub struct LocalDecl {
128    pub ty: Ty,
129    pub span: Span,
130    pub mutability: Mutability,
131}
132
133#[derive(#[automatically_derived]
impl ::core::clone::Clone for BasicBlock {
    #[inline]
    fn clone(&self) -> BasicBlock {
        BasicBlock {
            statements: ::core::clone::Clone::clone(&self.statements),
            terminator: ::core::clone::Clone::clone(&self.terminator),
        }
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for BasicBlock {
    #[inline]
    fn eq(&self, other: &BasicBlock) -> bool {
        self.statements == other.statements &&
            self.terminator == other.terminator
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for BasicBlock {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Vec<Statement>>;
        let _: ::core::cmp::AssertParamIsEq<Terminator>;
    }
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for BasicBlock {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "BasicBlock",
            "statements", &self.statements, "terminator", &&self.terminator)
    }
}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 BasicBlock {
            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,
                            "BasicBlock", false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "statements", &self.statements)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "terminator", &self.terminator)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
134pub struct BasicBlock {
135    pub statements: Vec<Statement>,
136    pub terminator: Terminator,
137}
138
139#[derive(#[automatically_derived]
impl ::core::clone::Clone for Terminator {
    #[inline]
    fn clone(&self) -> Terminator {
        Terminator {
            kind: ::core::clone::Clone::clone(&self.kind),
            span: ::core::clone::Clone::clone(&self.span),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Terminator {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "Terminator",
            "kind", &self.kind, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for Terminator {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<TerminatorKind>;
        let _: ::core::cmp::AssertParamIsEq<Span>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for Terminator {
    #[inline]
    fn eq(&self, other: &Terminator) -> bool {
        self.kind == other.kind && self.span == other.span
    }
}PartialEq, #[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 Terminator {
            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,
                            "Terminator", false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "kind", &self.kind)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "span", &self.span)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
140pub struct Terminator {
141    pub kind: TerminatorKind,
142    pub span: Span,
143}
144
145impl Terminator {
146    pub fn successors(&self) -> Successors {
147        self.kind.successors()
148    }
149}
150
151pub type Successors = Vec<BasicBlockIdx>;
152
153#[derive(#[automatically_derived]
impl ::core::clone::Clone for TerminatorKind {
    #[inline]
    fn clone(&self) -> TerminatorKind {
        match self {
            TerminatorKind::Goto { target: __self_0 } =>
                TerminatorKind::Goto {
                    target: ::core::clone::Clone::clone(__self_0),
                },
            TerminatorKind::SwitchInt { discr: __self_0, targets: __self_1 }
                =>
                TerminatorKind::SwitchInt {
                    discr: ::core::clone::Clone::clone(__self_0),
                    targets: ::core::clone::Clone::clone(__self_1),
                },
            TerminatorKind::Resume => TerminatorKind::Resume,
            TerminatorKind::Abort => TerminatorKind::Abort,
            TerminatorKind::Return => TerminatorKind::Return,
            TerminatorKind::Unreachable => TerminatorKind::Unreachable,
            TerminatorKind::Drop {
                place: __self_0, target: __self_1, unwind: __self_2 } =>
                TerminatorKind::Drop {
                    place: ::core::clone::Clone::clone(__self_0),
                    target: ::core::clone::Clone::clone(__self_1),
                    unwind: ::core::clone::Clone::clone(__self_2),
                },
            TerminatorKind::Call {
                func: __self_0,
                args: __self_1,
                destination: __self_2,
                target: __self_3,
                unwind: __self_4 } =>
                TerminatorKind::Call {
                    func: ::core::clone::Clone::clone(__self_0),
                    args: ::core::clone::Clone::clone(__self_1),
                    destination: ::core::clone::Clone::clone(__self_2),
                    target: ::core::clone::Clone::clone(__self_3),
                    unwind: ::core::clone::Clone::clone(__self_4),
                },
            TerminatorKind::Assert {
                cond: __self_0,
                expected: __self_1,
                msg: __self_2,
                target: __self_3,
                unwind: __self_4 } =>
                TerminatorKind::Assert {
                    cond: ::core::clone::Clone::clone(__self_0),
                    expected: ::core::clone::Clone::clone(__self_1),
                    msg: ::core::clone::Clone::clone(__self_2),
                    target: ::core::clone::Clone::clone(__self_3),
                    unwind: ::core::clone::Clone::clone(__self_4),
                },
            TerminatorKind::InlineAsm {
                template: __self_0,
                operands: __self_1,
                options: __self_2,
                line_spans: __self_3,
                destination: __self_4,
                unwind: __self_5 } =>
                TerminatorKind::InlineAsm {
                    template: ::core::clone::Clone::clone(__self_0),
                    operands: ::core::clone::Clone::clone(__self_1),
                    options: ::core::clone::Clone::clone(__self_2),
                    line_spans: ::core::clone::Clone::clone(__self_3),
                    destination: ::core::clone::Clone::clone(__self_4),
                    unwind: ::core::clone::Clone::clone(__self_5),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for TerminatorKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            TerminatorKind::Goto { target: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Goto",
                    "target", &__self_0),
            TerminatorKind::SwitchInt { discr: __self_0, targets: __self_1 }
                =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "SwitchInt", "discr", __self_0, "targets", &__self_1),
            TerminatorKind::Resume =>
                ::core::fmt::Formatter::write_str(f, "Resume"),
            TerminatorKind::Abort =>
                ::core::fmt::Formatter::write_str(f, "Abort"),
            TerminatorKind::Return =>
                ::core::fmt::Formatter::write_str(f, "Return"),
            TerminatorKind::Unreachable =>
                ::core::fmt::Formatter::write_str(f, "Unreachable"),
            TerminatorKind::Drop {
                place: __self_0, target: __self_1, unwind: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f, "Drop",
                    "place", __self_0, "target", __self_1, "unwind", &__self_2),
            TerminatorKind::Call {
                func: __self_0,
                args: __self_1,
                destination: __self_2,
                target: __self_3,
                unwind: __self_4 } =>
                ::core::fmt::Formatter::debug_struct_field5_finish(f, "Call",
                    "func", __self_0, "args", __self_1, "destination", __self_2,
                    "target", __self_3, "unwind", &__self_4),
            TerminatorKind::Assert {
                cond: __self_0,
                expected: __self_1,
                msg: __self_2,
                target: __self_3,
                unwind: __self_4 } =>
                ::core::fmt::Formatter::debug_struct_field5_finish(f,
                    "Assert", "cond", __self_0, "expected", __self_1, "msg",
                    __self_2, "target", __self_3, "unwind", &__self_4),
            TerminatorKind::InlineAsm {
                template: __self_0,
                operands: __self_1,
                options: __self_2,
                line_spans: __self_3,
                destination: __self_4,
                unwind: __self_5 } => {
                let names: &'static _ =
                    &["template", "operands", "options", "line_spans",
                                "destination", "unwind"];
                let values: &[&dyn ::core::fmt::Debug] =
                    &[__self_0, __self_1, __self_2, __self_3, __self_4,
                                &__self_5];
                ::core::fmt::Formatter::debug_struct_fields_finish(f,
                    "InlineAsm", names, values)
            }
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for TerminatorKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<BasicBlockIdx>;
        let _: ::core::cmp::AssertParamIsEq<Operand>;
        let _: ::core::cmp::AssertParamIsEq<SwitchTargets>;
        let _: ::core::cmp::AssertParamIsEq<Place>;
        let _: ::core::cmp::AssertParamIsEq<UnwindAction>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Operand>>;
        let _: ::core::cmp::AssertParamIsEq<Option<BasicBlockIdx>>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<AssertMessage>;
        let _: ::core::cmp::AssertParamIsEq<String>;
        let _: ::core::cmp::AssertParamIsEq<Vec<InlineAsmOperand>>;
        let _: ::core::cmp::AssertParamIsEq<Option<BasicBlockIdx>>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for TerminatorKind {
    #[inline]
    fn eq(&self, other: &TerminatorKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (TerminatorKind::Goto { target: __self_0 },
                    TerminatorKind::Goto { target: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                (TerminatorKind::SwitchInt {
                    discr: __self_0, targets: __self_1 },
                    TerminatorKind::SwitchInt {
                    discr: __arg1_0, targets: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (TerminatorKind::Drop {
                    place: __self_0, target: __self_1, unwind: __self_2 },
                    TerminatorKind::Drop {
                    place: __arg1_0, target: __arg1_1, unwind: __arg1_2 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (TerminatorKind::Call {
                    func: __self_0,
                    args: __self_1,
                    destination: __self_2,
                    target: __self_3,
                    unwind: __self_4 }, TerminatorKind::Call {
                    func: __arg1_0,
                    args: __arg1_1,
                    destination: __arg1_2,
                    target: __arg1_3,
                    unwind: __arg1_4 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                                __self_2 == __arg1_2 && __self_3 == __arg1_3 &&
                        __self_4 == __arg1_4,
                (TerminatorKind::Assert {
                    cond: __self_0,
                    expected: __self_1,
                    msg: __self_2,
                    target: __self_3,
                    unwind: __self_4 }, TerminatorKind::Assert {
                    cond: __arg1_0,
                    expected: __arg1_1,
                    msg: __arg1_2,
                    target: __arg1_3,
                    unwind: __arg1_4 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0 &&
                                __self_2 == __arg1_2 && __self_3 == __arg1_3 &&
                        __self_4 == __arg1_4,
                (TerminatorKind::InlineAsm {
                    template: __self_0,
                    operands: __self_1,
                    options: __self_2,
                    line_spans: __self_3,
                    destination: __self_4,
                    unwind: __self_5 }, TerminatorKind::InlineAsm {
                    template: __arg1_0,
                    operands: __arg1_1,
                    options: __arg1_2,
                    line_spans: __arg1_3,
                    destination: __arg1_4,
                    unwind: __arg1_5 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                                    __self_2 == __arg1_2 && __self_3 == __arg1_3 &&
                            __self_4 == __arg1_4 && __self_5 == __arg1_5,
                _ => true,
            }
    }
}PartialEq, #[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 TerminatorKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    TerminatorKind::Goto { ref target } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "TerminatorKind", 0u32, "Goto", 0 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "target", target)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    TerminatorKind::SwitchInt { ref discr, ref targets } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "TerminatorKind", 1u32, "SwitchInt", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "discr", discr)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "targets", targets)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    TerminatorKind::Resume =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "TerminatorKind", 2u32, "Resume"),
                    TerminatorKind::Abort =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "TerminatorKind", 3u32, "Abort"),
                    TerminatorKind::Return =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "TerminatorKind", 4u32, "Return"),
                    TerminatorKind::Unreachable =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "TerminatorKind", 5u32, "Unreachable"),
                    TerminatorKind::Drop { ref place, ref target, ref unwind }
                        => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "TerminatorKind", 6u32, "Drop", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "place", place)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "target", target)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "unwind", unwind)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    TerminatorKind::Call {
                        ref func, ref args, ref destination, ref target, ref unwind
                        } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "TerminatorKind", 7u32, "Call", 0 + 1 + 1 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "func", func)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "args", args)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "destination", destination)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "target", target)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "unwind", unwind)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    TerminatorKind::Assert {
                        ref cond, ref expected, ref msg, ref target, ref unwind } =>
                        {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "TerminatorKind", 8u32, "Assert", 0 + 1 + 1 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "cond", cond)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "expected", expected)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "msg", msg)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "target", target)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "unwind", unwind)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    TerminatorKind::InlineAsm {
                        ref template,
                        ref operands,
                        ref options,
                        ref line_spans,
                        ref destination,
                        ref unwind } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "TerminatorKind", 9u32, "InlineAsm",
                                    0 + 1 + 1 + 1 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "template", template)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "operands", operands)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "options", options)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "line_spans", line_spans)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "destination", destination)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "unwind", unwind)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
154pub enum TerminatorKind {
155    Goto {
156        target: BasicBlockIdx,
157    },
158    SwitchInt {
159        discr: Operand,
160        targets: SwitchTargets,
161    },
162    Resume,
163    Abort,
164    Return,
165    Unreachable,
166    Drop {
167        place: Place,
168        target: BasicBlockIdx,
169        unwind: UnwindAction,
170    },
171    Call {
172        func: Operand,
173        args: Vec<Operand>,
174        destination: Place,
175        target: Option<BasicBlockIdx>,
176        unwind: UnwindAction,
177    },
178    Assert {
179        cond: Operand,
180        expected: bool,
181        msg: AssertMessage,
182        target: BasicBlockIdx,
183        unwind: UnwindAction,
184    },
185    InlineAsm {
186        template: String,
187        operands: Vec<InlineAsmOperand>,
188        options: String,
189        line_spans: String,
190        destination: Option<BasicBlockIdx>,
191        unwind: UnwindAction,
192    },
193}
194
195impl TerminatorKind {
196    pub fn successors(&self) -> Successors {
197        use self::TerminatorKind::*;
198        match *self {
199            Call { target: Some(t), unwind: UnwindAction::Cleanup(u), .. }
200            | Drop { target: t, unwind: UnwindAction::Cleanup(u), .. }
201            | Assert { target: t, unwind: UnwindAction::Cleanup(u), .. }
202            | InlineAsm { destination: Some(t), unwind: UnwindAction::Cleanup(u), .. } => {
203                ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [t, u]))vec![t, u]
204            }
205            Goto { target: t }
206            | Call { target: None, unwind: UnwindAction::Cleanup(t), .. }
207            | Call { target: Some(t), unwind: _, .. }
208            | Drop { target: t, unwind: _, .. }
209            | Assert { target: t, unwind: _, .. }
210            | InlineAsm { destination: None, unwind: UnwindAction::Cleanup(t), .. }
211            | InlineAsm { destination: Some(t), unwind: _, .. } => {
212                ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [t]))vec![t]
213            }
214
215            Return
216            | Resume
217            | Abort
218            | Unreachable
219            | Call { target: None, unwind: _, .. }
220            | InlineAsm { destination: None, unwind: _, .. } => {
221                ::alloc::vec::Vec::new()vec![]
222            }
223            SwitchInt { ref targets, .. } => targets.all_targets(),
224        }
225    }
226
227    pub fn unwind(&self) -> Option<&UnwindAction> {
228        match *self {
229            TerminatorKind::Goto { .. }
230            | TerminatorKind::Return
231            | TerminatorKind::Unreachable
232            | TerminatorKind::Resume
233            | TerminatorKind::Abort
234            | TerminatorKind::SwitchInt { .. } => None,
235            TerminatorKind::Call { ref unwind, .. }
236            | TerminatorKind::Assert { ref unwind, .. }
237            | TerminatorKind::Drop { ref unwind, .. }
238            | TerminatorKind::InlineAsm { ref unwind, .. } => Some(unwind),
239        }
240    }
241}
242
243#[derive(#[automatically_derived]
impl ::core::clone::Clone for InlineAsmOperand {
    #[inline]
    fn clone(&self) -> InlineAsmOperand {
        InlineAsmOperand {
            in_value: ::core::clone::Clone::clone(&self.in_value),
            out_place: ::core::clone::Clone::clone(&self.out_place),
            raw_rpr: ::core::clone::Clone::clone(&self.raw_rpr),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for InlineAsmOperand {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "InlineAsmOperand", "in_value", &self.in_value, "out_place",
            &self.out_place, "raw_rpr", &&self.raw_rpr)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for InlineAsmOperand {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Option<Operand>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Place>>;
        let _: ::core::cmp::AssertParamIsEq<String>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for InlineAsmOperand {
    #[inline]
    fn eq(&self, other: &InlineAsmOperand) -> bool {
        self.in_value == other.in_value && self.out_place == other.out_place
            && self.raw_rpr == other.raw_rpr
    }
}PartialEq, #[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 InlineAsmOperand {
            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,
                            "InlineAsmOperand", false as usize + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "in_value", &self.in_value)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "out_place", &self.out_place)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "raw_rpr", &self.raw_rpr)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
244pub struct InlineAsmOperand {
245    pub in_value: Option<Operand>,
246    pub out_place: Option<Place>,
247    // This field has a raw debug representation of MIR's InlineAsmOperand.
248    // For now we care about place/operand + the rest in a debug format.
249    pub raw_rpr: String,
250}
251
252#[derive(#[automatically_derived]
impl ::core::marker::Copy for UnwindAction { }Copy, #[automatically_derived]
impl ::core::clone::Clone for UnwindAction {
    #[inline]
    fn clone(&self) -> UnwindAction {
        let _: ::core::clone::AssertParamIsClone<BasicBlockIdx>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for UnwindAction {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            UnwindAction::Continue =>
                ::core::fmt::Formatter::write_str(f, "Continue"),
            UnwindAction::Unreachable =>
                ::core::fmt::Formatter::write_str(f, "Unreachable"),
            UnwindAction::Terminate =>
                ::core::fmt::Formatter::write_str(f, "Terminate"),
            UnwindAction::Cleanup(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Cleanup", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for UnwindAction {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<BasicBlockIdx>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for UnwindAction {
    #[inline]
    fn eq(&self, other: &UnwindAction) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (UnwindAction::Cleanup(__self_0),
                    UnwindAction::Cleanup(__arg1_0)) => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[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 UnwindAction {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    UnwindAction::Continue =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "UnwindAction", 0u32, "Continue"),
                    UnwindAction::Unreachable =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "UnwindAction", 1u32, "Unreachable"),
                    UnwindAction::Terminate =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "UnwindAction", 2u32, "Terminate"),
                    UnwindAction::Cleanup(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "UnwindAction", 3u32, "Cleanup", __field0),
                }
            }
        }
    };Serialize)]
253pub enum UnwindAction {
254    Continue,
255    Unreachable,
256    Terminate,
257    Cleanup(BasicBlockIdx),
258}
259
260#[derive(#[automatically_derived]
impl ::core::clone::Clone for AssertMessage {
    #[inline]
    fn clone(&self) -> AssertMessage {
        match self {
            AssertMessage::BoundsCheck { len: __self_0, index: __self_1 } =>
                AssertMessage::BoundsCheck {
                    len: ::core::clone::Clone::clone(__self_0),
                    index: ::core::clone::Clone::clone(__self_1),
                },
            AssertMessage::Overflow(__self_0, __self_1, __self_2) =>
                AssertMessage::Overflow(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2)),
            AssertMessage::OverflowNeg(__self_0) =>
                AssertMessage::OverflowNeg(::core::clone::Clone::clone(__self_0)),
            AssertMessage::DivisionByZero(__self_0) =>
                AssertMessage::DivisionByZero(::core::clone::Clone::clone(__self_0)),
            AssertMessage::RemainderByZero(__self_0) =>
                AssertMessage::RemainderByZero(::core::clone::Clone::clone(__self_0)),
            AssertMessage::ResumedAfterReturn(__self_0) =>
                AssertMessage::ResumedAfterReturn(::core::clone::Clone::clone(__self_0)),
            AssertMessage::ResumedAfterPanic(__self_0) =>
                AssertMessage::ResumedAfterPanic(::core::clone::Clone::clone(__self_0)),
            AssertMessage::ResumedAfterDrop(__self_0) =>
                AssertMessage::ResumedAfterDrop(::core::clone::Clone::clone(__self_0)),
            AssertMessage::MisalignedPointerDereference {
                required: __self_0, found: __self_1 } =>
                AssertMessage::MisalignedPointerDereference {
                    required: ::core::clone::Clone::clone(__self_0),
                    found: ::core::clone::Clone::clone(__self_1),
                },
            AssertMessage::NullPointerDereference =>
                AssertMessage::NullPointerDereference,
            AssertMessage::InvalidEnumConstruction(__self_0) =>
                AssertMessage::InvalidEnumConstruction(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AssertMessage {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            AssertMessage::BoundsCheck { len: __self_0, index: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "BoundsCheck", "len", __self_0, "index", &__self_1),
            AssertMessage::Overflow(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f,
                    "Overflow", __self_0, __self_1, &__self_2),
            AssertMessage::OverflowNeg(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "OverflowNeg", &__self_0),
            AssertMessage::DivisionByZero(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "DivisionByZero", &__self_0),
            AssertMessage::RemainderByZero(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "RemainderByZero", &__self_0),
            AssertMessage::ResumedAfterReturn(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ResumedAfterReturn", &__self_0),
            AssertMessage::ResumedAfterPanic(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ResumedAfterPanic", &__self_0),
            AssertMessage::ResumedAfterDrop(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ResumedAfterDrop", &__self_0),
            AssertMessage::MisalignedPointerDereference {
                required: __self_0, found: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "MisalignedPointerDereference", "required", __self_0,
                    "found", &__self_1),
            AssertMessage::NullPointerDereference =>
                ::core::fmt::Formatter::write_str(f,
                    "NullPointerDereference"),
            AssertMessage::InvalidEnumConstruction(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "InvalidEnumConstruction", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for AssertMessage {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Operand>;
        let _: ::core::cmp::AssertParamIsEq<BinOp>;
        let _: ::core::cmp::AssertParamIsEq<CoroutineKind>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for AssertMessage {
    #[inline]
    fn eq(&self, other: &AssertMessage) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (AssertMessage::BoundsCheck { len: __self_0, index: __self_1
                    }, AssertMessage::BoundsCheck {
                    len: __arg1_0, index: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (AssertMessage::Overflow(__self_0, __self_1, __self_2),
                    AssertMessage::Overflow(__arg1_0, __arg1_1, __arg1_2)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (AssertMessage::OverflowNeg(__self_0),
                    AssertMessage::OverflowNeg(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (AssertMessage::DivisionByZero(__self_0),
                    AssertMessage::DivisionByZero(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (AssertMessage::RemainderByZero(__self_0),
                    AssertMessage::RemainderByZero(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (AssertMessage::ResumedAfterReturn(__self_0),
                    AssertMessage::ResumedAfterReturn(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (AssertMessage::ResumedAfterPanic(__self_0),
                    AssertMessage::ResumedAfterPanic(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (AssertMessage::ResumedAfterDrop(__self_0),
                    AssertMessage::ResumedAfterDrop(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (AssertMessage::MisalignedPointerDereference {
                    required: __self_0, found: __self_1 },
                    AssertMessage::MisalignedPointerDereference {
                    required: __arg1_0, found: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (AssertMessage::InvalidEnumConstruction(__self_0),
                    AssertMessage::InvalidEnumConstruction(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[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 AssertMessage {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    AssertMessage::BoundsCheck { ref len, ref index } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "AssertMessage", 0u32, "BoundsCheck", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "len", len)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "index", index)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    AssertMessage::Overflow(ref __field0, ref __field1,
                        ref __field2) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "AssertMessage", 1u32, "Overflow", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field0)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field2)?;
                        _serde::ser::SerializeTupleVariant::end(__serde_state)
                    }
                    AssertMessage::OverflowNeg(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "AssertMessage", 2u32, "OverflowNeg", __field0),
                    AssertMessage::DivisionByZero(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "AssertMessage", 3u32, "DivisionByZero", __field0),
                    AssertMessage::RemainderByZero(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "AssertMessage", 4u32, "RemainderByZero", __field0),
                    AssertMessage::ResumedAfterReturn(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "AssertMessage", 5u32, "ResumedAfterReturn", __field0),
                    AssertMessage::ResumedAfterPanic(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "AssertMessage", 6u32, "ResumedAfterPanic", __field0),
                    AssertMessage::ResumedAfterDrop(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "AssertMessage", 7u32, "ResumedAfterDrop", __field0),
                    AssertMessage::MisalignedPointerDereference {
                        ref required, ref found } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "AssertMessage", 8u32, "MisalignedPointerDereference",
                                    0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "required", required)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "found", found)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    AssertMessage::NullPointerDereference =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "AssertMessage", 9u32, "NullPointerDereference"),
                    AssertMessage::InvalidEnumConstruction(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "AssertMessage", 10u32, "InvalidEnumConstruction",
                            __field0),
                }
            }
        }
    };Serialize)]
261pub enum AssertMessage {
262    BoundsCheck { len: Operand, index: Operand },
263    Overflow(BinOp, Operand, Operand),
264    OverflowNeg(Operand),
265    DivisionByZero(Operand),
266    RemainderByZero(Operand),
267    ResumedAfterReturn(CoroutineKind),
268    ResumedAfterPanic(CoroutineKind),
269    ResumedAfterDrop(CoroutineKind),
270    MisalignedPointerDereference { required: Operand, found: Operand },
271    NullPointerDereference,
272    InvalidEnumConstruction(Operand),
273}
274
275impl AssertMessage {
276    pub fn description(&self) -> Result<&'static str, Error> {
277        match self {
278            AssertMessage::Overflow(BinOp::Add, _, _) => Ok("attempt to add with overflow"),
279            AssertMessage::Overflow(BinOp::Sub, _, _) => Ok("attempt to subtract with overflow"),
280            AssertMessage::Overflow(BinOp::Mul, _, _) => Ok("attempt to multiply with overflow"),
281            AssertMessage::Overflow(BinOp::Div, _, _) => Ok("attempt to divide with overflow"),
282            AssertMessage::Overflow(BinOp::Rem, _, _) => {
283                Ok("attempt to calculate the remainder with overflow")
284            }
285            AssertMessage::OverflowNeg(_) => Ok("attempt to negate with overflow"),
286            AssertMessage::Overflow(BinOp::Shr, _, _) => Ok("attempt to shift right with overflow"),
287            AssertMessage::Overflow(BinOp::Shl, _, _) => Ok("attempt to shift left with overflow"),
288            AssertMessage::Overflow(op, _, _) => Err(Error(::alloc::__export::must_use({
            ::alloc::fmt::format(format_args!("`{0:?}` cannot overflow", op))
        }))error!("`{:?}` cannot overflow", op)),
289            AssertMessage::DivisionByZero(_) => Ok("attempt to divide by zero"),
290            AssertMessage::RemainderByZero(_) => {
291                Ok("attempt to calculate the remainder with a divisor of zero")
292            }
293            AssertMessage::ResumedAfterReturn(CoroutineKind::Coroutine(_)) => {
294                Ok("coroutine resumed after completion")
295            }
296            AssertMessage::ResumedAfterReturn(CoroutineKind::Desugared(
297                CoroutineDesugaring::Async,
298                _,
299            )) => Ok("`async fn` resumed after completion"),
300            AssertMessage::ResumedAfterReturn(CoroutineKind::Desugared(
301                CoroutineDesugaring::Gen,
302                _,
303            )) => Ok("`async gen fn` resumed after completion"),
304            AssertMessage::ResumedAfterReturn(CoroutineKind::Desugared(
305                CoroutineDesugaring::AsyncGen,
306                _,
307            )) => Ok("`gen fn` should just keep returning `AssertMessage::None` after completion"),
308            AssertMessage::ResumedAfterPanic(CoroutineKind::Coroutine(_)) => {
309                Ok("coroutine resumed after panicking")
310            }
311            AssertMessage::ResumedAfterPanic(CoroutineKind::Desugared(
312                CoroutineDesugaring::Async,
313                _,
314            )) => Ok("`async fn` resumed after panicking"),
315            AssertMessage::ResumedAfterPanic(CoroutineKind::Desugared(
316                CoroutineDesugaring::Gen,
317                _,
318            )) => Ok("`async gen fn` resumed after panicking"),
319            AssertMessage::ResumedAfterPanic(CoroutineKind::Desugared(
320                CoroutineDesugaring::AsyncGen,
321                _,
322            )) => Ok("`gen fn` should just keep returning `AssertMessage::None` after panicking"),
323
324            AssertMessage::ResumedAfterDrop(CoroutineKind::Coroutine(_)) => {
325                Ok("coroutine resumed after async drop")
326            }
327            AssertMessage::ResumedAfterDrop(CoroutineKind::Desugared(
328                CoroutineDesugaring::Async,
329                _,
330            )) => Ok("`async fn` resumed after async drop"),
331            AssertMessage::ResumedAfterDrop(CoroutineKind::Desugared(
332                CoroutineDesugaring::Gen,
333                _,
334            )) => Ok("`async gen fn` resumed after async drop"),
335            AssertMessage::ResumedAfterDrop(CoroutineKind::Desugared(
336                CoroutineDesugaring::AsyncGen,
337                _,
338            )) => Ok("`gen fn` should just keep returning `AssertMessage::None` after async drop"),
339
340            AssertMessage::BoundsCheck { .. } => Ok("index out of bounds"),
341            AssertMessage::MisalignedPointerDereference { .. } => {
342                Ok("misaligned pointer dereference")
343            }
344            AssertMessage::NullPointerDereference => Ok("null pointer dereference occurred"),
345            AssertMessage::InvalidEnumConstruction(_) => {
346                Ok("trying to construct an enum from an invalid value")
347            }
348        }
349    }
350}
351
352#[derive(#[automatically_derived]
impl ::core::marker::Copy for BinOp { }Copy, #[automatically_derived]
impl ::core::clone::Clone for BinOp {
    #[inline]
    fn clone(&self) -> BinOp { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for BinOp {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                BinOp::Add => "Add",
                BinOp::AddUnchecked => "AddUnchecked",
                BinOp::Sub => "Sub",
                BinOp::SubUnchecked => "SubUnchecked",
                BinOp::Mul => "Mul",
                BinOp::MulUnchecked => "MulUnchecked",
                BinOp::Div => "Div",
                BinOp::Rem => "Rem",
                BinOp::BitXor => "BitXor",
                BinOp::BitAnd => "BitAnd",
                BinOp::BitOr => "BitOr",
                BinOp::Shl => "Shl",
                BinOp::ShlUnchecked => "ShlUnchecked",
                BinOp::Shr => "Shr",
                BinOp::ShrUnchecked => "ShrUnchecked",
                BinOp::Eq => "Eq",
                BinOp::Lt => "Lt",
                BinOp::Le => "Le",
                BinOp::Ne => "Ne",
                BinOp::Ge => "Ge",
                BinOp::Gt => "Gt",
                BinOp::Cmp => "Cmp",
                BinOp::Offset => "Offset",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for BinOp {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for BinOp {
    #[inline]
    fn eq(&self, other: &BinOp) -> 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::hash::Hash for BinOp {
    #[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 BinOp {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    BinOp::Add =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 0u32, "Add"),
                    BinOp::AddUnchecked =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 1u32, "AddUnchecked"),
                    BinOp::Sub =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 2u32, "Sub"),
                    BinOp::SubUnchecked =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 3u32, "SubUnchecked"),
                    BinOp::Mul =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 4u32, "Mul"),
                    BinOp::MulUnchecked =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 5u32, "MulUnchecked"),
                    BinOp::Div =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 6u32, "Div"),
                    BinOp::Rem =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 7u32, "Rem"),
                    BinOp::BitXor =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 8u32, "BitXor"),
                    BinOp::BitAnd =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 9u32, "BitAnd"),
                    BinOp::BitOr =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 10u32, "BitOr"),
                    BinOp::Shl =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 11u32, "Shl"),
                    BinOp::ShlUnchecked =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 12u32, "ShlUnchecked"),
                    BinOp::Shr =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 13u32, "Shr"),
                    BinOp::ShrUnchecked =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 14u32, "ShrUnchecked"),
                    BinOp::Eq =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 15u32, "Eq"),
                    BinOp::Lt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 16u32, "Lt"),
                    BinOp::Le =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 17u32, "Le"),
                    BinOp::Ne =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 18u32, "Ne"),
                    BinOp::Ge =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 19u32, "Ge"),
                    BinOp::Gt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 20u32, "Gt"),
                    BinOp::Cmp =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 21u32, "Cmp"),
                    BinOp::Offset =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BinOp", 22u32, "Offset"),
                }
            }
        }
    };Serialize)]
353pub enum BinOp {
354    Add,
355    AddUnchecked,
356    Sub,
357    SubUnchecked,
358    Mul,
359    MulUnchecked,
360    Div,
361    Rem,
362    BitXor,
363    BitAnd,
364    BitOr,
365    Shl,
366    ShlUnchecked,
367    Shr,
368    ShrUnchecked,
369    Eq,
370    Lt,
371    Le,
372    Ne,
373    Ge,
374    Gt,
375    Cmp,
376    Offset,
377}
378
379impl BinOp {
380    /// Return the type of this operation for the given input Ty.
381    /// This function does not perform type checking, and it currently doesn't handle SIMD.
382    pub fn ty(&self, lhs_ty: Ty, rhs_ty: Ty) -> Ty {
383        with(|ctx| ctx.binop_ty(*self, lhs_ty, rhs_ty))
384    }
385}
386
387#[derive(#[automatically_derived]
impl ::core::marker::Copy for UnOp { }Copy, #[automatically_derived]
impl ::core::clone::Clone for UnOp {
    #[inline]
    fn clone(&self) -> UnOp { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for UnOp {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                UnOp::Not => "Not",
                UnOp::Neg => "Neg",
                UnOp::PtrMetadata => "PtrMetadata",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for UnOp {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for UnOp {
    #[inline]
    fn eq(&self, other: &UnOp) -> 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::hash::Hash for UnOp {
    #[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 UnOp {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    UnOp::Not =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "UnOp", 0u32, "Not"),
                    UnOp::Neg =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "UnOp", 1u32, "Neg"),
                    UnOp::PtrMetadata =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "UnOp", 2u32, "PtrMetadata"),
                }
            }
        }
    };Serialize)]
388pub enum UnOp {
389    Not,
390    Neg,
391    PtrMetadata,
392}
393
394impl UnOp {
395    /// Return the type of this operation for the given input Ty.
396    /// This function does not perform type checking, and it currently doesn't handle SIMD.
397    pub fn ty(&self, arg_ty: Ty) -> Ty {
398        with(|ctx| ctx.unop_ty(*self, arg_ty))
399    }
400}
401
402#[derive(#[automatically_derived]
impl ::core::clone::Clone for CoroutineKind {
    #[inline]
    fn clone(&self) -> CoroutineKind {
        match self {
            CoroutineKind::Desugared(__self_0, __self_1) =>
                CoroutineKind::Desugared(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            CoroutineKind::Coroutine(__self_0) =>
                CoroutineKind::Coroutine(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CoroutineKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            CoroutineKind::Desugared(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "Desugared", __self_0, &__self_1),
            CoroutineKind::Coroutine(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Coroutine", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for CoroutineKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<CoroutineDesugaring>;
        let _: ::core::cmp::AssertParamIsEq<CoroutineSource>;
        let _: ::core::cmp::AssertParamIsEq<Movability>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for CoroutineKind {
    #[inline]
    fn eq(&self, other: &CoroutineKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (CoroutineKind::Desugared(__self_0, __self_1),
                    CoroutineKind::Desugared(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (CoroutineKind::Coroutine(__self_0),
                    CoroutineKind::Coroutine(__arg1_0)) => __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[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 CoroutineKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    CoroutineKind::Desugared(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "CoroutineKind", 0u32, "Desugared", 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)
                    }
                    CoroutineKind::Coroutine(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "CoroutineKind", 1u32, "Coroutine", __field0),
                }
            }
        }
    };Serialize)]
403pub enum CoroutineKind {
404    Desugared(CoroutineDesugaring, CoroutineSource),
405    Coroutine(Movability),
406}
407
408#[derive(#[automatically_derived]
impl ::core::marker::Copy for CoroutineSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for CoroutineSource {
    #[inline]
    fn clone(&self) -> CoroutineSource { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CoroutineSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CoroutineSource::Block => "Block",
                CoroutineSource::Closure => "Closure",
                CoroutineSource::Fn => "Fn",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for CoroutineSource {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for CoroutineSource {
    #[inline]
    fn eq(&self, other: &CoroutineSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[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 CoroutineSource {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    CoroutineSource::Block =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CoroutineSource", 0u32, "Block"),
                    CoroutineSource::Closure =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CoroutineSource", 1u32, "Closure"),
                    CoroutineSource::Fn =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CoroutineSource", 2u32, "Fn"),
                }
            }
        }
    };Serialize)]
409pub enum CoroutineSource {
410    Block,
411    Closure,
412    Fn,
413}
414
415#[derive(#[automatically_derived]
impl ::core::marker::Copy for CoroutineDesugaring { }Copy, #[automatically_derived]
impl ::core::clone::Clone for CoroutineDesugaring {
    #[inline]
    fn clone(&self) -> CoroutineDesugaring { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CoroutineDesugaring {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CoroutineDesugaring::Async => "Async",
                CoroutineDesugaring::Gen => "Gen",
                CoroutineDesugaring::AsyncGen => "AsyncGen",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for CoroutineDesugaring {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for CoroutineDesugaring {
    #[inline]
    fn eq(&self, other: &CoroutineDesugaring) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[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 CoroutineDesugaring {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    CoroutineDesugaring::Async =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CoroutineDesugaring", 0u32, "Async"),
                    CoroutineDesugaring::Gen =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CoroutineDesugaring", 1u32, "Gen"),
                    CoroutineDesugaring::AsyncGen =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CoroutineDesugaring", 2u32, "AsyncGen"),
                }
            }
        }
    };Serialize)]
416pub enum CoroutineDesugaring {
417    Async,
418
419    Gen,
420
421    AsyncGen,
422}
423
424pub(crate) type LocalDefId = Opaque;
425/// The rustc coverage data structures are heavily tied to internal details of the
426/// coverage implementation that are likely to change, and are unlikely to be
427/// useful to third-party tools for the foreseeable future.
428pub(crate) type Coverage = Opaque;
429
430/// The FakeReadCause describes the type of pattern why a FakeRead statement exists.
431#[derive(#[automatically_derived]
impl ::core::clone::Clone for FakeReadCause {
    #[inline]
    fn clone(&self) -> FakeReadCause {
        match self {
            FakeReadCause::ForMatchGuard => FakeReadCause::ForMatchGuard,
            FakeReadCause::ForMatchedPlace(__self_0) =>
                FakeReadCause::ForMatchedPlace(::core::clone::Clone::clone(__self_0)),
            FakeReadCause::ForGuardBinding => FakeReadCause::ForGuardBinding,
            FakeReadCause::ForLet(__self_0) =>
                FakeReadCause::ForLet(::core::clone::Clone::clone(__self_0)),
            FakeReadCause::ForIndex => FakeReadCause::ForIndex,
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for FakeReadCause {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            FakeReadCause::ForMatchGuard =>
                ::core::fmt::Formatter::write_str(f, "ForMatchGuard"),
            FakeReadCause::ForMatchedPlace(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ForMatchedPlace", &__self_0),
            FakeReadCause::ForGuardBinding =>
                ::core::fmt::Formatter::write_str(f, "ForGuardBinding"),
            FakeReadCause::ForLet(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "ForLet",
                    &__self_0),
            FakeReadCause::ForIndex =>
                ::core::fmt::Formatter::write_str(f, "ForIndex"),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for FakeReadCause {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<LocalDefId>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for FakeReadCause {
    #[inline]
    fn eq(&self, other: &FakeReadCause) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (FakeReadCause::ForMatchedPlace(__self_0),
                    FakeReadCause::ForMatchedPlace(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (FakeReadCause::ForLet(__self_0),
                    FakeReadCause::ForLet(__arg1_0)) => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[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 FakeReadCause {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    FakeReadCause::ForMatchGuard =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FakeReadCause", 0u32, "ForMatchGuard"),
                    FakeReadCause::ForMatchedPlace(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "FakeReadCause", 1u32, "ForMatchedPlace", __field0),
                    FakeReadCause::ForGuardBinding =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FakeReadCause", 2u32, "ForGuardBinding"),
                    FakeReadCause::ForLet(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "FakeReadCause", 3u32, "ForLet", __field0),
                    FakeReadCause::ForIndex =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FakeReadCause", 4u32, "ForIndex"),
                }
            }
        }
    };Serialize)]
432pub enum FakeReadCause {
433    ForMatchGuard,
434    ForMatchedPlace(LocalDefId),
435    ForGuardBinding,
436    ForLet(LocalDefId),
437    ForIndex,
438}
439
440/// Describes what kind of retag is to be performed
441#[derive(#[automatically_derived]
impl ::core::marker::Copy for WithRetag { }Copy, #[automatically_derived]
impl ::core::clone::Clone for WithRetag {
    #[inline]
    fn clone(&self) -> WithRetag { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for WithRetag {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self { WithRetag::Yes => "Yes", WithRetag::No => "No", })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for WithRetag {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for WithRetag {
    #[inline]
    fn eq(&self, other: &WithRetag) -> 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::hash::Hash for WithRetag {
    #[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 WithRetag {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    WithRetag::Yes =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "WithRetag", 0u32, "Yes"),
                    WithRetag::No =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "WithRetag", 1u32, "No"),
                }
            }
        }
    };Serialize)]
442pub enum WithRetag {
443    Yes,
444    No,
445}
446
447#[derive(#[automatically_derived]
impl ::core::marker::Copy for Variance { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Variance {
    #[inline]
    fn clone(&self) -> Variance { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Variance {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                Variance::Covariant => "Covariant",
                Variance::Invariant => "Invariant",
                Variance::Contravariant => "Contravariant",
                Variance::Bivariant => "Bivariant",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for Variance {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for Variance {
    #[inline]
    fn eq(&self, other: &Variance) -> 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::hash::Hash for Variance {
    #[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 Variance {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    Variance::Covariant =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "Variance", 0u32, "Covariant"),
                    Variance::Invariant =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "Variance", 1u32, "Invariant"),
                    Variance::Contravariant =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "Variance", 2u32, "Contravariant"),
                    Variance::Bivariant =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "Variance", 3u32, "Bivariant"),
                }
            }
        }
    };Serialize)]
448pub enum Variance {
449    Covariant,
450    Invariant,
451    Contravariant,
452    Bivariant,
453}
454
455#[derive(#[automatically_derived]
impl ::core::clone::Clone for CopyNonOverlapping {
    #[inline]
    fn clone(&self) -> CopyNonOverlapping {
        CopyNonOverlapping {
            src: ::core::clone::Clone::clone(&self.src),
            dst: ::core::clone::Clone::clone(&self.dst),
            count: ::core::clone::Clone::clone(&self.count),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CopyNonOverlapping {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "CopyNonOverlapping", "src", &self.src, "dst", &self.dst, "count",
            &&self.count)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for CopyNonOverlapping {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Operand>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for CopyNonOverlapping {
    #[inline]
    fn eq(&self, other: &CopyNonOverlapping) -> bool {
        self.src == other.src && self.dst == other.dst &&
            self.count == other.count
    }
}PartialEq, #[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 CopyNonOverlapping {
            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,
                            "CopyNonOverlapping", false as usize + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "src", &self.src)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "dst", &self.dst)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "count", &self.count)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
456pub struct CopyNonOverlapping {
457    pub src: Operand,
458    pub dst: Operand,
459    pub count: Operand,
460}
461
462#[derive(#[automatically_derived]
impl ::core::clone::Clone for NonDivergingIntrinsic {
    #[inline]
    fn clone(&self) -> NonDivergingIntrinsic {
        match self {
            NonDivergingIntrinsic::Assume(__self_0) =>
                NonDivergingIntrinsic::Assume(::core::clone::Clone::clone(__self_0)),
            NonDivergingIntrinsic::CopyNonOverlapping(__self_0) =>
                NonDivergingIntrinsic::CopyNonOverlapping(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for NonDivergingIntrinsic {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            NonDivergingIntrinsic::Assume(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Assume",
                    &__self_0),
            NonDivergingIntrinsic::CopyNonOverlapping(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "CopyNonOverlapping", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for NonDivergingIntrinsic {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Operand>;
        let _: ::core::cmp::AssertParamIsEq<CopyNonOverlapping>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for NonDivergingIntrinsic {
    #[inline]
    fn eq(&self, other: &NonDivergingIntrinsic) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (NonDivergingIntrinsic::Assume(__self_0),
                    NonDivergingIntrinsic::Assume(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (NonDivergingIntrinsic::CopyNonOverlapping(__self_0),
                    NonDivergingIntrinsic::CopyNonOverlapping(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[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 NonDivergingIntrinsic {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    NonDivergingIntrinsic::Assume(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "NonDivergingIntrinsic", 0u32, "Assume", __field0),
                    NonDivergingIntrinsic::CopyNonOverlapping(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "NonDivergingIntrinsic", 1u32, "CopyNonOverlapping",
                            __field0),
                }
            }
        }
    };Serialize)]
463pub enum NonDivergingIntrinsic {
464    Assume(Operand),
465    CopyNonOverlapping(CopyNonOverlapping),
466}
467
468#[derive(#[automatically_derived]
impl ::core::clone::Clone for Statement {
    #[inline]
    fn clone(&self) -> Statement {
        Statement {
            kind: ::core::clone::Clone::clone(&self.kind),
            span: ::core::clone::Clone::clone(&self.span),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Statement {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "Statement",
            "kind", &self.kind, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for Statement {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<StatementKind>;
        let _: ::core::cmp::AssertParamIsEq<Span>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for Statement {
    #[inline]
    fn eq(&self, other: &Statement) -> bool {
        self.kind == other.kind && self.span == other.span
    }
}PartialEq, #[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 Statement {
            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,
                            "Statement", false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "kind", &self.kind)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "span", &self.span)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
469pub struct Statement {
470    pub kind: StatementKind,
471    pub span: Span,
472}
473
474#[derive(#[automatically_derived]
impl ::core::clone::Clone for StatementKind {
    #[inline]
    fn clone(&self) -> StatementKind {
        match self {
            StatementKind::Assign(__self_0, __self_1) =>
                StatementKind::Assign(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            StatementKind::FakeRead(__self_0, __self_1) =>
                StatementKind::FakeRead(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            StatementKind::SetDiscriminant {
                place: __self_0, variant_index: __self_1 } =>
                StatementKind::SetDiscriminant {
                    place: ::core::clone::Clone::clone(__self_0),
                    variant_index: ::core::clone::Clone::clone(__self_1),
                },
            StatementKind::StorageLive(__self_0) =>
                StatementKind::StorageLive(::core::clone::Clone::clone(__self_0)),
            StatementKind::StorageDead(__self_0) =>
                StatementKind::StorageDead(::core::clone::Clone::clone(__self_0)),
            StatementKind::PlaceMention(__self_0) =>
                StatementKind::PlaceMention(::core::clone::Clone::clone(__self_0)),
            StatementKind::AscribeUserType {
                place: __self_0, projections: __self_1, variance: __self_2 }
                =>
                StatementKind::AscribeUserType {
                    place: ::core::clone::Clone::clone(__self_0),
                    projections: ::core::clone::Clone::clone(__self_1),
                    variance: ::core::clone::Clone::clone(__self_2),
                },
            StatementKind::Coverage(__self_0) =>
                StatementKind::Coverage(::core::clone::Clone::clone(__self_0)),
            StatementKind::Intrinsic(__self_0) =>
                StatementKind::Intrinsic(::core::clone::Clone::clone(__self_0)),
            StatementKind::ConstEvalCounter =>
                StatementKind::ConstEvalCounter,
            StatementKind::Nop => StatementKind::Nop,
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for StatementKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            StatementKind::Assign(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Assign",
                    __self_0, &__self_1),
            StatementKind::FakeRead(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "FakeRead", __self_0, &__self_1),
            StatementKind::SetDiscriminant {
                place: __self_0, variant_index: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "SetDiscriminant", "place", __self_0, "variant_index",
                    &__self_1),
            StatementKind::StorageLive(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "StorageLive", &__self_0),
            StatementKind::StorageDead(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "StorageDead", &__self_0),
            StatementKind::PlaceMention(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "PlaceMention", &__self_0),
            StatementKind::AscribeUserType {
                place: __self_0, projections: __self_1, variance: __self_2 }
                =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "AscribeUserType", "place", __self_0, "projections",
                    __self_1, "variance", &__self_2),
            StatementKind::Coverage(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Coverage", &__self_0),
            StatementKind::Intrinsic(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Intrinsic", &__self_0),
            StatementKind::ConstEvalCounter =>
                ::core::fmt::Formatter::write_str(f, "ConstEvalCounter"),
            StatementKind::Nop => ::core::fmt::Formatter::write_str(f, "Nop"),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for StatementKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Place>;
        let _: ::core::cmp::AssertParamIsEq<Rvalue>;
        let _: ::core::cmp::AssertParamIsEq<FakeReadCause>;
        let _: ::core::cmp::AssertParamIsEq<VariantIdx>;
        let _: ::core::cmp::AssertParamIsEq<Local>;
        let _: ::core::cmp::AssertParamIsEq<UserTypeProjection>;
        let _: ::core::cmp::AssertParamIsEq<Variance>;
        let _: ::core::cmp::AssertParamIsEq<Coverage>;
        let _: ::core::cmp::AssertParamIsEq<NonDivergingIntrinsic>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for StatementKind {
    #[inline]
    fn eq(&self, other: &StatementKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (StatementKind::Assign(__self_0, __self_1),
                    StatementKind::Assign(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (StatementKind::FakeRead(__self_0, __self_1),
                    StatementKind::FakeRead(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (StatementKind::SetDiscriminant {
                    place: __self_0, variant_index: __self_1 },
                    StatementKind::SetDiscriminant {
                    place: __arg1_0, variant_index: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (StatementKind::StorageLive(__self_0),
                    StatementKind::StorageLive(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (StatementKind::StorageDead(__self_0),
                    StatementKind::StorageDead(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (StatementKind::PlaceMention(__self_0),
                    StatementKind::PlaceMention(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (StatementKind::AscribeUserType {
                    place: __self_0, projections: __self_1, variance: __self_2
                    }, StatementKind::AscribeUserType {
                    place: __arg1_0, projections: __arg1_1, variance: __arg1_2
                    }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (StatementKind::Coverage(__self_0),
                    StatementKind::Coverage(__arg1_0)) => __self_0 == __arg1_0,
                (StatementKind::Intrinsic(__self_0),
                    StatementKind::Intrinsic(__arg1_0)) => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[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 StatementKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    StatementKind::Assign(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "StatementKind", 0u32, "Assign", 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)
                    }
                    StatementKind::FakeRead(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "StatementKind", 1u32, "FakeRead", 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)
                    }
                    StatementKind::SetDiscriminant {
                        ref place, ref variant_index } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "StatementKind", 2u32, "SetDiscriminant", 0 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "place", place)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "variant_index", variant_index)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    StatementKind::StorageLive(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "StatementKind", 3u32, "StorageLive", __field0),
                    StatementKind::StorageDead(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "StatementKind", 4u32, "StorageDead", __field0),
                    StatementKind::PlaceMention(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "StatementKind", 5u32, "PlaceMention", __field0),
                    StatementKind::AscribeUserType {
                        ref place, ref projections, ref variance } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "StatementKind", 6u32, "AscribeUserType", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "place", place)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "projections", projections)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "variance", variance)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    StatementKind::Coverage(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "StatementKind", 7u32, "Coverage", __field0),
                    StatementKind::Intrinsic(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "StatementKind", 8u32, "Intrinsic", __field0),
                    StatementKind::ConstEvalCounter =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "StatementKind", 9u32, "ConstEvalCounter"),
                    StatementKind::Nop =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "StatementKind", 10u32, "Nop"),
                }
            }
        }
    };Serialize)]
475pub enum StatementKind {
476    Assign(Place, Rvalue),
477    FakeRead(FakeReadCause, Place),
478    SetDiscriminant { place: Place, variant_index: VariantIdx },
479    StorageLive(Local),
480    StorageDead(Local),
481    PlaceMention(Place),
482    AscribeUserType { place: Place, projections: UserTypeProjection, variance: Variance },
483    Coverage(Coverage),
484    Intrinsic(NonDivergingIntrinsic),
485    ConstEvalCounter,
486    Nop,
487}
488
489#[derive(#[automatically_derived]
impl ::core::clone::Clone for Rvalue {
    #[inline]
    fn clone(&self) -> Rvalue {
        match self {
            Rvalue::AddressOf(__self_0, __self_1) =>
                Rvalue::AddressOf(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            Rvalue::Aggregate(__self_0, __self_1) =>
                Rvalue::Aggregate(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            Rvalue::BinaryOp(__self_0, __self_1, __self_2) =>
                Rvalue::BinaryOp(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2)),
            Rvalue::Cast(__self_0, __self_1, __self_2) =>
                Rvalue::Cast(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2)),
            Rvalue::CheckedBinaryOp(__self_0, __self_1, __self_2) =>
                Rvalue::CheckedBinaryOp(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2)),
            Rvalue::CopyForDeref(__self_0) =>
                Rvalue::CopyForDeref(::core::clone::Clone::clone(__self_0)),
            Rvalue::Discriminant(__self_0) =>
                Rvalue::Discriminant(::core::clone::Clone::clone(__self_0)),
            Rvalue::Len(__self_0) =>
                Rvalue::Len(::core::clone::Clone::clone(__self_0)),
            Rvalue::Ref(__self_0, __self_1, __self_2) =>
                Rvalue::Ref(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2)),
            Rvalue::Repeat(__self_0, __self_1) =>
                Rvalue::Repeat(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            Rvalue::ThreadLocalRef(__self_0) =>
                Rvalue::ThreadLocalRef(::core::clone::Clone::clone(__self_0)),
            Rvalue::UnaryOp(__self_0, __self_1) =>
                Rvalue::UnaryOp(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            Rvalue::Use(__self_0, __self_1) =>
                Rvalue::Use(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Rvalue {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Rvalue::AddressOf(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "AddressOf", __self_0, &__self_1),
            Rvalue::Aggregate(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "Aggregate", __self_0, &__self_1),
            Rvalue::BinaryOp(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f,
                    "BinaryOp", __self_0, __self_1, &__self_2),
            Rvalue::Cast(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Cast",
                    __self_0, __self_1, &__self_2),
            Rvalue::CheckedBinaryOp(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f,
                    "CheckedBinaryOp", __self_0, __self_1, &__self_2),
            Rvalue::CopyForDeref(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "CopyForDeref", &__self_0),
            Rvalue::Discriminant(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Discriminant", &__self_0),
            Rvalue::Len(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Len",
                    &__self_0),
            Rvalue::Ref(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Ref",
                    __self_0, __self_1, &__self_2),
            Rvalue::Repeat(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Repeat",
                    __self_0, &__self_1),
            Rvalue::ThreadLocalRef(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ThreadLocalRef", &__self_0),
            Rvalue::UnaryOp(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "UnaryOp", __self_0, &__self_1),
            Rvalue::Use(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Use",
                    __self_0, &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for Rvalue {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<RawPtrKind>;
        let _: ::core::cmp::AssertParamIsEq<Place>;
        let _: ::core::cmp::AssertParamIsEq<AggregateKind>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Operand>>;
        let _: ::core::cmp::AssertParamIsEq<BinOp>;
        let _: ::core::cmp::AssertParamIsEq<Operand>;
        let _: ::core::cmp::AssertParamIsEq<CastKind>;
        let _: ::core::cmp::AssertParamIsEq<Ty>;
        let _: ::core::cmp::AssertParamIsEq<Region>;
        let _: ::core::cmp::AssertParamIsEq<BorrowKind>;
        let _: ::core::cmp::AssertParamIsEq<TyConst>;
        let _: ::core::cmp::AssertParamIsEq<crate::CrateItem>;
        let _: ::core::cmp::AssertParamIsEq<UnOp>;
        let _: ::core::cmp::AssertParamIsEq<WithRetag>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for Rvalue {
    #[inline]
    fn eq(&self, other: &Rvalue) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (Rvalue::AddressOf(__self_0, __self_1),
                    Rvalue::AddressOf(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (Rvalue::Aggregate(__self_0, __self_1),
                    Rvalue::Aggregate(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (Rvalue::BinaryOp(__self_0, __self_1, __self_2),
                    Rvalue::BinaryOp(__arg1_0, __arg1_1, __arg1_2)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (Rvalue::Cast(__self_0, __self_1, __self_2),
                    Rvalue::Cast(__arg1_0, __arg1_1, __arg1_2)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (Rvalue::CheckedBinaryOp(__self_0, __self_1, __self_2),
                    Rvalue::CheckedBinaryOp(__arg1_0, __arg1_1, __arg1_2)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (Rvalue::CopyForDeref(__self_0),
                    Rvalue::CopyForDeref(__arg1_0)) => __self_0 == __arg1_0,
                (Rvalue::Discriminant(__self_0),
                    Rvalue::Discriminant(__arg1_0)) => __self_0 == __arg1_0,
                (Rvalue::Len(__self_0), Rvalue::Len(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Rvalue::Ref(__self_0, __self_1, __self_2),
                    Rvalue::Ref(__arg1_0, __arg1_1, __arg1_2)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (Rvalue::Repeat(__self_0, __self_1),
                    Rvalue::Repeat(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (Rvalue::ThreadLocalRef(__self_0),
                    Rvalue::ThreadLocalRef(__arg1_0)) => __self_0 == __arg1_0,
                (Rvalue::UnaryOp(__self_0, __self_1),
                    Rvalue::UnaryOp(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (Rvalue::Use(__self_0, __self_1),
                    Rvalue::Use(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for Rvalue {
    #[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 {
            Rvalue::AddressOf(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Rvalue::Aggregate(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Rvalue::BinaryOp(__self_0, __self_1, __self_2) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            Rvalue::Cast(__self_0, __self_1, __self_2) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            Rvalue::CheckedBinaryOp(__self_0, __self_1, __self_2) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            Rvalue::CopyForDeref(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Rvalue::Discriminant(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Rvalue::Len(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Rvalue::Ref(__self_0, __self_1, __self_2) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            Rvalue::Repeat(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Rvalue::ThreadLocalRef(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Rvalue::UnaryOp(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Rvalue::Use(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
        }
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for Rvalue {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    Rvalue::AddressOf(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "Rvalue", 0u32, "AddressOf", 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)
                    }
                    Rvalue::Aggregate(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "Rvalue", 1u32, "Aggregate", 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)
                    }
                    Rvalue::BinaryOp(ref __field0, ref __field1, ref __field2)
                        => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "Rvalue", 2u32, "BinaryOp", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field0)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field2)?;
                        _serde::ser::SerializeTupleVariant::end(__serde_state)
                    }
                    Rvalue::Cast(ref __field0, ref __field1, ref __field2) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "Rvalue", 3u32, "Cast", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field0)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field2)?;
                        _serde::ser::SerializeTupleVariant::end(__serde_state)
                    }
                    Rvalue::CheckedBinaryOp(ref __field0, ref __field1,
                        ref __field2) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "Rvalue", 4u32, "CheckedBinaryOp", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field0)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field2)?;
                        _serde::ser::SerializeTupleVariant::end(__serde_state)
                    }
                    Rvalue::CopyForDeref(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "Rvalue", 5u32, "CopyForDeref", __field0),
                    Rvalue::Discriminant(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "Rvalue", 6u32, "Discriminant", __field0),
                    Rvalue::Len(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "Rvalue", 7u32, "Len", __field0),
                    Rvalue::Ref(ref __field0, ref __field1, ref __field2) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "Rvalue", 8u32, "Ref", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field0)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field2)?;
                        _serde::ser::SerializeTupleVariant::end(__serde_state)
                    }
                    Rvalue::Repeat(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "Rvalue", 9u32, "Repeat", 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)
                    }
                    Rvalue::ThreadLocalRef(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "Rvalue", 10u32, "ThreadLocalRef", __field0),
                    Rvalue::UnaryOp(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "Rvalue", 11u32, "UnaryOp", 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)
                    }
                    Rvalue::Use(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "Rvalue", 12u32, "Use", 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)
                    }
                }
            }
        }
    };Serialize)]
490pub enum Rvalue {
491    /// Creates a pointer with the indicated mutability to the place.
492    ///
493    /// This is generated by pointer casts like `&v as *const _` or raw address of expressions like
494    /// `&raw v` or `addr_of!(v)`.
495    AddressOf(RawPtrKind, Place),
496
497    /// Creates an aggregate value, like a tuple or struct.
498    ///
499    /// This is needed because dataflow analysis needs to distinguish
500    /// `dest = Foo { x: ..., y: ... }` from `dest.x = ...; dest.y = ...;` in the case that `Foo`
501    /// has a destructor.
502    ///
503    /// Disallowed after deaggregation for all aggregate kinds except `Array` and `Coroutine`. After
504    /// coroutine lowering, `Coroutine` aggregate kinds are disallowed too.
505    Aggregate(AggregateKind, Vec<Operand>),
506
507    /// * `Offset` has the same semantics as `<*const T>::offset`, except that the second
508    ///   parameter may be a `usize` as well.
509    /// * The comparison operations accept `bool`s, `char`s, signed or unsigned integers, floats,
510    ///   raw pointers, or function pointers and return a `bool`. The types of the operands must be
511    ///   matching, up to the usual caveat of the lifetimes in function pointers.
512    /// * Left and right shift operations accept signed or unsigned integers not necessarily of the
513    ///   same type and return a value of the same type as their LHS. Like in Rust, the RHS is
514    ///   truncated as needed.
515    /// * The `Bit*` operations accept signed integers, unsigned integers, or bools with matching
516    ///   types and return a value of that type.
517    /// * The remaining operations accept signed integers, unsigned integers, or floats with
518    ///   matching types and return a value of that type.
519    BinaryOp(BinOp, Operand, Operand),
520
521    /// Performs essentially all of the casts that can be performed via `as`.
522    ///
523    /// This allows for casts from/to a variety of types.
524    Cast(CastKind, Operand, Ty),
525
526    /// Same as `BinaryOp`, but yields `(T, bool)` with a `bool` indicating an error condition.
527    ///
528    /// For addition, subtraction, and multiplication on integers the error condition is set when
529    /// the infinite precision result would not be equal to the actual result.
530    CheckedBinaryOp(BinOp, Operand, Operand),
531
532    /// A CopyForDeref is equivalent to a read from a place.
533    /// When such a read happens, it is guaranteed that the only use of the returned value is a
534    /// deref operation, immediately followed by one or more projections.
535    CopyForDeref(Place),
536
537    /// Computes the discriminant of the place, returning it as an integer.
538    /// Returns zero for types without discriminant.
539    ///
540    /// The validity requirements for the underlying value are undecided for this rvalue, see
541    /// [#91095]. Note too that the value of the discriminant is not the same thing as the
542    /// variant index;
543    ///
544    /// [#91095]: https://github.com/rust-lang/rust/issues/91095
545    Discriminant(Place),
546
547    /// Yields the length of the place, as a `usize`.
548    ///
549    /// If the type of the place is an array, this is the array length. For slices (`[T]`, not
550    /// `&[T]`) this accesses the place's metadata to determine the length. This rvalue is
551    /// ill-formed for places of other types.
552    Len(Place),
553
554    /// Creates a reference to the place.
555    Ref(Region, BorrowKind, Place),
556
557    /// Creates an array where each element is the value of the operand.
558    ///
559    /// This is the cause of a bug in the case where the repetition count is zero because the value
560    /// is not dropped, see [#74836].
561    ///
562    /// Corresponds to source code like `[x; 32]`.
563    ///
564    /// [#74836]: https://github.com/rust-lang/rust/issues/74836
565    Repeat(Operand, TyConst),
566
567    /// Creates a pointer/reference to the given thread local.
568    ///
569    /// The yielded type is a `*mut T` if the static is mutable, otherwise if the static is extern a
570    /// `*const T`, and if neither of those apply a `&T`.
571    ///
572    /// **Note:** This is a runtime operation that actually executes code and is in this sense more
573    /// like a function call. Also, eliminating dead stores of this rvalue causes `fn main() {}` to
574    /// SIGILL for some reason that I (JakobDegen) never got a chance to look into.
575    ///
576    /// **Needs clarification**: Are there weird additional semantics here related to the runtime
577    /// nature of this operation?
578    ThreadLocalRef(crate::CrateItem),
579
580    /// Exactly like `BinaryOp`, but less operands.
581    ///
582    /// Also does two's-complement arithmetic. Negation requires a signed integer or a float;
583    /// bitwise not requires a signed integer, unsigned integer, or bool. Both operation kinds
584    /// return a value with the same type as their operand.
585    UnaryOp(UnOp, Operand),
586
587    /// Yields the operand unchanged, except for possibly a retag.
588    Use(Operand, WithRetag),
589}
590
591impl Rvalue {
592    pub fn ty(&self, locals: &[LocalDecl]) -> Result<Ty, Error> {
593        match self {
594            Rvalue::Use(operand, _) => operand.ty(locals),
595            Rvalue::Repeat(operand, count) => {
596                Ok(Ty::new_array_with_const_len(operand.ty(locals)?, count.clone()))
597            }
598            Rvalue::ThreadLocalRef(did) => Ok(did.ty()),
599            Rvalue::Ref(reg, bk, place) => {
600                let place_ty = place.ty(locals)?;
601                Ok(Ty::new_ref(reg.clone(), place_ty, bk.to_mutable_lossy()))
602            }
603            Rvalue::AddressOf(mutability, place) => {
604                let place_ty = place.ty(locals)?;
605                Ok(Ty::new_ptr(place_ty, mutability.to_mutable_lossy()))
606            }
607            Rvalue::Len(..) => Ok(Ty::usize_ty()),
608            Rvalue::Cast(.., ty) => Ok(*ty),
609            Rvalue::BinaryOp(op, lhs, rhs) => {
610                let lhs_ty = lhs.ty(locals)?;
611                let rhs_ty = rhs.ty(locals)?;
612                Ok(op.ty(lhs_ty, rhs_ty))
613            }
614            Rvalue::CheckedBinaryOp(op, lhs, rhs) => {
615                let lhs_ty = lhs.ty(locals)?;
616                let rhs_ty = rhs.ty(locals)?;
617                let ty = op.ty(lhs_ty, rhs_ty);
618                Ok(Ty::new_tuple(&[ty, Ty::bool_ty()]))
619            }
620            Rvalue::UnaryOp(op, operand) => {
621                let arg_ty = operand.ty(locals)?;
622                Ok(op.ty(arg_ty))
623            }
624            Rvalue::Discriminant(place) => {
625                let place_ty = place.ty(locals)?;
626                place_ty
627                    .kind()
628                    .discriminant_ty()
629                    .ok_or_else(|| Error(::alloc::__export::must_use({
            ::alloc::fmt::format(format_args!("Expected a `RigidTy` but found: {0:?}",
                    place_ty))
        }))error!("Expected a `RigidTy` but found: {place_ty:?}"))
630            }
631            Rvalue::Aggregate(ak, ops) => match *ak {
632                AggregateKind::Array(ty) => Ty::try_new_array(ty, ops.len() as u64),
633                AggregateKind::Tuple => Ok(Ty::new_tuple(
634                    &ops.iter().map(|op| op.ty(locals)).collect::<Result<Vec<_>, _>>()?,
635                )),
636                AggregateKind::Adt(def, _, ref args, _, _) => Ok(def.ty_with_args(args)),
637                AggregateKind::Closure(def, ref args) => Ok(Ty::new_closure(def, args.clone())),
638                AggregateKind::Coroutine(def, ref args) => Ok(Ty::new_coroutine(def, args.clone())),
639                AggregateKind::CoroutineClosure(def, ref args) => {
640                    Ok(Ty::new_coroutine_closure(def, args.clone()))
641                }
642                AggregateKind::RawPtr(ty, mutability) => Ok(Ty::new_ptr(ty, mutability)),
643            },
644            Rvalue::CopyForDeref(place) => place.ty(locals),
645        }
646    }
647}
648
649#[derive(#[automatically_derived]
impl ::core::clone::Clone for AggregateKind {
    #[inline]
    fn clone(&self) -> AggregateKind {
        match self {
            AggregateKind::Array(__self_0) =>
                AggregateKind::Array(::core::clone::Clone::clone(__self_0)),
            AggregateKind::Tuple => AggregateKind::Tuple,
            AggregateKind::Adt(__self_0, __self_1, __self_2, __self_3,
                __self_4) =>
                AggregateKind::Adt(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2),
                    ::core::clone::Clone::clone(__self_3),
                    ::core::clone::Clone::clone(__self_4)),
            AggregateKind::Closure(__self_0, __self_1) =>
                AggregateKind::Closure(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            AggregateKind::Coroutine(__self_0, __self_1) =>
                AggregateKind::Coroutine(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            AggregateKind::CoroutineClosure(__self_0, __self_1) =>
                AggregateKind::CoroutineClosure(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            AggregateKind::RawPtr(__self_0, __self_1) =>
                AggregateKind::RawPtr(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AggregateKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            AggregateKind::Array(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Array",
                    &__self_0),
            AggregateKind::Tuple =>
                ::core::fmt::Formatter::write_str(f, "Tuple"),
            AggregateKind::Adt(__self_0, __self_1, __self_2, __self_3,
                __self_4) =>
                ::core::fmt::Formatter::debug_tuple_field5_finish(f, "Adt",
                    __self_0, __self_1, __self_2, __self_3, &__self_4),
            AggregateKind::Closure(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "Closure", __self_0, &__self_1),
            AggregateKind::Coroutine(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "Coroutine", __self_0, &__self_1),
            AggregateKind::CoroutineClosure(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "CoroutineClosure", __self_0, &__self_1),
            AggregateKind::RawPtr(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "RawPtr",
                    __self_0, &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for AggregateKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Ty>;
        let _: ::core::cmp::AssertParamIsEq<AdtDef>;
        let _: ::core::cmp::AssertParamIsEq<VariantIdx>;
        let _: ::core::cmp::AssertParamIsEq<GenericArgs>;
        let _: ::core::cmp::AssertParamIsEq<Option<UserTypeAnnotationIndex>>;
        let _: ::core::cmp::AssertParamIsEq<Option<FieldIdx>>;
        let _: ::core::cmp::AssertParamIsEq<ClosureDef>;
        let _: ::core::cmp::AssertParamIsEq<CoroutineDef>;
        let _: ::core::cmp::AssertParamIsEq<CoroutineClosureDef>;
        let _: ::core::cmp::AssertParamIsEq<Mutability>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for AggregateKind {
    #[inline]
    fn eq(&self, other: &AggregateKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (AggregateKind::Array(__self_0),
                    AggregateKind::Array(__arg1_0)) => __self_0 == __arg1_0,
                (AggregateKind::Adt(__self_0, __self_1, __self_2, __self_3,
                    __self_4),
                    AggregateKind::Adt(__arg1_0, __arg1_1, __arg1_2, __arg1_3,
                    __arg1_4)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                                __self_2 == __arg1_2 && __self_3 == __arg1_3 &&
                        __self_4 == __arg1_4,
                (AggregateKind::Closure(__self_0, __self_1),
                    AggregateKind::Closure(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (AggregateKind::Coroutine(__self_0, __self_1),
                    AggregateKind::Coroutine(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (AggregateKind::CoroutineClosure(__self_0, __self_1),
                    AggregateKind::CoroutineClosure(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (AggregateKind::RawPtr(__self_0, __self_1),
                    AggregateKind::RawPtr(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for AggregateKind {
    #[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 {
            AggregateKind::Array(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            AggregateKind::Adt(__self_0, __self_1, __self_2, __self_3,
                __self_4) => {
                ::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);
                ::core::hash::Hash::hash(__self_4, state)
            }
            AggregateKind::Closure(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            AggregateKind::Coroutine(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            AggregateKind::CoroutineClosure(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            AggregateKind::RawPtr(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            _ => {}
        }
    }
}Hash, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
    {
        #[allow(unused_extern_crates, clippy :: useless_attribute)]
        extern crate serde as _serde;
        ;
        #[automatically_derived]
        impl _serde::Serialize for AggregateKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    AggregateKind::Array(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "AggregateKind", 0u32, "Array", __field0),
                    AggregateKind::Tuple =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "AggregateKind", 1u32, "Tuple"),
                    AggregateKind::Adt(ref __field0, ref __field1, ref __field2,
                        ref __field3, ref __field4) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "AggregateKind", 2u32, "Adt", 0 + 1 + 1 + 1 + 1 + 1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field0)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field1)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field2)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field3)?;
                        _serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
                                __field4)?;
                        _serde::ser::SerializeTupleVariant::end(__serde_state)
                    }
                    AggregateKind::Closure(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "AggregateKind", 3u32, "Closure", 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)
                    }
                    AggregateKind::Coroutine(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "AggregateKind", 4u32, "Coroutine", 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)
                    }
                    AggregateKind::CoroutineClosure(ref __field0, ref __field1)
                        => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "AggregateKind", 5u32, "CoroutineClosure", 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)
                    }
                    AggregateKind::RawPtr(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "AggregateKind", 6u32, "RawPtr", 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)
                    }
                }
            }
        }
    };Serialize)]
650pub enum AggregateKind {
651    Array(Ty),
652    Tuple,
653    Adt(AdtDef, VariantIdx, GenericArgs, Option<UserTypeAnnotationIndex>, Option<FieldIdx>),
654    Closure(ClosureDef, GenericArgs),
655    Coroutine(CoroutineDef, GenericArgs),
656    CoroutineClosure(CoroutineClosureDef, GenericArgs),
657    RawPtr(Ty, Mutability),
658}
659
660#[derive(#[automatically_derived]
impl ::core::clone::Clone for Operand {
    #[inline]
    fn clone(&self) -> Operand {
        match self {
            Operand::Copy(__self_0) =>
                Operand::Copy(::core::clone::Clone::clone(__self_0)),
            Operand::Move(__self_0) =>
                Operand::Move(::core::clone::Clone::clone(__self_0)),
            Operand::Constant(__self_0) =>
                Operand::Constant(::core::clone::Clone::clone(__self_0)),
            Operand::RuntimeChecks(__self_0) =>
                Operand::RuntimeChecks(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Operand {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Operand::Copy(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Copy",
                    &__self_0),
            Operand::Move(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Move",
                    &__self_0),
            Operand::Constant(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Constant", &__self_0),
            Operand::RuntimeChecks(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "RuntimeChecks", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for Operand {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Place>;
        let _: ::core::cmp::AssertParamIsEq<ConstOperand>;
        let _: ::core::cmp::AssertParamIsEq<RuntimeChecks>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for Operand {
    #[inline]
    fn eq(&self, other: &Operand) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (Operand::Copy(__self_0), Operand::Copy(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Operand::Move(__self_0), Operand::Move(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Operand::Constant(__self_0), Operand::Constant(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Operand::RuntimeChecks(__self_0),
                    Operand::RuntimeChecks(__arg1_0)) => __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for Operand {
    #[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 {
            Operand::Copy(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Operand::Move(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Operand::Constant(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Operand::RuntimeChecks(__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 Operand {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    Operand::Copy(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "Operand", 0u32, "Copy", __field0),
                    Operand::Move(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "Operand", 1u32, "Move", __field0),
                    Operand::Constant(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "Operand", 2u32, "Constant", __field0),
                    Operand::RuntimeChecks(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "Operand", 3u32, "RuntimeChecks", __field0),
                }
            }
        }
    };Serialize)]
661pub enum Operand {
662    Copy(Place),
663    Move(Place),
664    Constant(ConstOperand),
665    RuntimeChecks(RuntimeChecks),
666}
667
668#[derive(#[automatically_derived]
impl ::core::clone::Clone for Place {
    #[inline]
    fn clone(&self) -> Place {
        Place {
            local: ::core::clone::Clone::clone(&self.local),
            projection: ::core::clone::Clone::clone(&self.projection),
        }
    }
}Clone, #[automatically_derived]
impl ::core::cmp::Eq for Place {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Local>;
        let _: ::core::cmp::AssertParamIsEq<Vec<ProjectionElem>>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for Place {
    #[inline]
    fn eq(&self, other: &Place) -> bool {
        self.local == other.local && self.projection == other.projection
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for Place {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.local, state);
        ::core::hash::Hash::hash(&self.projection, 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 Place {
            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, "Place",
                            false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "local", &self.local)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "projection", &self.projection)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
669pub struct Place {
670    pub local: Local,
671    /// projection out of a place (access a field, deref a pointer, etc)
672    pub projection: Vec<ProjectionElem>,
673}
674
675impl From<Local> for Place {
676    fn from(local: Local) -> Self {
677        Place { local, projection: ::alloc::vec::Vec::new()vec![] }
678    }
679}
680
681#[derive(#[automatically_derived]
impl ::core::clone::Clone for ConstOperand {
    #[inline]
    fn clone(&self) -> ConstOperand {
        ConstOperand {
            span: ::core::clone::Clone::clone(&self.span),
            user_ty: ::core::clone::Clone::clone(&self.user_ty),
            const_: ::core::clone::Clone::clone(&self.const_),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ConstOperand {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "ConstOperand",
            "span", &self.span, "user_ty", &self.user_ty, "const_",
            &&self.const_)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for ConstOperand {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Span>;
        let _: ::core::cmp::AssertParamIsEq<Option<UserTypeAnnotationIndex>>;
        let _: ::core::cmp::AssertParamIsEq<MirConst>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for ConstOperand {
    #[inline]
    fn eq(&self, other: &ConstOperand) -> bool {
        self.span == other.span && self.user_ty == other.user_ty &&
            self.const_ == other.const_
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for ConstOperand {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.span, state);
        ::core::hash::Hash::hash(&self.user_ty, state);
        ::core::hash::Hash::hash(&self.const_, 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 ConstOperand {
            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,
                            "ConstOperand", false as usize + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "span", &self.span)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "user_ty", &self.user_ty)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "const_", &self.const_)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
682pub struct ConstOperand {
683    pub span: Span,
684    pub user_ty: Option<UserTypeAnnotationIndex>,
685    pub const_: MirConst,
686}
687
688#[derive(#[automatically_derived]
impl ::core::clone::Clone for RuntimeChecks {
    #[inline]
    fn clone(&self) -> RuntimeChecks {
        match self {
            RuntimeChecks::UbChecks => RuntimeChecks::UbChecks,
            RuntimeChecks::ContractChecks => RuntimeChecks::ContractChecks,
            RuntimeChecks::OverflowChecks => RuntimeChecks::OverflowChecks,
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for RuntimeChecks {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                RuntimeChecks::UbChecks => "UbChecks",
                RuntimeChecks::ContractChecks => "ContractChecks",
                RuntimeChecks::OverflowChecks => "OverflowChecks",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for RuntimeChecks {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for RuntimeChecks {
    #[inline]
    fn eq(&self, other: &RuntimeChecks) -> 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::hash::Hash for RuntimeChecks {
    #[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 RuntimeChecks {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    RuntimeChecks::UbChecks =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "RuntimeChecks", 0u32, "UbChecks"),
                    RuntimeChecks::ContractChecks =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "RuntimeChecks", 1u32, "ContractChecks"),
                    RuntimeChecks::OverflowChecks =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "RuntimeChecks", 2u32, "OverflowChecks"),
                }
            }
        }
    };Serialize)]
689pub enum RuntimeChecks {
690    /// cfg!(ub_checks), but at codegen time
691    UbChecks,
692    /// cfg!(contract_checks), but at codegen time
693    ContractChecks,
694    /// cfg!(overflow_checks), but at codegen time
695    OverflowChecks,
696}
697
698/// Debug information pertaining to a user variable.
699#[derive(#[automatically_derived]
impl ::core::clone::Clone for VarDebugInfo {
    #[inline]
    fn clone(&self) -> VarDebugInfo {
        VarDebugInfo {
            name: ::core::clone::Clone::clone(&self.name),
            source_info: ::core::clone::Clone::clone(&self.source_info),
            composite: ::core::clone::Clone::clone(&self.composite),
            value: ::core::clone::Clone::clone(&self.value),
            argument_index: ::core::clone::Clone::clone(&self.argument_index),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for VarDebugInfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "VarDebugInfo",
            "name", &self.name, "source_info", &self.source_info, "composite",
            &self.composite, "value", &self.value, "argument_index",
            &&self.argument_index)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for VarDebugInfo {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Symbol>;
        let _: ::core::cmp::AssertParamIsEq<SourceInfo>;
        let _: ::core::cmp::AssertParamIsEq<Option<VarDebugInfoFragment>>;
        let _: ::core::cmp::AssertParamIsEq<VarDebugInfoContents>;
        let _: ::core::cmp::AssertParamIsEq<Option<u16>>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for VarDebugInfo {
    #[inline]
    fn eq(&self, other: &VarDebugInfo) -> bool {
        self.name == other.name && self.source_info == other.source_info &&
                    self.composite == other.composite &&
                self.value == other.value &&
            self.argument_index == other.argument_index
    }
}PartialEq, #[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 VarDebugInfo {
            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,
                            "VarDebugInfo", false as usize + 1 + 1 + 1 + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "name", &self.name)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "source_info", &self.source_info)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "composite", &self.composite)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "value", &self.value)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "argument_index", &self.argument_index)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
700pub struct VarDebugInfo {
701    /// The variable name.
702    pub name: Symbol,
703
704    /// Source info of the user variable, including the scope
705    /// within which the variable is visible (to debuginfo).
706    pub source_info: SourceInfo,
707
708    /// The user variable's data is split across several fragments,
709    /// each described by a `VarDebugInfoFragment`.
710    pub composite: Option<VarDebugInfoFragment>,
711
712    /// Where the data for this user variable is to be found.
713    pub value: VarDebugInfoContents,
714
715    /// When present, indicates what argument number this variable is in the function that it
716    /// originated from (starting from 1). Note, if MIR inlining is enabled, then this is the
717    /// argument number in the original function before it was inlined.
718    pub argument_index: Option<u16>,
719}
720
721impl VarDebugInfo {
722    /// Return a local variable if this info is related to one.
723    pub fn local(&self) -> Option<Local> {
724        match &self.value {
725            VarDebugInfoContents::Place(place) if place.projection.is_empty() => Some(place.local),
726            VarDebugInfoContents::Place(_) | VarDebugInfoContents::Const(_) => None,
727        }
728    }
729
730    /// Return a constant if this info is related to one.
731    pub fn constant(&self) -> Option<&ConstOperand> {
732        match &self.value {
733            VarDebugInfoContents::Place(_) => None,
734            VarDebugInfoContents::Const(const_op) => Some(const_op),
735        }
736    }
737}
738
739pub type SourceScope = u32;
740
741#[derive(#[automatically_derived]
impl ::core::clone::Clone for SourceInfo {
    #[inline]
    fn clone(&self) -> SourceInfo {
        SourceInfo {
            span: ::core::clone::Clone::clone(&self.span),
            scope: ::core::clone::Clone::clone(&self.scope),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for SourceInfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "SourceInfo",
            "span", &self.span, "scope", &&self.scope)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for SourceInfo {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Span>;
        let _: ::core::cmp::AssertParamIsEq<SourceScope>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for SourceInfo {
    #[inline]
    fn eq(&self, other: &SourceInfo) -> bool {
        self.span == other.span && self.scope == other.scope
    }
}PartialEq, #[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 SourceInfo {
            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,
                            "SourceInfo", false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "span", &self.span)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "scope", &self.scope)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
742pub struct SourceInfo {
743    pub span: Span,
744    pub scope: SourceScope,
745}
746
747#[derive(#[automatically_derived]
impl ::core::clone::Clone for VarDebugInfoFragment {
    #[inline]
    fn clone(&self) -> VarDebugInfoFragment {
        VarDebugInfoFragment {
            ty: ::core::clone::Clone::clone(&self.ty),
            projection: ::core::clone::Clone::clone(&self.projection),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for VarDebugInfoFragment {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "VarDebugInfoFragment", "ty", &self.ty, "projection",
            &&self.projection)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for VarDebugInfoFragment {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Ty>;
        let _: ::core::cmp::AssertParamIsEq<Vec<ProjectionElem>>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for VarDebugInfoFragment {
    #[inline]
    fn eq(&self, other: &VarDebugInfoFragment) -> bool {
        self.ty == other.ty && self.projection == other.projection
    }
}PartialEq, #[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 VarDebugInfoFragment {
            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,
                            "VarDebugInfoFragment", false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "ty", &self.ty)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "projection", &self.projection)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
748pub struct VarDebugInfoFragment {
749    pub ty: Ty,
750    pub projection: Vec<ProjectionElem>,
751}
752
753#[derive(#[automatically_derived]
impl ::core::clone::Clone for VarDebugInfoContents {
    #[inline]
    fn clone(&self) -> VarDebugInfoContents {
        match self {
            VarDebugInfoContents::Place(__self_0) =>
                VarDebugInfoContents::Place(::core::clone::Clone::clone(__self_0)),
            VarDebugInfoContents::Const(__self_0) =>
                VarDebugInfoContents::Const(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for VarDebugInfoContents {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            VarDebugInfoContents::Place(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Place",
                    &__self_0),
            VarDebugInfoContents::Const(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Const",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for VarDebugInfoContents {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Place>;
        let _: ::core::cmp::AssertParamIsEq<ConstOperand>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for VarDebugInfoContents {
    #[inline]
    fn eq(&self, other: &VarDebugInfoContents) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (VarDebugInfoContents::Place(__self_0),
                    VarDebugInfoContents::Place(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (VarDebugInfoContents::Const(__self_0),
                    VarDebugInfoContents::Const(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[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 VarDebugInfoContents {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    VarDebugInfoContents::Place(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "VarDebugInfoContents", 0u32, "Place", __field0),
                    VarDebugInfoContents::Const(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "VarDebugInfoContents", 1u32, "Const", __field0),
                }
            }
        }
    };Serialize)]
754pub enum VarDebugInfoContents {
755    Place(Place),
756    Const(ConstOperand),
757}
758
759// In MIR ProjectionElem is parameterized on the second Field argument and the Index argument. This
760// is so it can be used for both Places (for which the projection elements are of type
761// ProjectionElem<Local, Ty>) and user-provided type annotations (for which the projection elements
762// are of type ProjectionElem<(), ()>).
763// In rustc_public's IR we don't need this generality, so we just use ProjectionElem for Places.
764#[derive(#[automatically_derived]
impl ::core::clone::Clone for ProjectionElem {
    #[inline]
    fn clone(&self) -> ProjectionElem {
        match self {
            ProjectionElem::Deref => ProjectionElem::Deref,
            ProjectionElem::Field(__self_0, __self_1) =>
                ProjectionElem::Field(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            ProjectionElem::Index(__self_0) =>
                ProjectionElem::Index(::core::clone::Clone::clone(__self_0)),
            ProjectionElem::ConstantIndex {
                offset: __self_0, min_length: __self_1, from_end: __self_2 }
                =>
                ProjectionElem::ConstantIndex {
                    offset: ::core::clone::Clone::clone(__self_0),
                    min_length: ::core::clone::Clone::clone(__self_1),
                    from_end: ::core::clone::Clone::clone(__self_2),
                },
            ProjectionElem::Subslice {
                from: __self_0, to: __self_1, from_end: __self_2 } =>
                ProjectionElem::Subslice {
                    from: ::core::clone::Clone::clone(__self_0),
                    to: ::core::clone::Clone::clone(__self_1),
                    from_end: ::core::clone::Clone::clone(__self_2),
                },
            ProjectionElem::Downcast(__self_0) =>
                ProjectionElem::Downcast(::core::clone::Clone::clone(__self_0)),
            ProjectionElem::OpaqueCast(__self_0) =>
                ProjectionElem::OpaqueCast(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ProjectionElem {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ProjectionElem::Deref =>
                ::core::fmt::Formatter::write_str(f, "Deref"),
            ProjectionElem::Field(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Field",
                    __self_0, &__self_1),
            ProjectionElem::Index(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Index",
                    &__self_0),
            ProjectionElem::ConstantIndex {
                offset: __self_0, min_length: __self_1, from_end: __self_2 }
                =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "ConstantIndex", "offset", __self_0, "min_length", __self_1,
                    "from_end", &__self_2),
            ProjectionElem::Subslice {
                from: __self_0, to: __self_1, from_end: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f,
                    "Subslice", "from", __self_0, "to", __self_1, "from_end",
                    &__self_2),
            ProjectionElem::Downcast(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Downcast", &__self_0),
            ProjectionElem::OpaqueCast(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "OpaqueCast", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for ProjectionElem {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<FieldIdx>;
        let _: ::core::cmp::AssertParamIsEq<Ty>;
        let _: ::core::cmp::AssertParamIsEq<Local>;
        let _: ::core::cmp::AssertParamIsEq<u64>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<VariantIdx>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for ProjectionElem {
    #[inline]
    fn eq(&self, other: &ProjectionElem) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (ProjectionElem::Field(__self_0, __self_1),
                    ProjectionElem::Field(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (ProjectionElem::Index(__self_0),
                    ProjectionElem::Index(__arg1_0)) => __self_0 == __arg1_0,
                (ProjectionElem::ConstantIndex {
                    offset: __self_0, min_length: __self_1, from_end: __self_2
                    }, ProjectionElem::ConstantIndex {
                    offset: __arg1_0, min_length: __arg1_1, from_end: __arg1_2
                    }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (ProjectionElem::Subslice {
                    from: __self_0, to: __self_1, from_end: __self_2 },
                    ProjectionElem::Subslice {
                    from: __arg1_0, to: __arg1_1, from_end: __arg1_2 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (ProjectionElem::Downcast(__self_0),
                    ProjectionElem::Downcast(__arg1_0)) => __self_0 == __arg1_0,
                (ProjectionElem::OpaqueCast(__self_0),
                    ProjectionElem::OpaqueCast(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for ProjectionElem {
    #[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 {
            ProjectionElem::Field(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            ProjectionElem::Index(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            ProjectionElem::ConstantIndex {
                offset: __self_0, min_length: __self_1, from_end: __self_2 }
                => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            ProjectionElem::Subslice {
                from: __self_0, to: __self_1, from_end: __self_2 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            ProjectionElem::Downcast(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            ProjectionElem::OpaqueCast(__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 ProjectionElem {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    ProjectionElem::Deref =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "ProjectionElem", 0u32, "Deref"),
                    ProjectionElem::Field(ref __field0, ref __field1) => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_tuple_variant(__serializer,
                                    "ProjectionElem", 1u32, "Field", 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)
                    }
                    ProjectionElem::Index(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "ProjectionElem", 2u32, "Index", __field0),
                    ProjectionElem::ConstantIndex {
                        ref offset, ref min_length, ref from_end } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "ProjectionElem", 3u32, "ConstantIndex", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "offset", offset)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "min_length", min_length)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "from_end", from_end)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    ProjectionElem::Subslice { ref from, ref to, ref from_end }
                        => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "ProjectionElem", 4u32, "Subslice", 0 + 1 + 1 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "from", from)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "to", to)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "from_end", from_end)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                    ProjectionElem::Downcast(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "ProjectionElem", 5u32, "Downcast", __field0),
                    ProjectionElem::OpaqueCast(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "ProjectionElem", 6u32, "OpaqueCast", __field0),
                }
            }
        }
    };Serialize)]
765pub enum ProjectionElem {
766    /// Dereference projections (e.g. `*_1`) project to the address referenced by the base place.
767    Deref,
768
769    /// A field projection (e.g., `f` in `_1.f`) project to a field in the base place. The field is
770    /// referenced by source-order index rather than the name of the field. The fields type is also
771    /// given.
772    Field(FieldIdx, Ty),
773
774    /// Index into a slice/array. The value of the index is computed at runtime using the `V`
775    /// argument.
776    ///
777    /// Note that this does not also dereference, and so it does not exactly correspond to slice
778    /// indexing in Rust. In other words, in the below Rust code:
779    ///
780    /// ```rust
781    /// let x = &[1, 2, 3, 4];
782    /// let i = 2;
783    /// x[i];
784    /// ```
785    ///
786    /// The `x[i]` is turned into a `Deref` followed by an `Index`, not just an `Index`. The same
787    /// thing is true of the `ConstantIndex` and `Subslice` projections below.
788    Index(Local),
789
790    /// Index into a slice/array given by offsets.
791    ///
792    /// These indices are generated by slice patterns. Easiest to explain by example:
793    ///
794    /// ```ignore (illustrative)
795    /// [X, _, .._, _, _] => { offset: 0, min_length: 4, from_end: false },
796    /// [_, X, .._, _, _] => { offset: 1, min_length: 4, from_end: false },
797    /// [_, _, .._, X, _] => { offset: 2, min_length: 4, from_end: true },
798    /// [_, _, .._, _, X] => { offset: 1, min_length: 4, from_end: true },
799    /// ```
800    ConstantIndex {
801        /// index or -index (in Python terms), depending on from_end
802        offset: u64,
803        /// The thing being indexed must be at least this long -- otherwise, the
804        /// projection is UB.
805        ///
806        /// For arrays this is always the exact length.
807        min_length: u64,
808        /// Counting backwards from end? This is always false when indexing an
809        /// array.
810        from_end: bool,
811    },
812
813    /// Projects a slice from the base place.
814    ///
815    /// These indices are generated by slice patterns. If `from_end` is true, this represents
816    /// `slice[from..slice.len() - to]`. Otherwise it represents `array[from..to]`.
817    Subslice {
818        from: u64,
819        to: u64,
820        /// Whether `to` counts from the start or end of the array/slice.
821        from_end: bool,
822    },
823
824    /// "Downcast" to a variant of an enum or a coroutine.
825    Downcast(VariantIdx),
826
827    /// Like an explicit cast from an opaque type to a concrete type, but without
828    /// requiring an intermediate variable.
829    OpaqueCast(Ty),
830}
831
832#[derive(#[automatically_derived]
impl ::core::clone::Clone for UserTypeProjection {
    #[inline]
    fn clone(&self) -> UserTypeProjection {
        UserTypeProjection {
            base: ::core::clone::Clone::clone(&self.base),
            projection: ::core::clone::Clone::clone(&self.projection),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for UserTypeProjection {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "UserTypeProjection", "base", &self.base, "projection",
            &&self.projection)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for UserTypeProjection {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<UserTypeAnnotationIndex>;
        let _: ::core::cmp::AssertParamIsEq<Opaque>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for UserTypeProjection {
    #[inline]
    fn eq(&self, other: &UserTypeProjection) -> bool {
        self.base == other.base && self.projection == other.projection
    }
}PartialEq, #[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 UserTypeProjection {
            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,
                            "UserTypeProjection", false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "base", &self.base)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "projection", &self.projection)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
833pub struct UserTypeProjection {
834    pub base: UserTypeAnnotationIndex,
835
836    pub projection: Opaque,
837}
838
839pub type Local = usize;
840
841pub const RETURN_LOCAL: Local = 0;
842
843/// The source-order index of a field in a variant.
844///
845/// For example, in the following types,
846/// ```ignore(illustrative)
847/// enum Demo1 {
848///    Variant0 { a: bool, b: i32 },
849///    Variant1 { c: u8, d: u64 },
850/// }
851/// struct Demo2 { e: u8, f: u16, g: u8 }
852/// ```
853/// `a`'s `FieldIdx` is `0`,
854/// `b`'s `FieldIdx` is `1`,
855/// `c`'s `FieldIdx` is `0`, and
856/// `g`'s `FieldIdx` is `2`.
857pub type FieldIdx = usize;
858
859type UserTypeAnnotationIndex = usize;
860
861/// The possible branch sites of a [TerminatorKind::SwitchInt].
862#[derive(#[automatically_derived]
impl ::core::clone::Clone for SwitchTargets {
    #[inline]
    fn clone(&self) -> SwitchTargets {
        SwitchTargets {
            branches: ::core::clone::Clone::clone(&self.branches),
            otherwise: ::core::clone::Clone::clone(&self.otherwise),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for SwitchTargets {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "SwitchTargets",
            "branches", &self.branches, "otherwise", &&self.otherwise)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for SwitchTargets {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Vec<(u128, BasicBlockIdx)>>;
        let _: ::core::cmp::AssertParamIsEq<BasicBlockIdx>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for SwitchTargets {
    #[inline]
    fn eq(&self, other: &SwitchTargets) -> bool {
        self.branches == other.branches && self.otherwise == other.otherwise
    }
}PartialEq, #[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 SwitchTargets {
            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,
                            "SwitchTargets", false as usize + 1 + 1)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "branches", &self.branches)?;
                _serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
                        "otherwise", &self.otherwise)?;
                _serde::ser::SerializeStruct::end(__serde_state)
            }
        }
    };Serialize)]
863pub struct SwitchTargets {
864    /// The conditional branches where the first element represents the value that guards this
865    /// branch, and the second element is the branch target.
866    branches: Vec<(u128, BasicBlockIdx)>,
867    /// The `otherwise` branch which will be taken in case none of the conditional branches are
868    /// satisfied.
869    otherwise: BasicBlockIdx,
870}
871
872impl SwitchTargets {
873    /// All possible targets including the `otherwise` target.
874    pub fn all_targets(&self) -> Successors {
875        self.branches.iter().map(|(_, target)| *target).chain(Some(self.otherwise)).collect()
876    }
877
878    /// The `otherwise` branch target.
879    pub fn otherwise(&self) -> BasicBlockIdx {
880        self.otherwise
881    }
882
883    /// The conditional targets which are only taken if the pattern matches the given value.
884    pub fn branches(&self) -> impl Iterator<Item = (u128, BasicBlockIdx)> {
885        self.branches.iter().copied()
886    }
887
888    /// The number of targets including `otherwise`.
889    pub fn len(&self) -> usize {
890        self.branches.len() + 1
891    }
892
893    /// Create a new SwitchTargets from the given branches and `otherwise` target.
894    pub fn new(branches: Vec<(u128, BasicBlockIdx)>, otherwise: BasicBlockIdx) -> SwitchTargets {
895        SwitchTargets { branches, otherwise }
896    }
897}
898
899#[derive(#[automatically_derived]
impl ::core::marker::Copy for BorrowKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for BorrowKind {
    #[inline]
    fn clone(&self) -> BorrowKind {
        let _: ::core::clone::AssertParamIsClone<FakeBorrowKind>;
        let _: ::core::clone::AssertParamIsClone<MutBorrowKind>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for BorrowKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            BorrowKind::Shared =>
                ::core::fmt::Formatter::write_str(f, "Shared"),
            BorrowKind::Fake(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Fake",
                    &__self_0),
            BorrowKind::Mut { kind: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Mut",
                    "kind", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for BorrowKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<FakeBorrowKind>;
        let _: ::core::cmp::AssertParamIsEq<MutBorrowKind>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for BorrowKind {
    #[inline]
    fn eq(&self, other: &BorrowKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (BorrowKind::Fake(__self_0), BorrowKind::Fake(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (BorrowKind::Mut { kind: __self_0 }, BorrowKind::Mut {
                    kind: __arg1_0 }) => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for BorrowKind {
    #[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 {
            BorrowKind::Fake(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            BorrowKind::Mut { kind: __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 BorrowKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    BorrowKind::Shared =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "BorrowKind", 0u32, "Shared"),
                    BorrowKind::Fake(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "BorrowKind", 1u32, "Fake", __field0),
                    BorrowKind::Mut { ref kind } => {
                        let mut __serde_state =
                            _serde::Serializer::serialize_struct_variant(__serializer,
                                    "BorrowKind", 2u32, "Mut", 0 + 1)?;
                        _serde::ser::SerializeStructVariant::serialize_field(&mut __serde_state,
                                "kind", kind)?;
                        _serde::ser::SerializeStructVariant::end(__serde_state)
                    }
                }
            }
        }
    };Serialize)]
900pub enum BorrowKind {
901    /// Data must be immutable and is aliasable.
902    Shared,
903
904    /// An immutable, aliasable borrow that is discarded after borrow-checking. Can behave either
905    /// like a normal shared borrow or like a special shallow borrow (see [`FakeBorrowKind`]).
906    Fake(FakeBorrowKind),
907
908    /// Data is mutable and not aliasable.
909    Mut {
910        /// `true` if this borrow arose from method-call auto-ref
911        kind: MutBorrowKind,
912    },
913}
914
915impl BorrowKind {
916    pub fn to_mutable_lossy(self) -> Mutability {
917        match self {
918            BorrowKind::Mut { .. } => Mutability::Mut,
919            BorrowKind::Shared => Mutability::Not,
920            // FIXME: There's no type corresponding to a shallow borrow, so use `&` as an approximation.
921            BorrowKind::Fake(_) => Mutability::Not,
922        }
923    }
924}
925
926#[derive(#[automatically_derived]
impl ::core::marker::Copy for RawPtrKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for RawPtrKind {
    #[inline]
    fn clone(&self) -> RawPtrKind { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for RawPtrKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                RawPtrKind::Mut => "Mut",
                RawPtrKind::Const => "Const",
                RawPtrKind::FakeForPtrMetadata => "FakeForPtrMetadata",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for RawPtrKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for RawPtrKind {
    #[inline]
    fn eq(&self, other: &RawPtrKind) -> 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::hash::Hash for RawPtrKind {
    #[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 RawPtrKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    RawPtrKind::Mut =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "RawPtrKind", 0u32, "Mut"),
                    RawPtrKind::Const =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "RawPtrKind", 1u32, "Const"),
                    RawPtrKind::FakeForPtrMetadata =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "RawPtrKind", 2u32, "FakeForPtrMetadata"),
                }
            }
        }
    };Serialize)]
927pub enum RawPtrKind {
928    Mut,
929    Const,
930    FakeForPtrMetadata,
931}
932
933impl RawPtrKind {
934    pub fn to_mutable_lossy(self) -> Mutability {
935        match self {
936            RawPtrKind::Mut { .. } => Mutability::Mut,
937            RawPtrKind::Const => Mutability::Not,
938            // FIXME: There's no type corresponding to a shallow borrow, so use `&` as an approximation.
939            RawPtrKind::FakeForPtrMetadata => Mutability::Not,
940        }
941    }
942}
943
944#[derive(#[automatically_derived]
impl ::core::marker::Copy for MutBorrowKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for MutBorrowKind {
    #[inline]
    fn clone(&self) -> MutBorrowKind { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for MutBorrowKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                MutBorrowKind::Default => "Default",
                MutBorrowKind::TwoPhaseBorrow => "TwoPhaseBorrow",
                MutBorrowKind::ClosureCapture => "ClosureCapture",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for MutBorrowKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for MutBorrowKind {
    #[inline]
    fn eq(&self, other: &MutBorrowKind) -> 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::hash::Hash for MutBorrowKind {
    #[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 MutBorrowKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    MutBorrowKind::Default =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "MutBorrowKind", 0u32, "Default"),
                    MutBorrowKind::TwoPhaseBorrow =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "MutBorrowKind", 1u32, "TwoPhaseBorrow"),
                    MutBorrowKind::ClosureCapture =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "MutBorrowKind", 2u32, "ClosureCapture"),
                }
            }
        }
    };Serialize)]
945pub enum MutBorrowKind {
946    Default,
947    TwoPhaseBorrow,
948    ClosureCapture,
949}
950
951#[derive(#[automatically_derived]
impl ::core::marker::Copy for FakeBorrowKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for FakeBorrowKind {
    #[inline]
    fn clone(&self) -> FakeBorrowKind { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for FakeBorrowKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                FakeBorrowKind::Deep => "Deep",
                FakeBorrowKind::Shallow => "Shallow",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for FakeBorrowKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for FakeBorrowKind {
    #[inline]
    fn eq(&self, other: &FakeBorrowKind) -> 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::hash::Hash for FakeBorrowKind {
    #[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 FakeBorrowKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    FakeBorrowKind::Deep =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FakeBorrowKind", 0u32, "Deep"),
                    FakeBorrowKind::Shallow =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "FakeBorrowKind", 1u32, "Shallow"),
                }
            }
        }
    };Serialize)]
952pub enum FakeBorrowKind {
953    /// A shared (deep) borrow. Data must be immutable and is aliasable.
954    Deep,
955    /// The immediately borrowed place must be immutable, but projections from
956    /// it don't need to be. This is used to prevent match guards from replacing
957    /// the scrutinee. For example, a fake borrow of `a.b` doesn't
958    /// conflict with a mutable borrow of `a.b.c`.
959    Shallow,
960}
961
962#[derive(#[automatically_derived]
impl ::core::marker::Copy for Mutability { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Mutability {
    #[inline]
    fn clone(&self) -> Mutability { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Mutability {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                Mutability::Not => "Not",
                Mutability::Mut => "Mut",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for Mutability {
    #[inline]
    fn eq(&self, other: &Mutability) -> 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 Mutability {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for Mutability {
    #[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 Mutability {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    Mutability::Not =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "Mutability", 0u32, "Not"),
                    Mutability::Mut =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "Mutability", 1u32, "Mut"),
                }
            }
        }
    };Serialize)]
963pub enum Mutability {
964    Not,
965    Mut,
966}
967
968#[derive(#[automatically_derived]
impl ::core::marker::Copy for Safety { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Safety {
    #[inline]
    fn clone(&self) -> Safety { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Safety {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                Safety::Safe => "Safe",
                Safety::Unsafe => "Unsafe",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for Safety {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for Safety {
    #[inline]
    fn eq(&self, other: &Safety) -> 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::hash::Hash for Safety {
    #[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 Safety {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    Safety::Safe =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "Safety", 0u32, "Safe"),
                    Safety::Unsafe =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "Safety", 1u32, "Unsafe"),
                }
            }
        }
    };Serialize)]
969pub enum Safety {
970    Safe,
971    Unsafe,
972}
973
974#[derive(#[automatically_derived]
impl ::core::marker::Copy for PointerCoercion { }Copy, #[automatically_derived]
impl ::core::clone::Clone for PointerCoercion {
    #[inline]
    fn clone(&self) -> PointerCoercion {
        let _: ::core::clone::AssertParamIsClone<Safety>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for PointerCoercion {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            PointerCoercion::ReifyFnPointer(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ReifyFnPointer", &__self_0),
            PointerCoercion::UnsafeFnPointer =>
                ::core::fmt::Formatter::write_str(f, "UnsafeFnPointer"),
            PointerCoercion::ClosureFnPointer(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ClosureFnPointer", &__self_0),
            PointerCoercion::MutToConstPointer =>
                ::core::fmt::Formatter::write_str(f, "MutToConstPointer"),
            PointerCoercion::ArrayToPointer =>
                ::core::fmt::Formatter::write_str(f, "ArrayToPointer"),
            PointerCoercion::Unsize =>
                ::core::fmt::Formatter::write_str(f, "Unsize"),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for PointerCoercion {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Safety>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for PointerCoercion {
    #[inline]
    fn eq(&self, other: &PointerCoercion) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (PointerCoercion::ReifyFnPointer(__self_0),
                    PointerCoercion::ReifyFnPointer(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (PointerCoercion::ClosureFnPointer(__self_0),
                    PointerCoercion::ClosureFnPointer(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for PointerCoercion {
    #[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 {
            PointerCoercion::ReifyFnPointer(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            PointerCoercion::ClosureFnPointer(__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 PointerCoercion {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    PointerCoercion::ReifyFnPointer(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "PointerCoercion", 0u32, "ReifyFnPointer", __field0),
                    PointerCoercion::UnsafeFnPointer =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "PointerCoercion", 1u32, "UnsafeFnPointer"),
                    PointerCoercion::ClosureFnPointer(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "PointerCoercion", 2u32, "ClosureFnPointer", __field0),
                    PointerCoercion::MutToConstPointer =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "PointerCoercion", 3u32, "MutToConstPointer"),
                    PointerCoercion::ArrayToPointer =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "PointerCoercion", 4u32, "ArrayToPointer"),
                    PointerCoercion::Unsize =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "PointerCoercion", 5u32, "Unsize"),
                }
            }
        }
    };Serialize)]
975pub enum PointerCoercion {
976    /// Go from a fn-item type to a fn-pointer type.
977    ReifyFnPointer(Safety),
978
979    /// Go from a safe fn pointer to an unsafe fn pointer.
980    UnsafeFnPointer,
981
982    /// Go from a non-capturing closure to a fn pointer or an unsafe fn pointer.
983    /// It cannot convert a closure that requires unsafe.
984    ClosureFnPointer(Safety),
985
986    /// Go from a mut raw pointer to a const raw pointer.
987    MutToConstPointer,
988
989    /// Go from `*const [T; N]` to `*const T`
990    ArrayToPointer,
991
992    /// Unsize a pointer/reference value, e.g., `&[T; n]` to
993    /// `&[T]`. Note that the source could be a thin or wide pointer.
994    /// This will do things like convert thin pointers to wide
995    /// pointers, or convert structs containing thin pointers to
996    /// structs containing wide pointers, or convert between wide
997    /// pointers.
998    Unsize,
999}
1000
1001#[derive(#[automatically_derived]
impl ::core::marker::Copy for CastKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for CastKind {
    #[inline]
    fn clone(&self) -> CastKind {
        let _: ::core::clone::AssertParamIsClone<PointerCoercion>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CastKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            CastKind::PointerExposeAddress =>
                ::core::fmt::Formatter::write_str(f, "PointerExposeAddress"),
            CastKind::PointerWithExposedProvenance =>
                ::core::fmt::Formatter::write_str(f,
                    "PointerWithExposedProvenance"),
            CastKind::PointerCoercion(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "PointerCoercion", &__self_0),
            CastKind::IntToInt =>
                ::core::fmt::Formatter::write_str(f, "IntToInt"),
            CastKind::FloatToInt =>
                ::core::fmt::Formatter::write_str(f, "FloatToInt"),
            CastKind::FloatToFloat =>
                ::core::fmt::Formatter::write_str(f, "FloatToFloat"),
            CastKind::IntToFloat =>
                ::core::fmt::Formatter::write_str(f, "IntToFloat"),
            CastKind::PtrToPtr =>
                ::core::fmt::Formatter::write_str(f, "PtrToPtr"),
            CastKind::FnPtrToPtr =>
                ::core::fmt::Formatter::write_str(f, "FnPtrToPtr"),
            CastKind::Transmute =>
                ::core::fmt::Formatter::write_str(f, "Transmute"),
            CastKind::Subtype =>
                ::core::fmt::Formatter::write_str(f, "Subtype"),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for CastKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<PointerCoercion>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for CastKind {
    #[inline]
    fn eq(&self, other: &CastKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (CastKind::PointerCoercion(__self_0),
                    CastKind::PointerCoercion(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for CastKind {
    #[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 {
            CastKind::PointerCoercion(__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 CastKind {
            fn serialize<__S>(&self, __serializer: __S)
                -> _serde::__private228::Result<__S::Ok, __S::Error> where
                __S: _serde::Serializer {
                match *self {
                    CastKind::PointerExposeAddress =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 0u32, "PointerExposeAddress"),
                    CastKind::PointerWithExposedProvenance =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 1u32, "PointerWithExposedProvenance"),
                    CastKind::PointerCoercion(ref __field0) =>
                        _serde::Serializer::serialize_newtype_variant(__serializer,
                            "CastKind", 2u32, "PointerCoercion", __field0),
                    CastKind::IntToInt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 3u32, "IntToInt"),
                    CastKind::FloatToInt =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 4u32, "FloatToInt"),
                    CastKind::FloatToFloat =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 5u32, "FloatToFloat"),
                    CastKind::IntToFloat =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 6u32, "IntToFloat"),
                    CastKind::PtrToPtr =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 7u32, "PtrToPtr"),
                    CastKind::FnPtrToPtr =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 8u32, "FnPtrToPtr"),
                    CastKind::Transmute =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 9u32, "Transmute"),
                    CastKind::Subtype =>
                        _serde::Serializer::serialize_unit_variant(__serializer,
                            "CastKind", 10u32, "Subtype"),
                }
            }
        }
    };Serialize)]
1002pub enum CastKind {
1003    // FIXME(smir-rename): rename this to PointerExposeProvenance
1004    PointerExposeAddress,
1005    PointerWithExposedProvenance,
1006    PointerCoercion(PointerCoercion),
1007    IntToInt,
1008    FloatToInt,
1009    FloatToFloat,
1010    IntToFloat,
1011    PtrToPtr,
1012    FnPtrToPtr,
1013    Transmute,
1014    Subtype,
1015}
1016
1017impl Operand {
1018    /// Get the type of an operand relative to the local declaration.
1019    ///
1020    /// In order to retrieve the correct type, the `locals` argument must match the list of all
1021    /// locals from the function body where this operand originates from.
1022    ///
1023    /// Errors indicate a malformed operand or incompatible locals list.
1024    pub fn ty(&self, locals: &[LocalDecl]) -> Result<Ty, Error> {
1025        match self {
1026            Operand::Copy(place) | Operand::Move(place) => place.ty(locals),
1027            Operand::Constant(c) => Ok(c.ty()),
1028            Operand::RuntimeChecks(_) => Ok(Ty::bool_ty()),
1029        }
1030    }
1031}
1032
1033impl ConstOperand {
1034    pub fn ty(&self) -> Ty {
1035        self.const_.ty()
1036    }
1037}
1038
1039impl Place {
1040    /// Resolve down the chain of projections to get the type referenced at the end of it.
1041    /// E.g.:
1042    /// Calling `ty()` on `var.field` should return the type of `field`.
1043    ///
1044    /// In order to retrieve the correct type, the `locals` argument must match the list of all
1045    /// locals from the function body where this place originates from.
1046    pub fn ty(&self, locals: &[LocalDecl]) -> Result<Ty, Error> {
1047        self.projection.iter().try_fold(locals[self.local].ty, |place_ty, elem| elem.ty(place_ty))
1048    }
1049}
1050
1051impl ProjectionElem {
1052    /// Get the expected type after applying this projection to a given place type.
1053    pub fn ty(&self, place_ty: Ty) -> Result<Ty, Error> {
1054        let ty = place_ty;
1055        match &self {
1056            ProjectionElem::Deref => Self::deref_ty(ty),
1057            ProjectionElem::Field(_idx, fty) => Ok(*fty),
1058            ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } => Self::index_ty(ty),
1059            ProjectionElem::Subslice { from, to, from_end } => {
1060                Self::subslice_ty(ty, *from, *to, *from_end)
1061            }
1062            ProjectionElem::Downcast(_) => Ok(ty),
1063            ProjectionElem::OpaqueCast(ty) => Ok(*ty),
1064        }
1065    }
1066
1067    fn index_ty(ty: Ty) -> Result<Ty, Error> {
1068        ty.kind().builtin_index().ok_or_else(|| Error(::alloc::__export::must_use({
            ::alloc::fmt::format(format_args!("Cannot index non-array type: {0:?}",
                    ty))
        }))error!("Cannot index non-array type: {ty:?}"))
1069    }
1070
1071    fn subslice_ty(ty: Ty, from: u64, to: u64, from_end: bool) -> Result<Ty, Error> {
1072        let ty_kind = ty.kind();
1073        match ty_kind {
1074            TyKind::RigidTy(RigidTy::Slice(..)) => Ok(ty),
1075            TyKind::RigidTy(RigidTy::Array(inner, _)) if !from_end => Ty::try_new_array(
1076                inner,
1077                to.checked_sub(from).ok_or_else(|| Error(::alloc::__export::must_use({
            ::alloc::fmt::format(format_args!("Subslice overflow: {0}..{1}",
                    from, to))
        }))error!("Subslice overflow: {from}..{to}"))?,
1078            ),
1079            TyKind::RigidTy(RigidTy::Array(inner, size)) => {
1080                let size = size.eval_target_usize()?;
1081                let len = size - from - to;
1082                Ty::try_new_array(inner, len)
1083            }
1084            _ => Err(Error(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("Cannot subslice non-array type: `{0:?}`",
                ty_kind))
    })format!("Cannot subslice non-array type: `{ty_kind:?}`"))),
1085        }
1086    }
1087
1088    fn deref_ty(ty: Ty) -> Result<Ty, Error> {
1089        let deref_ty = ty
1090            .kind()
1091            .builtin_deref(true)
1092            .ok_or_else(|| Error(::alloc::__export::must_use({
            ::alloc::fmt::format(format_args!("Cannot dereference type: {0:?}",
                    ty))
        }))error!("Cannot dereference type: {ty:?}"))?;
1093        Ok(deref_ty.ty)
1094    }
1095}