Skip to main content

rustc_middle/mir/
mod.rs

1//! MIR datatypes and passes. See the [rustc dev guide] for more info.
2//!
3//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/mir/index.html
4
5use std::borrow::Cow;
6use std::fmt::{self, Debug, Formatter};
7use std::iter;
8use std::ops::{Index, IndexMut};
9
10pub use basic_blocks::BasicBlocks;
11use either::Either;
12use polonius_engine::Atom;
13use rustc_abi::{FieldIdx, VariantIdx};
14pub use rustc_ast::{Mutability, Pinnedness};
15use rustc_data_structures::fx::{FxHashMap, FxHashSet};
16use rustc_data_structures::graph::dominators::Dominators;
17use rustc_errors::ErrorGuaranteed;
18use rustc_hir::def::{CtorKind, Namespace};
19use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
20use rustc_hir::{
21    self as hir, BindingMode, ByRef, CoroutineDesugaring, CoroutineKind, HirId, ImplicitSelfKind,
22};
23use rustc_index::bit_set::DenseBitSet;
24use rustc_index::{Idx, IndexSlice, IndexVec};
25use rustc_macros::{StableHash, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
26use rustc_serialize::{Decodable, Encodable};
27use rustc_span::{DUMMY_SP, Span, Spanned, Symbol, bug};
28use tracing::{debug, trace};
29
30pub use self::query::*;
31use crate::mir::interpret::{AllocRange, Scalar};
32use crate::ty::codec::{TyDecoder, TyEncoder};
33use crate::ty::print::{FmtPrinter, Printer, pretty_print_const, with_no_trimmed_paths};
34use crate::ty::{
35    self, GenericArg, GenericArgsRef, Instance, InstanceKind, List, ShimKind, Ty, TyCtxt,
36    TypeVisitableExt, TypingEnv, UserTypeAnnotationIndex,
37};
38
39mod basic_blocks;
40mod consts;
41pub mod coverage;
42mod generic_graph;
43pub mod generic_graphviz;
44pub mod graphviz;
45pub mod interpret;
46pub mod pretty;
47mod query;
48mod statement;
49mod syntax;
50mod terminator;
51pub mod traversal;
52pub mod visit;
53
54pub use consts::*;
55use pretty::pretty_print_const_value;
56pub use statement::*;
57pub use syntax::*;
58pub use terminator::*;
59
60pub use self::generic_graph::graphviz_safe_def_name;
61pub use self::graphviz::write_mir_graphviz;
62pub use self::pretty::{MirDumper, PassWhere, display_allocation, write_mir_pretty};
63
64/// Types for locals
65pub type LocalDecls<'tcx> = IndexSlice<Local, LocalDecl<'tcx>>;
66
67pub trait HasLocalDecls<'tcx> {
68    fn local_decls(&self) -> &LocalDecls<'tcx>;
69}
70
71impl<'tcx> HasLocalDecls<'tcx> for IndexVec<Local, LocalDecl<'tcx>> {
72    #[inline]
73    fn local_decls(&self) -> &LocalDecls<'tcx> {
74        self
75    }
76}
77
78impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> {
79    #[inline]
80    fn local_decls(&self) -> &LocalDecls<'tcx> {
81        self
82    }
83}
84
85impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> {
86    #[inline]
87    fn local_decls(&self) -> &LocalDecls<'tcx> {
88        &self.local_decls
89    }
90}
91
92impl MirPhase {
93    pub fn name(&self) -> &'static str {
94        match *self {
95            MirPhase::Built => "built",
96            MirPhase::Analysis(AnalysisPhase::Initial) => "analysis",
97            MirPhase::Analysis(AnalysisPhase::PostCleanup) => "analysis-post-cleanup",
98            MirPhase::Runtime(RuntimePhase::Initial) => "runtime",
99            MirPhase::Runtime(RuntimePhase::PostCleanup) => "runtime-post-cleanup",
100            MirPhase::Runtime(RuntimePhase::Optimized) => "runtime-optimized",
101        }
102    }
103
104    /// Gets the (dialect, phase) index of the current `MirPhase`. Both numbers
105    /// are 1-indexed.
106    pub fn index(&self) -> (usize, usize) {
107        match *self {
108            MirPhase::Built => (1, 1),
109            MirPhase::Analysis(analysis_phase) => (2, 1 + analysis_phase as usize),
110            MirPhase::Runtime(runtime_phase) => (3, 1 + runtime_phase as usize),
111        }
112    }
113}
114
115/// Where a specific `mir::Body` comes from.
116#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for MirSource<'tcx> { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl<'tcx> ::core::clone::TrivialClone for MirSource<'tcx> { }
#[automatically_derived]
impl<'tcx> ::core::clone::Clone for MirSource<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<InstanceKind<'tcx>>;
        let _: ::core::clone::AssertParamIsClone<Option<Promoted>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for MirSource<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "MirSource",
            "instance", &self.instance, "promoted", &&self.promoted)
    }
}Debug, #[automatically_derived]
impl<'tcx> ::core::marker::StructuralPartialEq for MirSource<'tcx> { }
#[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for MirSource<'tcx> {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.instance == other.instance && self.promoted == other.promoted
    }
}PartialEq, #[automatically_derived]
impl<'tcx> ::core::cmp::Eq for MirSource<'tcx> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<InstanceKind<'tcx>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Promoted>>;
    }
}Eq)]
117#[derive(const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            MirSource<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    MirSource {
                        instance: ref __binding_0, promoted: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for MirSource<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let MirSource {
                        instance: ref __binding_0, promoted: ref __binding_1 } =
                    *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for MirSource<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                MirSource {
                    instance: ::rustc_serialize::Decodable::decode(__decoder),
                    promoted: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for MirSource<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        MirSource { instance: __binding_0, promoted: __binding_1 }
                            => {
                            MirSource {
                                instance: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                promoted: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    MirSource { instance: __binding_0, promoted: __binding_1 }
                        => {
                        MirSource {
                            instance: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            promoted: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for MirSource<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    MirSource {
                        instance: ref __binding_0, promoted: ref __binding_1 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
118pub struct MirSource<'tcx> {
119    pub instance: InstanceKind<'tcx>,
120
121    /// If `Some`, this is a promoted rvalue within the parent function.
122    pub promoted: Option<Promoted>,
123}
124
125impl<'tcx> MirSource<'tcx> {
126    pub fn item(def_id: DefId) -> Self {
127        MirSource { instance: InstanceKind::Item(def_id), promoted: None }
128    }
129
130    pub fn from_shim(shim: ShimKind<'tcx>) -> Self {
131        MirSource { instance: InstanceKind::Shim(shim), promoted: None }
132    }
133
134    #[inline]
135    pub fn def_id(&self) -> DefId {
136        self.instance.def_id()
137    }
138}
139
140/// Additional information carried by a MIR body when it is lowered from a coroutine.
141/// This information is modified as it is lowered during the `StateTransform` MIR pass,
142/// so not all fields will be active at a given time. For example, the `yield_ty` is
143/// taken out of the field after yields are turned into returns, and the `coroutine_drop`
144/// body is only populated after the state transform pass.
145#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for CoroutineInfo<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        CoroutineInfo {
            yield_ty: ::core::clone::Clone::clone(&self.yield_ty),
            resume_ty: ::core::clone::Clone::clone(&self.resume_ty),
            coroutine_drop: ::core::clone::Clone::clone(&self.coroutine_drop),
            coroutine_drop_async: ::core::clone::Clone::clone(&self.coroutine_drop_async),
            coroutine_drop_proxy_async: ::core::clone::Clone::clone(&self.coroutine_drop_proxy_async),
            coroutine_layout: ::core::clone::Clone::clone(&self.coroutine_layout),
            coroutine_kind: ::core::clone::Clone::clone(&self.coroutine_kind),
        }
    }
}Clone, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for CoroutineInfo<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let CoroutineInfo {
                        yield_ty: ref __binding_0,
                        resume_ty: ref __binding_1,
                        coroutine_drop: ref __binding_2,
                        coroutine_drop_async: ref __binding_3,
                        coroutine_drop_proxy_async: ref __binding_4,
                        coroutine_layout: ref __binding_5,
                        coroutine_kind: ref __binding_6 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_4,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_5,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_6,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for CoroutineInfo<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                CoroutineInfo {
                    yield_ty: ::rustc_serialize::Decodable::decode(__decoder),
                    resume_ty: ::rustc_serialize::Decodable::decode(__decoder),
                    coroutine_drop: ::rustc_serialize::Decodable::decode(__decoder),
                    coroutine_drop_async: ::rustc_serialize::Decodable::decode(__decoder),
                    coroutine_drop_proxy_async: ::rustc_serialize::Decodable::decode(__decoder),
                    coroutine_layout: ::rustc_serialize::Decodable::decode(__decoder),
                    coroutine_kind: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for CoroutineInfo<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["yield_ty", "resume_ty", "coroutine_drop",
                        "coroutine_drop_async", "coroutine_drop_proxy_async",
                        "coroutine_layout", "coroutine_kind"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.yield_ty, &self.resume_ty, &self.coroutine_drop,
                        &self.coroutine_drop_async,
                        &self.coroutine_drop_proxy_async, &self.coroutine_layout,
                        &&self.coroutine_kind];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "CoroutineInfo",
            names, values)
    }
}Debug, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            CoroutineInfo<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    CoroutineInfo {
                        yield_ty: ref __binding_0,
                        resume_ty: ref __binding_1,
                        coroutine_drop: ref __binding_2,
                        coroutine_drop_async: ref __binding_3,
                        coroutine_drop_proxy_async: ref __binding_4,
                        coroutine_layout: ref __binding_5,
                        coroutine_kind: ref __binding_6 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                        { __binding_6.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for CoroutineInfo<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        CoroutineInfo {
                            yield_ty: __binding_0,
                            resume_ty: __binding_1,
                            coroutine_drop: __binding_2,
                            coroutine_drop_async: __binding_3,
                            coroutine_drop_proxy_async: __binding_4,
                            coroutine_layout: __binding_5,
                            coroutine_kind: __binding_6 } => {
                            CoroutineInfo {
                                yield_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                resume_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                coroutine_drop: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                                coroutine_drop_async: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
                                        __folder)?,
                                coroutine_drop_proxy_async: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
                                        __folder)?,
                                coroutine_layout: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_5,
                                        __folder)?,
                                coroutine_kind: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_6,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    CoroutineInfo {
                        yield_ty: __binding_0,
                        resume_ty: __binding_1,
                        coroutine_drop: __binding_2,
                        coroutine_drop_async: __binding_3,
                        coroutine_drop_proxy_async: __binding_4,
                        coroutine_layout: __binding_5,
                        coroutine_kind: __binding_6 } => {
                        CoroutineInfo {
                            yield_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            resume_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            coroutine_drop: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
                                __folder),
                            coroutine_drop_async: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
                                __folder),
                            coroutine_drop_proxy_async: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
                                __folder),
                            coroutine_layout: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_5,
                                __folder),
                            coroutine_kind: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_6,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for CoroutineInfo<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    CoroutineInfo {
                        yield_ty: ref __binding_0,
                        resume_ty: ref __binding_1,
                        coroutine_drop: ref __binding_2,
                        coroutine_drop_async: ref __binding_3,
                        coroutine_drop_proxy_async: ref __binding_4,
                        coroutine_layout: ref __binding_5,
                        coroutine_kind: ref __binding_6 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_5,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_6,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
146pub struct CoroutineInfo<'tcx> {
147    /// The yield type of the function. This field is removed after the state transform pass.
148    pub yield_ty: Option<Ty<'tcx>>,
149
150    /// The resume type of the function. This field is removed after the state transform pass.
151    pub resume_ty: Option<Ty<'tcx>>,
152
153    /// Coroutine drop glue. This field is populated after the state transform pass.
154    pub coroutine_drop: Option<Body<'tcx>>,
155
156    /// Coroutine async drop glue.
157    pub coroutine_drop_async: Option<Body<'tcx>>,
158
159    /// When coroutine has sync drop, this is async proxy calling `coroutine_drop` sync impl.
160    pub coroutine_drop_proxy_async: Option<Body<'tcx>>,
161
162    /// The layout of a coroutine. Produced by the state transformation.
163    pub coroutine_layout: Option<CoroutineLayout<'tcx>>,
164
165    /// If this is a coroutine then record the type of source expression that caused this coroutine
166    /// to be created.
167    pub coroutine_kind: CoroutineKind,
168}
169
170impl<'tcx> CoroutineInfo<'tcx> {
171    // Sets up `CoroutineInfo` for a pre-coroutine-transform MIR body.
172    pub fn initial(
173        coroutine_kind: CoroutineKind,
174        yield_ty: Ty<'tcx>,
175        resume_ty: Ty<'tcx>,
176    ) -> CoroutineInfo<'tcx> {
177        CoroutineInfo {
178            coroutine_kind,
179            yield_ty: Some(yield_ty),
180            resume_ty: Some(resume_ty),
181            coroutine_drop: None,
182            coroutine_drop_async: None,
183            coroutine_drop_proxy_async: None,
184            coroutine_layout: None,
185        }
186    }
187}
188
189/// Some item that needs to monomorphize successfully for a MIR body to be considered well-formed.
190#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for MentionedItem<'tcx> { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl<'tcx> ::core::clone::TrivialClone for MentionedItem<'tcx> { }
#[automatically_derived]
impl<'tcx> ::core::clone::Clone for MentionedItem<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
        let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
        let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
        let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
        let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::marker::StructuralPartialEq for MentionedItem<'tcx> { }
#[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for MentionedItem<'tcx> {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Fn(__self_0), Self::Fn(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::Drop(__self_0), Self::Drop(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::UnsizeCast { source_ty: __self_0, target_ty: __self_1
                    }, Self::UnsizeCast {
                    source_ty: __arg1_0, target_ty: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (Self::Closure(__self_0), Self::Closure(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl<'tcx> ::core::cmp::Eq for MentionedItem<'tcx> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
        let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
        let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
        let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
        let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
    }
}Eq, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for MentionedItem<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Fn(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Fn",
                    &__self_0),
            Self::Drop(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Drop",
                    &__self_0),
            Self::UnsizeCast { source_ty: __self_0, target_ty: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "UnsizeCast", "source_ty", __self_0, "target_ty",
                    &__self_1),
            Self::Closure(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Closure", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'tcx> ::core::hash::Hash for MentionedItem<'tcx> {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::Fn(__self_0) => ::core::hash::Hash::hash(__self_0, state),
            Self::Drop(__self_0) => ::core::hash::Hash::hash(__self_0, state),
            Self::UnsizeCast { source_ty: __self_0, target_ty: __self_1 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            Self::Closure(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
        }
    }
}Hash, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            MentionedItem<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    MentionedItem::Fn(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    MentionedItem::Drop(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    MentionedItem::UnsizeCast {
                        source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
                        {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    MentionedItem::Closure(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for MentionedItem<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        MentionedItem::Fn(ref __binding_0) => { 0usize }
                        MentionedItem::Drop(ref __binding_0) => { 1usize }
                        MentionedItem::UnsizeCast {
                            source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
                            {
                            2usize
                        }
                        MentionedItem::Closure(ref __binding_0) => { 3usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    MentionedItem::Fn(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    MentionedItem::Drop(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    MentionedItem::UnsizeCast {
                        source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
                        {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    MentionedItem::Closure(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for MentionedItem<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        MentionedItem::Fn(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => {
                        MentionedItem::Drop(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    2usize => {
                        MentionedItem::UnsizeCast {
                            source_ty: ::rustc_serialize::Decodable::decode(__decoder),
                            target_ty: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    3usize => {
                        MentionedItem::Closure(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `MentionedItem`, expected 0..4, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable)]
191#[derive(const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for MentionedItem<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        MentionedItem::Fn(__binding_0) => {
                            MentionedItem::Fn(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        MentionedItem::Drop(__binding_0) => {
                            MentionedItem::Drop(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        MentionedItem::UnsizeCast {
                            source_ty: __binding_0, target_ty: __binding_1 } => {
                            MentionedItem::UnsizeCast {
                                source_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                target_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                            }
                        }
                        MentionedItem::Closure(__binding_0) => {
                            MentionedItem::Closure(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    MentionedItem::Fn(__binding_0) => {
                        MentionedItem::Fn(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    MentionedItem::Drop(__binding_0) => {
                        MentionedItem::Drop(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    MentionedItem::UnsizeCast {
                        source_ty: __binding_0, target_ty: __binding_1 } => {
                        MentionedItem::UnsizeCast {
                            source_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            target_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                    MentionedItem::Closure(__binding_0) => {
                        MentionedItem::Closure(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for MentionedItem<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    MentionedItem::Fn(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    MentionedItem::Drop(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    MentionedItem::UnsizeCast {
                        source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
                        {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    MentionedItem::Closure(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
192pub enum MentionedItem<'tcx> {
193    /// A function that gets called. We don't necessarily know its precise type yet, since it can be
194    /// hidden behind a generic.
195    Fn(Ty<'tcx>),
196    /// A type that has its drop shim called.
197    Drop(Ty<'tcx>),
198    /// Unsizing casts might require vtables, so we have to record them.
199    UnsizeCast { source_ty: Ty<'tcx>, target_ty: Ty<'tcx> },
200    /// A closure that is coerced to a function pointer.
201    Closure(Ty<'tcx>),
202}
203
204/// The lowered representation of a single function.
205#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for Body<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        Body {
            basic_blocks: ::core::clone::Clone::clone(&self.basic_blocks),
            phase: ::core::clone::Clone::clone(&self.phase),
            pass_count: ::core::clone::Clone::clone(&self.pass_count),
            source: ::core::clone::Clone::clone(&self.source),
            source_scopes: ::core::clone::Clone::clone(&self.source_scopes),
            coroutine: ::core::clone::Clone::clone(&self.coroutine),
            local_decls: ::core::clone::Clone::clone(&self.local_decls),
            user_type_annotations: ::core::clone::Clone::clone(&self.user_type_annotations),
            arg_count: ::core::clone::Clone::clone(&self.arg_count),
            spread_arg: ::core::clone::Clone::clone(&self.spread_arg),
            var_debug_info: ::core::clone::Clone::clone(&self.var_debug_info),
            span: ::core::clone::Clone::clone(&self.span),
            required_consts: ::core::clone::Clone::clone(&self.required_consts),
            mentioned_items: ::core::clone::Clone::clone(&self.mentioned_items),
            is_polymorphic: ::core::clone::Clone::clone(&self.is_polymorphic),
            injection_phase: ::core::clone::Clone::clone(&self.injection_phase),
            tainted_by_errors: ::core::clone::Clone::clone(&self.tainted_by_errors),
            coverage_early_info: ::core::clone::Clone::clone(&self.coverage_early_info),
            coverage_mir_info: ::core::clone::Clone::clone(&self.coverage_mir_info),
        }
    }
}Clone, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for Body<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let Body {
                        basic_blocks: ref __binding_0,
                        phase: ref __binding_1,
                        pass_count: ref __binding_2,
                        source: ref __binding_3,
                        source_scopes: ref __binding_4,
                        coroutine: ref __binding_5,
                        local_decls: ref __binding_6,
                        user_type_annotations: ref __binding_7,
                        arg_count: ref __binding_8,
                        spread_arg: ref __binding_9,
                        var_debug_info: ref __binding_10,
                        span: ref __binding_11,
                        required_consts: ref __binding_12,
                        mentioned_items: ref __binding_13,
                        is_polymorphic: ref __binding_14,
                        injection_phase: ref __binding_15,
                        tainted_by_errors: ref __binding_16,
                        coverage_early_info: ref __binding_17,
                        coverage_mir_info: ref __binding_18 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_4,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_5,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_6,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_7,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_8,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_9,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_10,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_11,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_12,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_13,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_14,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_15,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_16,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_17,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_18,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for Body<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                Body {
                    basic_blocks: ::rustc_serialize::Decodable::decode(__decoder),
                    phase: ::rustc_serialize::Decodable::decode(__decoder),
                    pass_count: ::rustc_serialize::Decodable::decode(__decoder),
                    source: ::rustc_serialize::Decodable::decode(__decoder),
                    source_scopes: ::rustc_serialize::Decodable::decode(__decoder),
                    coroutine: ::rustc_serialize::Decodable::decode(__decoder),
                    local_decls: ::rustc_serialize::Decodable::decode(__decoder),
                    user_type_annotations: ::rustc_serialize::Decodable::decode(__decoder),
                    arg_count: ::rustc_serialize::Decodable::decode(__decoder),
                    spread_arg: ::rustc_serialize::Decodable::decode(__decoder),
                    var_debug_info: ::rustc_serialize::Decodable::decode(__decoder),
                    span: ::rustc_serialize::Decodable::decode(__decoder),
                    required_consts: ::rustc_serialize::Decodable::decode(__decoder),
                    mentioned_items: ::rustc_serialize::Decodable::decode(__decoder),
                    is_polymorphic: ::rustc_serialize::Decodable::decode(__decoder),
                    injection_phase: ::rustc_serialize::Decodable::decode(__decoder),
                    tainted_by_errors: ::rustc_serialize::Decodable::decode(__decoder),
                    coverage_early_info: ::rustc_serialize::Decodable::decode(__decoder),
                    coverage_mir_info: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for Body<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["basic_blocks", "phase", "pass_count", "source",
                        "source_scopes", "coroutine", "local_decls",
                        "user_type_annotations", "arg_count", "spread_arg",
                        "var_debug_info", "span", "required_consts",
                        "mentioned_items", "is_polymorphic", "injection_phase",
                        "tainted_by_errors", "coverage_early_info",
                        "coverage_mir_info"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.basic_blocks, &self.phase, &self.pass_count, &self.source,
                        &self.source_scopes, &self.coroutine, &self.local_decls,
                        &self.user_type_annotations, &self.arg_count,
                        &self.spread_arg, &self.var_debug_info, &self.span,
                        &self.required_consts, &self.mentioned_items,
                        &self.is_polymorphic, &self.injection_phase,
                        &self.tainted_by_errors, &self.coverage_early_info,
                        &&self.coverage_mir_info];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "Body", names,
            values)
    }
}Debug, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            Body<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Body {
                        basic_blocks: ref __binding_0,
                        phase: ref __binding_1,
                        pass_count: ref __binding_2,
                        source: ref __binding_3,
                        source_scopes: ref __binding_4,
                        coroutine: ref __binding_5,
                        local_decls: ref __binding_6,
                        user_type_annotations: ref __binding_7,
                        arg_count: ref __binding_8,
                        spread_arg: ref __binding_9,
                        var_debug_info: ref __binding_10,
                        span: ref __binding_11,
                        required_consts: ref __binding_12,
                        mentioned_items: ref __binding_13,
                        is_polymorphic: ref __binding_14,
                        injection_phase: ref __binding_15,
                        tainted_by_errors: ref __binding_16,
                        coverage_early_info: ref __binding_17,
                        coverage_mir_info: ref __binding_18 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                        { __binding_6.stable_hash(__hcx, __hasher); }
                        { __binding_7.stable_hash(__hcx, __hasher); }
                        { __binding_8.stable_hash(__hcx, __hasher); }
                        { __binding_9.stable_hash(__hcx, __hasher); }
                        { __binding_10.stable_hash(__hcx, __hasher); }
                        { __binding_11.stable_hash(__hcx, __hasher); }
                        { __binding_12.stable_hash(__hcx, __hasher); }
                        { __binding_13.stable_hash(__hcx, __hasher); }
                        { __binding_14.stable_hash(__hcx, __hasher); }
                        { __binding_15.stable_hash(__hcx, __hasher); }
                        { __binding_16.stable_hash(__hcx, __hasher); }
                        { __binding_17.stable_hash(__hcx, __hasher); }
                        { __binding_18.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for Body<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        Body {
                            basic_blocks: __binding_0,
                            phase: __binding_1,
                            pass_count: __binding_2,
                            source: __binding_3,
                            source_scopes: __binding_4,
                            coroutine: __binding_5,
                            local_decls: __binding_6,
                            user_type_annotations: __binding_7,
                            arg_count: __binding_8,
                            spread_arg: __binding_9,
                            var_debug_info: __binding_10,
                            span: __binding_11,
                            required_consts: __binding_12,
                            mentioned_items: __binding_13,
                            is_polymorphic: __binding_14,
                            injection_phase: __binding_15,
                            tainted_by_errors: __binding_16,
                            coverage_early_info: __binding_17,
                            coverage_mir_info: __binding_18 } => {
                            Body {
                                basic_blocks: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                phase: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                pass_count: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                                source: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
                                        __folder)?,
                                source_scopes: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
                                        __folder)?,
                                coroutine: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_5,
                                        __folder)?,
                                local_decls: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_6,
                                        __folder)?,
                                user_type_annotations: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_7,
                                        __folder)?,
                                arg_count: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_8,
                                        __folder)?,
                                spread_arg: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_9,
                                        __folder)?,
                                var_debug_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_10,
                                        __folder)?,
                                span: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_11,
                                        __folder)?,
                                required_consts: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_12,
                                        __folder)?,
                                mentioned_items: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_13,
                                        __folder)?,
                                is_polymorphic: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_14,
                                        __folder)?,
                                injection_phase: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_15,
                                        __folder)?,
                                tainted_by_errors: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_16,
                                        __folder)?,
                                coverage_early_info: __binding_17,
                                coverage_mir_info: __binding_18,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    Body {
                        basic_blocks: __binding_0,
                        phase: __binding_1,
                        pass_count: __binding_2,
                        source: __binding_3,
                        source_scopes: __binding_4,
                        coroutine: __binding_5,
                        local_decls: __binding_6,
                        user_type_annotations: __binding_7,
                        arg_count: __binding_8,
                        spread_arg: __binding_9,
                        var_debug_info: __binding_10,
                        span: __binding_11,
                        required_consts: __binding_12,
                        mentioned_items: __binding_13,
                        is_polymorphic: __binding_14,
                        injection_phase: __binding_15,
                        tainted_by_errors: __binding_16,
                        coverage_early_info: __binding_17,
                        coverage_mir_info: __binding_18 } => {
                        Body {
                            basic_blocks: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            phase: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            pass_count: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
                                __folder),
                            source: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
                                __folder),
                            source_scopes: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
                                __folder),
                            coroutine: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_5,
                                __folder),
                            local_decls: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_6,
                                __folder),
                            user_type_annotations: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_7,
                                __folder),
                            arg_count: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_8,
                                __folder),
                            spread_arg: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_9,
                                __folder),
                            var_debug_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_10,
                                __folder),
                            span: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_11,
                                __folder),
                            required_consts: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_12,
                                __folder),
                            mentioned_items: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_13,
                                __folder),
                            is_polymorphic: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_14,
                                __folder),
                            injection_phase: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_15,
                                __folder),
                            tainted_by_errors: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_16,
                                __folder),
                            coverage_early_info: __binding_17,
                            coverage_mir_info: __binding_18,
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for Body<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    Body {
                        basic_blocks: ref __binding_0,
                        phase: ref __binding_1,
                        pass_count: ref __binding_2,
                        source: ref __binding_3,
                        source_scopes: ref __binding_4,
                        coroutine: ref __binding_5,
                        local_decls: ref __binding_6,
                        user_type_annotations: ref __binding_7,
                        arg_count: ref __binding_8,
                        spread_arg: ref __binding_9,
                        var_debug_info: ref __binding_10,
                        span: ref __binding_11,
                        required_consts: ref __binding_12,
                        mentioned_items: ref __binding_13,
                        is_polymorphic: ref __binding_14,
                        injection_phase: ref __binding_15,
                        tainted_by_errors: ref __binding_16, .. } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_5,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_6,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_7,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_8,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_9,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_10,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_11,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_12,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_13,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_14,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_15,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_16,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
206pub struct Body<'tcx> {
207    /// A list of basic blocks. References to basic block use a newtyped index type [`BasicBlock`]
208    /// that indexes into this vector.
209    pub basic_blocks: BasicBlocks<'tcx>,
210
211    /// Records how far through the "desugaring and optimization" process this particular
212    /// MIR has traversed. This is particularly useful when inlining, since in that context
213    /// we instantiate the promoted constants and add them to our promoted vector -- but those
214    /// promoted items have already been optimized, whereas ours have not. This field allows
215    /// us to see the difference and forego optimization on the inlined promoted items.
216    pub phase: MirPhase,
217
218    /// How many passes we have executed since starting the current phase. Used for debug output.
219    pub pass_count: usize,
220
221    pub source: MirSource<'tcx>,
222
223    /// A list of source scopes; these are referenced by statements
224    /// and used for debuginfo. Indexed by a `SourceScope`.
225    pub source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
226
227    /// Additional information carried by a MIR body when it is lowered from a coroutine.
228    ///
229    /// Note that the coroutine drop shim, any promoted consts, and other synthetic MIR
230    /// bodies that come from processing a coroutine body are not typically coroutines
231    /// themselves, and should probably set this to `None` to avoid carrying redundant
232    /// information.
233    pub coroutine: Option<Box<CoroutineInfo<'tcx>>>,
234
235    /// Declarations of locals.
236    ///
237    /// The first local is the return value pointer, followed by `arg_count`
238    /// locals for the function arguments, followed by any user-declared
239    /// variables and temporaries.
240    pub local_decls: IndexVec<Local, LocalDecl<'tcx>>,
241
242    /// User type annotations.
243    pub user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>,
244
245    /// The number of arguments this function takes.
246    ///
247    /// Starting at local 1, `arg_count` locals will be provided by the caller
248    /// and can be assumed to be initialized.
249    ///
250    /// If this MIR was built for a constant, this will be 0.
251    pub arg_count: usize,
252
253    /// Mark an argument local (which must be a tuple) as getting passed as
254    /// its individual components at the LLVM level.
255    ///
256    /// This is used for the "rust-call" ABI.
257    pub spread_arg: Option<Local>,
258
259    /// Debug information pertaining to user variables, including captures.
260    pub var_debug_info: Vec<VarDebugInfo<'tcx>>,
261
262    /// A span representing this MIR, for error reporting.
263    pub span: Span,
264
265    /// Constants that are required to evaluate successfully for this MIR to be well-formed.
266    /// We hold in this field all the constants we are not able to evaluate yet.
267    /// `None` indicates that the list has not been computed yet.
268    ///
269    /// This is soundness-critical, we make a guarantee that all consts syntactically mentioned in a
270    /// function have successfully evaluated if the function ever gets executed at runtime.
271    pub required_consts: Option<Vec<ConstOperand<'tcx>>>,
272
273    /// Further items that were mentioned in this function and hence *may* become monomorphized,
274    /// depending on optimizations. We use this to avoid optimization-dependent compile errors: the
275    /// collector recursively traverses all "mentioned" items and evaluates all their
276    /// `required_consts`.
277    /// `None` indicates that the list has not been computed yet.
278    ///
279    /// This is *not* soundness-critical and the contents of this list are *not* a stable guarantee.
280    /// All that's relevant is that this set is optimization-level-independent, and that it includes
281    /// everything that the collector would consider "used". (For example, we currently compute this
282    /// set after drop elaboration, so some drop calls that can never be reached are not considered
283    /// "mentioned".) See the documentation of `CollectionMode` in
284    /// `compiler/rustc_monomorphize/src/collector.rs` for more context.
285    pub mentioned_items: Option<Vec<Spanned<MentionedItem<'tcx>>>>,
286
287    /// Does this body use generic parameters. This is used for the `ConstEvaluatable` check.
288    ///
289    /// Note that this does not actually mean that this body is not computable right now.
290    /// The repeat count in the following example is polymorphic, but can still be evaluated
291    /// without knowing anything about the type parameter `T`.
292    ///
293    /// ```rust
294    /// fn test<T>() {
295    ///     let _ = [0; size_of::<*mut T>()];
296    /// }
297    /// ```
298    ///
299    /// **WARNING**: Do not change this flags after the MIR was originally created, even if an optimization
300    /// removed the last mention of all generic params. We do not want to rely on optimizations and
301    /// potentially allow things like `[u8; size_of::<T>() * 0]` due to this.
302    pub is_polymorphic: bool,
303
304    /// The phase at which this MIR should be "injected" into the compilation process.
305    ///
306    /// Everything that comes before this `MirPhase` should be skipped.
307    ///
308    /// This is only `Some` if the function that this body comes from was annotated with `rustc_custom_mir`.
309    pub injection_phase: Option<MirPhase>,
310
311    pub tainted_by_errors: Option<ErrorGuaranteed>,
312
313    /// Coverage information collected at the THIR/MIR boundary during MIR
314    /// building, to be used by the `InstrumentCoverage` pass.
315    ///
316    /// Only present if coverage is enabled and this function is eligible.
317    /// Boxed to limit space overhead in non-coverage builds.
318    #[type_foldable(identity)]
319    #[type_visitable(ignore)]
320    pub coverage_early_info: Option<Box<coverage::CoverageEarlyInfo>>,
321
322    /// Per-function coverage information added by the `InstrumentCoverage`
323    /// pass, to be used in conjunction with the coverage statements injected
324    /// into this body's blocks.
325    ///
326    /// If `-Cinstrument-coverage` is not active, or if an individual function
327    /// is not eligible for coverage, then this should always be `None`.
328    #[type_foldable(identity)]
329    #[type_visitable(ignore)]
330    pub coverage_mir_info: Option<Box<coverage::CoverageMirInfo>>,
331}
332
333impl<'tcx> Body<'tcx> {
334    pub fn new(
335        source: MirSource<'tcx>,
336        basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
337        source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
338        local_decls: IndexVec<Local, LocalDecl<'tcx>>,
339        user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>,
340        arg_count: usize,
341        var_debug_info: Vec<VarDebugInfo<'tcx>>,
342        span: Span,
343        coroutine: Option<Box<CoroutineInfo<'tcx>>>,
344        tainted_by_errors: Option<ErrorGuaranteed>,
345    ) -> Self {
346        // We need `arg_count` locals, and one for the return place.
347        if !(local_decls.len() > arg_count) {
    {
        ::core::panicking::panic_fmt(format_args!("expected at least {0} locals, got {1}",
                arg_count + 1, local_decls.len()));
    }
};assert!(
348            local_decls.len() > arg_count,
349            "expected at least {} locals, got {}",
350            arg_count + 1,
351            local_decls.len()
352        );
353
354        let mut body = Body {
355            phase: MirPhase::Built,
356            pass_count: 0,
357            source,
358            basic_blocks: BasicBlocks::new(basic_blocks),
359            source_scopes,
360            coroutine,
361            local_decls,
362            user_type_annotations,
363            arg_count,
364            spread_arg: None,
365            var_debug_info,
366            span,
367            required_consts: None,
368            mentioned_items: None,
369            is_polymorphic: false,
370            injection_phase: None,
371            tainted_by_errors,
372            coverage_early_info: None,
373            coverage_mir_info: None,
374        };
375        body.is_polymorphic = body.has_non_region_param();
376        body
377    }
378
379    /// Returns a partially initialized MIR body containing only a list of basic blocks.
380    ///
381    /// The returned MIR contains no `LocalDecl`s (even for the return place) or source scopes. It
382    /// is only useful for testing but cannot be `#[cfg(test)]` because it is used in a different
383    /// crate.
384    pub fn new_cfg_only(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>) -> Self {
385        let mut body = Body {
386            phase: MirPhase::Built,
387            pass_count: 0,
388            source: MirSource::item(CRATE_DEF_ID.to_def_id()),
389            basic_blocks: BasicBlocks::new(basic_blocks),
390            source_scopes: IndexVec::new(),
391            coroutine: None,
392            local_decls: IndexVec::new(),
393            user_type_annotations: IndexVec::new(),
394            arg_count: 0,
395            spread_arg: None,
396            span: DUMMY_SP,
397            required_consts: None,
398            mentioned_items: None,
399            var_debug_info: Vec::new(),
400            is_polymorphic: false,
401            injection_phase: None,
402            tainted_by_errors: None,
403            coverage_early_info: None,
404            coverage_mir_info: None,
405        };
406        body.is_polymorphic = body.has_non_region_param();
407        body
408    }
409
410    #[inline]
411    pub fn basic_blocks_mut(&mut self) -> &mut IndexVec<BasicBlock, BasicBlockData<'tcx>> {
412        self.basic_blocks.as_mut()
413    }
414
415    pub fn typing_env(&self, tcx: TyCtxt<'tcx>) -> TypingEnv<'tcx> {
416        if tcx.use_typing_mode_post_typeck_until_borrowck() {
417            match self.phase {
418                MirPhase::Built | MirPhase::Analysis(AnalysisPhase::Initial)
419                    if let Some(def_id) = self.source.def_id().as_local() =>
420                {
421                    TypingEnv::new(
422                        tcx.param_env(self.source.def_id()),
423                        ty::TypingMode::borrowck(tcx, def_id),
424                    )
425                }
426                MirPhase::Analysis(AnalysisPhase::PostCleanup)
427                    if let Some(def_id) = self.source.def_id().as_local() =>
428                {
429                    TypingEnv::new(
430                        tcx.param_env(self.source.def_id()),
431                        ty::TypingMode::post_borrowck_analysis(tcx, def_id),
432                    )
433                }
434                MirPhase::Built | MirPhase::Analysis(_) => {
435                    // This branch happens for drop glue and fn ptr shims.
436                    // FIXME: why do we do any of this analysis on drop glue etc?
437                    // This should ideally all be skipped.
438                    TypingEnv::post_analysis(tcx, self.source.def_id())
439                }
440                MirPhase::Runtime(_) => TypingEnv::post_analysis(tcx, self.source.def_id()),
441            }
442        } else {
443            match self.phase {
444                MirPhase::Built | MirPhase::Analysis(_) => TypingEnv::new(
445                    tcx.param_env(self.source.def_id()),
446                    ty::TypingMode::non_body_analysis(),
447                ),
448                MirPhase::Runtime(_) => TypingEnv::post_analysis(tcx, self.source.def_id()),
449            }
450        }
451    }
452
453    #[inline]
454    pub fn local_kind(&self, local: Local) -> LocalKind {
455        let index = local.as_usize();
456        if index == 0 {
457            if true {
    if !(self.local_decls[local].mutability == Mutability::Mut) {
        {
            ::core::panicking::panic_fmt(format_args!("return place should be mutable"));
        }
    };
};debug_assert!(
458                self.local_decls[local].mutability == Mutability::Mut,
459                "return place should be mutable"
460            );
461
462            LocalKind::ReturnPointer
463        } else if index < self.arg_count + 1 {
464            LocalKind::Arg
465        } else {
466            LocalKind::Temp
467        }
468    }
469
470    /// Returns an iterator over all user-declared mutable locals.
471    #[inline]
472    pub fn mut_vars_iter(&self) -> impl Iterator<Item = Local> {
473        (self.arg_count + 1..self.local_decls.len()).filter_map(move |index| {
474            let local = Local::new(index);
475            let decl = &self.local_decls[local];
476            (decl.is_user_variable() && decl.mutability.is_mut()).then_some(local)
477        })
478    }
479
480    /// Returns an iterator over all user-declared mutable arguments and locals.
481    #[inline]
482    pub fn mut_vars_and_args_iter(&self) -> impl Iterator<Item = Local> {
483        (1..self.local_decls.len()).filter_map(move |index| {
484            let local = Local::new(index);
485            let decl = &self.local_decls[local];
486            if (decl.is_user_variable() || index < self.arg_count + 1)
487                && decl.mutability == Mutability::Mut
488            {
489                Some(local)
490            } else {
491                None
492            }
493        })
494    }
495
496    /// Returns an iterator over all function arguments.
497    #[inline]
498    pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator + use<> {
499        (1..self.arg_count + 1).map(Local::new)
500    }
501
502    /// Returns an iterator over all user-defined variables and compiler-generated temporaries (all
503    /// locals that are neither arguments nor the return place).
504    #[inline]
505    pub fn vars_and_temps_iter(
506        &self,
507    ) -> impl DoubleEndedIterator<Item = Local> + ExactSizeIterator {
508        (self.arg_count + 1..self.local_decls.len()).map(Local::new)
509    }
510
511    #[inline]
512    pub fn drain_vars_and_temps(&mut self) -> impl Iterator<Item = LocalDecl<'tcx>> {
513        self.local_decls.drain(self.arg_count + 1..)
514    }
515
516    /// Returns the source info associated with `location`.
517    pub fn source_info(&self, location: Location) -> &SourceInfo {
518        let block = &self[location.block];
519        let stmts = &block.statements;
520        let idx = location.statement_index;
521        if idx < stmts.len() {
522            &stmts[idx].source_info
523        } else {
524            {
    match (&idx, &stmts.len()) {
        (left_val, right_val) => {
            if !(*left_val == *right_val) {
                let kind = ::core::panicking::AssertKind::Eq;
                ::core::panicking::assert_failed(kind, &*left_val,
                    &*right_val, ::core::option::Option::None);
            }
        }
    }
};assert_eq!(idx, stmts.len());
525            &block.terminator().source_info
526        }
527    }
528
529    /// Returns the return type; it always return first element from `local_decls` array.
530    #[inline]
531    pub fn return_ty(&self) -> Ty<'tcx> {
532        self.local_decls[RETURN_PLACE].ty
533    }
534
535    /// Returns the return type; it always return first element from `local_decls` array.
536    #[inline]
537    pub fn bound_return_ty(&self, tcx: TyCtxt<'tcx>) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
538        ty::EarlyBinder::bind(tcx, self.local_decls[RETURN_PLACE].ty)
539    }
540
541    /// Gets the location of the terminator for the given block.
542    #[inline]
543    pub fn terminator_loc(&self, bb: BasicBlock) -> Location {
544        Location { block: bb, statement_index: self[bb].statements.len() }
545    }
546
547    pub fn stmt_at(&self, location: Location) -> Either<&Statement<'tcx>, &Terminator<'tcx>> {
548        let Location { block, statement_index } = location;
549        let block_data = &self.basic_blocks[block];
550        block_data
551            .statements
552            .get(statement_index)
553            .map(Either::Left)
554            .unwrap_or_else(|| Either::Right(block_data.terminator()))
555    }
556
557    #[inline]
558    pub fn yield_ty(&self) -> Option<Ty<'tcx>> {
559        self.coroutine.as_ref().and_then(|coroutine| coroutine.yield_ty)
560    }
561
562    #[inline]
563    pub fn resume_ty(&self) -> Option<Ty<'tcx>> {
564        self.coroutine.as_ref().and_then(|coroutine| coroutine.resume_ty)
565    }
566
567    /// Prefer going through [`TyCtxt::coroutine_layout`] rather than using this directly.
568    #[inline]
569    pub fn coroutine_layout_raw(&self) -> Option<&CoroutineLayout<'tcx>> {
570        self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_layout.as_ref())
571    }
572
573    #[inline]
574    pub fn coroutine_drop(&self) -> Option<&Body<'tcx>> {
575        self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_drop.as_ref())
576    }
577
578    #[inline]
579    pub fn coroutine_drop_async(&self) -> Option<&Body<'tcx>> {
580        self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_drop_async.as_ref())
581    }
582
583    #[inline]
584    pub fn coroutine_requires_async_drop(&self) -> bool {
585        self.coroutine_drop_async().is_some()
586    }
587
588    #[inline]
589    pub fn future_drop_poll(&self) -> Option<&Body<'tcx>> {
590        self.coroutine.as_ref().and_then(|coroutine| {
591            coroutine
592                .coroutine_drop_async
593                .as_ref()
594                .or(coroutine.coroutine_drop_proxy_async.as_ref())
595        })
596    }
597
598    #[inline]
599    pub fn coroutine_kind(&self) -> Option<CoroutineKind> {
600        self.coroutine.as_ref().map(|coroutine| coroutine.coroutine_kind)
601    }
602
603    #[inline]
604    pub fn should_skip(&self) -> bool {
605        let Some(injection_phase) = self.injection_phase else {
606            return false;
607        };
608        injection_phase > self.phase
609    }
610
611    #[inline]
612    pub fn is_custom_mir(&self) -> bool {
613        self.injection_phase.is_some()
614    }
615
616    /// If this basic block ends with a [`TerminatorKind::SwitchInt`] for which we can evaluate the
617    /// discriminant in monomorphization, we return the discriminant bits and the
618    /// [`SwitchTargets`], just so the caller doesn't also have to match on the terminator.
619    fn try_const_mono_switchint<'a>(
620        tcx: TyCtxt<'tcx>,
621        instance: Instance<'tcx>,
622        block: &'a BasicBlockData<'tcx>,
623    ) -> Option<(u128, &'a SwitchTargets)> {
624        // There are two places here we need to evaluate a constant.
625        let eval_mono_const = |constant: &ConstOperand<'tcx>| {
626            // FIXME(#132279): what is this, why are we using an empty environment here.
627            let typing_env = ty::TypingEnv::fully_monomorphized();
628            let mono_literal = instance.instantiate_mir_and_normalize_erasing_regions(
629                tcx,
630                typing_env,
631                crate::ty::EarlyBinder::bind(tcx, constant.const_),
632            );
633            mono_literal.try_eval_bits(tcx, typing_env)
634        };
635
636        let TerminatorKind::SwitchInt { discr, targets } = &block.terminator().kind else {
637            return None;
638        };
639
640        // If this is a SwitchInt(const _), then we can just evaluate the constant and return.
641        let discr = match discr {
642            Operand::Constant(constant) => {
643                let bits = eval_mono_const(constant)?;
644                return Some((bits, targets));
645            }
646            Operand::RuntimeChecks(check) => {
647                let bits = check.value(tcx.sess) as u128;
648                return Some((bits, targets));
649            }
650            Operand::Move(place) | Operand::Copy(place) => place,
651        };
652
653        // MIR for `if false` actually looks like this:
654        // _1 = const _
655        // SwitchInt(_1)
656        //
657        // And MIR for if intrinsics::ub_checks() looks like this:
658        // _1 = UbChecks()
659        // SwitchInt(_1)
660        //
661        // So we're going to try to recognize this pattern.
662        //
663        // If we have a SwitchInt on a non-const place, we find the most recent statement that
664        // isn't a storage marker. If that statement is an assignment of a const to our
665        // discriminant place, we evaluate and return the const, as if we've const-propagated it
666        // into the SwitchInt.
667
668        let last_stmt = block.statements.iter().rev().find(|stmt| {
669            !#[allow(non_exhaustive_omitted_patterns)] match stmt.kind {
    StatementKind::StorageDead(_) | StatementKind::StorageLive(_) => true,
    _ => false,
}matches!(stmt.kind, StatementKind::StorageDead(_) | StatementKind::StorageLive(_))
670        })?;
671
672        let (place, rvalue) = last_stmt.kind.as_assign()?;
673
674        if discr != place {
675            return None;
676        }
677
678        match rvalue {
679            Rvalue::Use(Operand::Constant(constant), _) => {
680                let bits = eval_mono_const(constant)?;
681                Some((bits, targets))
682            }
683            _ => None,
684        }
685    }
686
687    /// For a `Location` in this scope, determine what the "caller location" at that point is. This
688    /// is interesting because of inlining: the `#[track_caller]` attribute of inlined functions
689    /// must be honored. Falls back to the `tracked_caller` value for `#[track_caller]` functions,
690    /// or the function's scope.
691    pub fn caller_location_span<T>(
692        &self,
693        mut source_info: SourceInfo,
694        caller_location: Option<T>,
695        tcx: TyCtxt<'tcx>,
696        from_span: impl FnOnce(Span) -> T,
697    ) -> T {
698        loop {
699            let scope_data = &self.source_scopes[source_info.scope];
700
701            if let Some((callee, callsite_span)) = scope_data.inlined {
702                // Stop inside the most nested non-`#[track_caller]` function,
703                // before ever reaching its caller (which is irrelevant).
704                if !callee.def.requires_caller_location(tcx) {
705                    return from_span(source_info.span);
706                }
707                source_info.span = callsite_span;
708            }
709
710            // Skip past all of the parents with `inlined: None`.
711            match scope_data.inlined_parent_scope {
712                Some(parent) => source_info.scope = parent,
713                None => break,
714            }
715        }
716
717        // No inlined `SourceScope`s, or all of them were `#[track_caller]`.
718        caller_location.unwrap_or_else(|| from_span(source_info.span))
719    }
720
721    #[track_caller]
722    pub fn set_required_consts(&mut self, required_consts: Vec<ConstOperand<'tcx>>) {
723        if !self.required_consts.is_none() {
    {
        ::core::panicking::panic_fmt(format_args!("required_consts for {0:?} have already been set",
                self.source.def_id()));
    }
};assert!(
724            self.required_consts.is_none(),
725            "required_consts for {:?} have already been set",
726            self.source.def_id()
727        );
728        self.required_consts = Some(required_consts);
729    }
730    #[track_caller]
731    pub fn required_consts(&self) -> &[ConstOperand<'tcx>] {
732        match &self.required_consts {
733            Some(l) => l,
734            None => {
    ::core::panicking::panic_fmt(format_args!("required_consts for {0:?} have not yet been set",
            self.source.def_id()));
}panic!("required_consts for {:?} have not yet been set", self.source.def_id()),
735        }
736    }
737
738    #[track_caller]
739    pub fn set_mentioned_items(&mut self, mentioned_items: Vec<Spanned<MentionedItem<'tcx>>>) {
740        if !self.mentioned_items.is_none() {
    {
        ::core::panicking::panic_fmt(format_args!("mentioned_items for {0:?} have already been set",
                self.source.def_id()));
    }
};assert!(
741            self.mentioned_items.is_none(),
742            "mentioned_items for {:?} have already been set",
743            self.source.def_id()
744        );
745        self.mentioned_items = Some(mentioned_items);
746    }
747    #[track_caller]
748    pub fn mentioned_items(&self) -> &[Spanned<MentionedItem<'tcx>>] {
749        match &self.mentioned_items {
750            Some(l) => l,
751            None => {
    ::core::panicking::panic_fmt(format_args!("mentioned_items for {0:?} have not yet been set",
            self.source.def_id()));
}panic!("mentioned_items for {:?} have not yet been set", self.source.def_id()),
752        }
753    }
754}
755
756impl<'tcx> Index<BasicBlock> for Body<'tcx> {
757    type Output = BasicBlockData<'tcx>;
758
759    #[inline]
760    fn index(&self, index: BasicBlock) -> &BasicBlockData<'tcx> {
761        &self.basic_blocks[index]
762    }
763}
764
765impl<'tcx> IndexMut<BasicBlock> for Body<'tcx> {
766    #[inline]
767    fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx> {
768        &mut self.basic_blocks.as_mut()[index]
769    }
770}
771
772#[derive(#[automatically_derived]
impl<T: ::core::marker::Copy> ::core::marker::Copy for ClearCrossCrate<T> { }Copy, #[automatically_derived]
impl<T: ::core::clone::Clone> ::core::clone::Clone for ClearCrossCrate<T> {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::Clear => ClearCrossCrate::Clear,
            Self::Set(__self_0) =>
                ClearCrossCrate::Set(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl<T: ::core::fmt::Debug> ::core::fmt::Debug for ClearCrossCrate<T> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Clear => ::core::fmt::Formatter::write_str(f, "Clear"),
            Self::Set(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Set",
                    &__self_0),
        }
    }
}Debug, const _: () =
    {
        impl<T> ::rustc_data_structures::stable_hash::StableHash for
            ClearCrossCrate<T> where
            T: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ClearCrossCrate::Clear => {}
                    ClearCrossCrate::Set(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx, T>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for ClearCrossCrate<T> where
            T: ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        ClearCrossCrate::Clear => { ClearCrossCrate::Clear }
                        ClearCrossCrate::Set(__binding_0) => {
                            ClearCrossCrate::Set(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    ClearCrossCrate::Clear => { ClearCrossCrate::Clear }
                    ClearCrossCrate::Set(__binding_0) => {
                        ClearCrossCrate::Set(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx, T>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for ClearCrossCrate<T> where
            T: ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    ClearCrossCrate::Clear => {}
                    ClearCrossCrate::Set(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
773pub enum ClearCrossCrate<T> {
774    Clear,
775    Set(T),
776}
777
778impl<T> ClearCrossCrate<T> {
779    pub fn as_ref(&self) -> ClearCrossCrate<&T> {
780        match self {
781            ClearCrossCrate::Clear => ClearCrossCrate::Clear,
782            ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
783        }
784    }
785
786    pub fn as_mut(&mut self) -> ClearCrossCrate<&mut T> {
787        match self {
788            ClearCrossCrate::Clear => ClearCrossCrate::Clear,
789            ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
790        }
791    }
792
793    pub fn unwrap_crate_local(self) -> T {
794        match self {
795            ClearCrossCrate::Clear => ::rustc_span::macros::bug_impl(None,
    format_args!("unwrapping cross-crate data"), Location::caller())bug!("unwrapping cross-crate data"),
796            ClearCrossCrate::Set(v) => v,
797        }
798    }
799}
800
801const TAG_CLEAR_CROSS_CRATE_CLEAR: u8 = 0;
802const TAG_CLEAR_CROSS_CRATE_SET: u8 = 1;
803
804impl<'tcx, E: TyEncoder<'tcx>, T: Encodable<E>> Encodable<E> for ClearCrossCrate<T> {
805    #[inline]
806    fn encode(&self, e: &mut E) {
807        if E::CLEAR_CROSS_CRATE {
808            return;
809        }
810
811        match *self {
812            ClearCrossCrate::Clear => TAG_CLEAR_CROSS_CRATE_CLEAR.encode(e),
813            ClearCrossCrate::Set(ref val) => {
814                TAG_CLEAR_CROSS_CRATE_SET.encode(e);
815                val.encode(e);
816            }
817        }
818    }
819}
820impl<'tcx, D: TyDecoder<'tcx>, T: Decodable<D>> Decodable<D> for ClearCrossCrate<T> {
821    #[inline]
822    fn decode(d: &mut D) -> ClearCrossCrate<T> {
823        if D::CLEAR_CROSS_CRATE {
824            return ClearCrossCrate::Clear;
825        }
826
827        let discr = u8::decode(d);
828
829        match discr {
830            TAG_CLEAR_CROSS_CRATE_CLEAR => ClearCrossCrate::Clear,
831            TAG_CLEAR_CROSS_CRATE_SET => {
832                let val = T::decode(d);
833                ClearCrossCrate::Set(val)
834            }
835            tag => {
    ::core::panicking::panic_fmt(format_args!("Invalid tag for ClearCrossCrate: {0:?}",
            tag));
}panic!("Invalid tag for ClearCrossCrate: {tag:?}"),
836        }
837    }
838}
839
840/// Grouped information about the source code origin of a MIR entity.
841/// Intended to be inspected by diagnostics and debuginfo.
842/// Most passes can work with it as a whole, within a single function.
843// The unofficial Cranelift backend, at least as of #65828, needs `SourceInfo` to implement `Eq` and
844// `Hash`. Please ping @bjorn3 if removing them.
845#[derive(#[automatically_derived]
impl ::core::marker::Copy for SourceInfo { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for SourceInfo { }
#[automatically_derived]
impl ::core::clone::Clone for SourceInfo {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<SourceScope>;
        *self
    }
}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::marker::StructuralPartialEq for SourceInfo { }
#[automatically_derived]
impl ::core::cmp::PartialEq for SourceInfo {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.span == other.span && self.scope == other.scope
    }
}PartialEq, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for SourceInfo {
            fn encode(&self, __encoder: &mut __E) {
                let SourceInfo { span: ref __binding_0, scope: ref __binding_1
                        } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for SourceInfo {
            fn decode(__decoder: &mut __D) -> Self {
                SourceInfo {
                    span: ::rustc_serialize::Decodable::decode(__decoder),
                    scope: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl ::core::hash::Hash for SourceInfo {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.span, state);
        ::core::hash::Hash::hash(&self.scope, state)
    }
}Hash, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for SourceInfo {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    SourceInfo { span: ref __binding_0, scope: ref __binding_1 }
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
846pub struct SourceInfo {
847    /// The source span for the AST pertaining to this MIR entity.
848    pub span: Span,
849
850    /// The source scope, keeping track of which bindings can be
851    /// seen by debuginfo, active lint levels, etc.
852    pub scope: SourceScope,
853}
854
855impl SourceInfo {
856    #[inline]
857    pub fn outermost(span: Span) -> Self {
858        SourceInfo { span, scope: OUTERMOST_SOURCE_SCOPE }
859    }
860}
861
862///////////////////////////////////////////////////////////////////////////
863// Variables and temps
864
865#[automatically_derived]
impl ::core::marker::Copy for Local { }
pub const RETURN_PLACE: Local = Local::from_u32(0);
impl Local {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for Local {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for Local {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for Local {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for Local {
    #[inline]
    fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
        <usize as
                ::std::iter::Step>::steps_between(&Self::index(*start),
            &Self::index(*end))
    }
    #[inline]
    fn forward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_add(u).map(Self::from_usize)
    }
    #[inline]
    fn backward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_sub(u).map(Self::from_usize)
    }
    #[inline]
    fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_add(u);
        (Self::from_usize(s), o)
    }
    #[inline]
    fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_sub(u);
        (Self::from_usize(s), o)
    }
}
impl ::std::cmp::Ord for Local {
    #[inline]
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.as_u32().cmp(&other.as_u32())
    }
}
impl ::std::cmp::PartialOrd for Local {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl ::rustc_data_structures::stable_hash::StableHash for Local {
    fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
        hcx: &mut __Hcx,
        hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
        self.as_u32().stable_hash(hcx, hasher)
    }
}
impl From<Local> for u32 {
    #[inline]
    fn from(v: Local) -> u32 { v.as_u32() }
}
impl From<Local> for usize {
    #[inline]
    fn from(v: Local) -> usize { v.as_usize() }
}
impl From<usize> for Local {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for Local {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for Local {}
impl ::std::cmp::PartialEq for Local {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for Local {}
impl ::std::hash::Hash for Local {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for Local
    {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for Local
    {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for Local {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("_{0}", self.as_u32()))
    }
}rustc_index::newtype_index! {
866    #[stable_hash]
867    #[encodable]
868    #[orderable]
869    #[debug_format = "_{}"]
870    pub struct Local {
871        const RETURN_PLACE = 0;
872    }
873}
874
875impl Local {
876    /// Makes a `Local` for the `i`-th argument to a function.
877    ///
878    /// `Local(0)` is the [`RETURN_PLACE`], with the arguments after that,
879    /// so `arg(i)` will give `Local(i + 1)`.
880    pub const fn arg(i: usize) -> Local {
881        Local::from_usize(i + 1)
882    }
883}
884
885impl Atom for Local {
886    fn index(self) -> usize {
887        Idx::index(self)
888    }
889}
890
891/// Classifies locals into categories. See `Body::local_kind`.
892#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for LocalKind { }
#[automatically_derived]
impl ::core::clone::Clone for LocalKind {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for LocalKind { }Copy, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for LocalKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for LocalKind {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for LocalKind { }Eq, #[automatically_derived]
impl ::core::fmt::Debug for LocalKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                LocalKind::Temp => "Temp",
                LocalKind::Arg => "Arg",
                LocalKind::ReturnPointer => "ReturnPointer",
            })
    }
}Debug, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for LocalKind {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    LocalKind::Temp => {}
                    LocalKind::Arg => {}
                    LocalKind::ReturnPointer => {}
                }
            }
        }
    };StableHash)]
893pub enum LocalKind {
894    /// User-declared variable binding or compiler-introduced temporary.
895    Temp,
896    /// Function argument.
897    Arg,
898    /// Location of function's return value.
899    ReturnPointer,
900}
901
902#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for VarBindingForm<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        VarBindingForm {
            binding_mode: ::core::clone::Clone::clone(&self.binding_mode),
            opt_ty_info: ::core::clone::Clone::clone(&self.opt_ty_info),
            opt_match_place: ::core::clone::Clone::clone(&self.opt_match_place),
            pat_span: ::core::clone::Clone::clone(&self.pat_span),
            introductions: ::core::clone::Clone::clone(&self.introductions),
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for VarBindingForm<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f,
            "VarBindingForm", "binding_mode", &self.binding_mode,
            "opt_ty_info", &self.opt_ty_info, "opt_match_place",
            &self.opt_match_place, "pat_span", &self.pat_span,
            "introductions", &&self.introductions)
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for VarBindingForm<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let VarBindingForm {
                        binding_mode: ref __binding_0,
                        opt_ty_info: ref __binding_1,
                        opt_match_place: ref __binding_2,
                        pat_span: ref __binding_3,
                        introductions: ref __binding_4 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_4,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for VarBindingForm<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                VarBindingForm {
                    binding_mode: ::rustc_serialize::Decodable::decode(__decoder),
                    opt_ty_info: ::rustc_serialize::Decodable::decode(__decoder),
                    opt_match_place: ::rustc_serialize::Decodable::decode(__decoder),
                    pat_span: ::rustc_serialize::Decodable::decode(__decoder),
                    introductions: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            VarBindingForm<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    VarBindingForm {
                        binding_mode: ref __binding_0,
                        opt_ty_info: ref __binding_1,
                        opt_match_place: ref __binding_2,
                        pat_span: ref __binding_3,
                        introductions: ref __binding_4 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
903pub struct VarBindingForm<'tcx> {
904    /// Is variable bound via `x`, `mut x`, `ref x`, `ref mut x`, `mut ref x`, or `mut ref mut x`?
905    pub binding_mode: BindingMode,
906    /// If an explicit type was provided for this variable binding,
907    /// this holds the source Span of that type.
908    ///
909    /// NOTE: if you want to change this to a `HirId`, be wary that
910    /// doing so breaks incremental compilation (as of this writing),
911    /// while a `Span` does not cause our tests to fail.
912    pub opt_ty_info: Option<Span>,
913    /// Place of the RHS of the =, or the subject of the `match` where this
914    /// variable is initialized. None in the case of `let PATTERN;`.
915    /// Some((None, ..)) in the case of and `let [mut] x = ...` because
916    /// (a) the right-hand side isn't evaluated as a place expression.
917    /// (b) it gives a way to separate this case from the remaining cases
918    ///     for diagnostics.
919    pub opt_match_place: Option<(Option<Place<'tcx>>, Span)>,
920    /// The span of the pattern in which this variable was bound.
921    pub pat_span: Span,
922    /// A binding can be introduced multiple times, with or patterns:
923    /// `Foo::A { x } | Foo::B { z: x }`. This stores information for each of those introductions.
924    pub introductions: Vec<VarBindingIntroduction>,
925}
926
927#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for BindingForm<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::Var(__self_0) =>
                BindingForm::Var(::core::clone::Clone::clone(__self_0)),
            Self::ImplicitSelf(__self_0) =>
                BindingForm::ImplicitSelf(::core::clone::Clone::clone(__self_0)),
            Self::RefForGuard(__self_0) =>
                BindingForm::RefForGuard(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for BindingForm<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Var(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Var",
                    &__self_0),
            Self::ImplicitSelf(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ImplicitSelf", &__self_0),
            Self::RefForGuard(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "RefForGuard", &__self_0),
        }
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for BindingForm<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        BindingForm::Var(ref __binding_0) => { 0usize }
                        BindingForm::ImplicitSelf(ref __binding_0) => { 1usize }
                        BindingForm::RefForGuard(ref __binding_0) => { 2usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    BindingForm::Var(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    BindingForm::ImplicitSelf(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    BindingForm::RefForGuard(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for BindingForm<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        BindingForm::Var(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => {
                        BindingForm::ImplicitSelf(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    2usize => {
                        BindingForm::RefForGuard(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `BindingForm`, expected 0..3, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            BindingForm<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    BindingForm::Var(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    BindingForm::ImplicitSelf(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    BindingForm::RefForGuard(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
928pub enum BindingForm<'tcx> {
929    /// This is a binding for a non-`self` binding, or a `self` that has an explicit type.
930    Var(VarBindingForm<'tcx>),
931    /// Binding for a `self`/`&self`/`&mut self` binding where the type is implicit.
932    ImplicitSelf(ImplicitSelfKind),
933    /// Reference used in a guard expression to ensure immutability.
934    RefForGuard(Local),
935}
936
937#[derive(#[automatically_derived]
impl ::core::clone::Clone for VarBindingIntroduction {
    #[inline]
    fn clone(&self) -> Self {
        VarBindingIntroduction {
            span: ::core::clone::Clone::clone(&self.span),
            is_shorthand: ::core::clone::Clone::clone(&self.is_shorthand),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for VarBindingIntroduction {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "VarBindingIntroduction", "span", &self.span, "is_shorthand",
            &&self.is_shorthand)
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for VarBindingIntroduction {
            fn encode(&self, __encoder: &mut __E) {
                let VarBindingIntroduction {
                        span: ref __binding_0, is_shorthand: ref __binding_1 } =
                    *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for VarBindingIntroduction {
            fn decode(__decoder: &mut __D) -> Self {
                VarBindingIntroduction {
                    span: ::rustc_serialize::Decodable::decode(__decoder),
                    is_shorthand: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            VarBindingIntroduction {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    VarBindingIntroduction {
                        span: ref __binding_0, is_shorthand: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
938pub struct VarBindingIntroduction {
939    /// Where this additional introduction happened.
940    pub span: Span,
941    /// Is that introduction a shorthand struct pattern, i.e. `Foo { x }`.
942    pub is_shorthand: bool,
943}
944
945/// `BlockTailInfo` is attached to the `LocalDecl` for temporaries
946/// created during evaluation of expressions in a block tail
947/// expression; that is, a block like `{ STMT_1; STMT_2; EXPR }`.
948///
949/// It is used to improve diagnostics when such temporaries are
950/// involved in borrow_check errors, e.g., explanations of where the
951/// temporaries come from, when their destructors are run, and/or how
952/// one might revise the code to satisfy the borrow checker's rules.
953#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for BlockTailInfo { }
#[automatically_derived]
impl ::core::clone::Clone for BlockTailInfo {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for BlockTailInfo { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for BlockTailInfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "BlockTailInfo",
            "tail_result_is_ignored", &self.tail_result_is_ignored, "span",
            &&self.span)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for BlockTailInfo { }
#[automatically_derived]
impl ::core::cmp::PartialEq for BlockTailInfo {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.tail_result_is_ignored == other.tail_result_is_ignored &&
            self.span == other.span
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for BlockTailInfo {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<Span>;
    }
}Eq, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for BlockTailInfo {
            fn encode(&self, __encoder: &mut __E) {
                let BlockTailInfo {
                        tail_result_is_ignored: ref __binding_0,
                        span: ref __binding_1 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for BlockTailInfo {
            fn decode(__decoder: &mut __D) -> Self {
                BlockTailInfo {
                    tail_result_is_ignored: ::rustc_serialize::Decodable::decode(__decoder),
                    span: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            BlockTailInfo {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    BlockTailInfo {
                        tail_result_is_ignored: ref __binding_0,
                        span: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
954pub struct BlockTailInfo {
955    /// If `true`, then the value resulting from evaluating this tail
956    /// expression is ignored by the block's expression context.
957    ///
958    /// Examples include `{ ...; tail };` and `let _ = { ...; tail };`
959    /// but not e.g., `let _x = { ...; tail };`
960    pub tail_result_is_ignored: bool,
961
962    /// `Span` of the tail expression.
963    pub span: Span,
964}
965
966/// A MIR local.
967///
968/// This can be a binding declared by the user, a temporary inserted by the compiler, a function
969/// argument, or the return place.
970#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for LocalDecl<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        LocalDecl {
            mutability: ::core::clone::Clone::clone(&self.mutability),
            local_info: ::core::clone::Clone::clone(&self.local_info),
            ty: ::core::clone::Clone::clone(&self.ty),
            user_ty: ::core::clone::Clone::clone(&self.user_ty),
            source_info: ::core::clone::Clone::clone(&self.source_info),
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for LocalDecl<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "LocalDecl",
            "mutability", &self.mutability, "local_info", &self.local_info,
            "ty", &self.ty, "user_ty", &self.user_ty, "source_info",
            &&self.source_info)
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for LocalDecl<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let LocalDecl {
                        mutability: ref __binding_0,
                        local_info: ref __binding_1,
                        ty: ref __binding_2,
                        user_ty: ref __binding_3,
                        source_info: ref __binding_4 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_4,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for LocalDecl<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                LocalDecl {
                    mutability: ::rustc_serialize::Decodable::decode(__decoder),
                    local_info: ::rustc_serialize::Decodable::decode(__decoder),
                    ty: ::rustc_serialize::Decodable::decode(__decoder),
                    user_ty: ::rustc_serialize::Decodable::decode(__decoder),
                    source_info: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            LocalDecl<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    LocalDecl {
                        mutability: ref __binding_0,
                        local_info: ref __binding_1,
                        ty: ref __binding_2,
                        user_ty: ref __binding_3,
                        source_info: ref __binding_4 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for LocalDecl<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        LocalDecl {
                            mutability: __binding_0,
                            local_info: __binding_1,
                            ty: __binding_2,
                            user_ty: __binding_3,
                            source_info: __binding_4 } => {
                            LocalDecl {
                                mutability: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                local_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                                user_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
                                        __folder)?,
                                source_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    LocalDecl {
                        mutability: __binding_0,
                        local_info: __binding_1,
                        ty: __binding_2,
                        user_ty: __binding_3,
                        source_info: __binding_4 } => {
                        LocalDecl {
                            mutability: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            local_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
                                __folder),
                            user_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
                                __folder),
                            source_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for LocalDecl<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    LocalDecl {
                        mutability: ref __binding_0,
                        local_info: ref __binding_1,
                        ty: ref __binding_2,
                        user_ty: ref __binding_3,
                        source_info: ref __binding_4 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
971pub struct LocalDecl<'tcx> {
972    /// Whether this is a mutable binding (i.e., `let x` or `let mut x`).
973    ///
974    /// Temporaries and the return place are always mutable.
975    pub mutability: Mutability,
976
977    pub local_info: ClearCrossCrate<Box<LocalInfo<'tcx>>>,
978
979    /// The type of this local.
980    pub ty: Ty<'tcx>,
981
982    /// If the user manually ascribed a type to this variable,
983    /// e.g., via `let x: T`, then we carry that type here. The MIR
984    /// borrow checker needs this information since it can affect
985    /// region inference.
986    pub user_ty: Option<Box<UserTypeProjections>>,
987
988    /// The *syntactic* (i.e., not visibility) source scope the local is defined
989    /// in. If the local was defined in a let-statement, this
990    /// is *within* the let-statement, rather than outside
991    /// of it.
992    ///
993    /// This is needed because the visibility source scope of locals within
994    /// a let-statement is weird.
995    ///
996    /// The reason is that we want the local to be *within* the let-statement
997    /// for lint purposes, but we want the local to be *after* the let-statement
998    /// for names-in-scope purposes.
999    ///
1000    /// That's it, if we have a let-statement like the one in this
1001    /// function:
1002    ///
1003    /// ```
1004    /// fn foo(x: &str) {
1005    ///     #[allow(unused_mut)]
1006    ///     let mut x: u32 = {
1007    ///         //^ one unused mut
1008    ///         let mut y: u32 = x.parse().unwrap();
1009    ///         y + 2
1010    ///     };
1011    ///     drop(x);
1012    /// }
1013    /// ```
1014    ///
1015    /// Then, from a lint point of view, the declaration of `x: u32`
1016    /// (and `y: u32`) are within the `#[allow(unused_mut)]` scope - the
1017    /// lint scopes are the same as the AST/HIR nesting.
1018    ///
1019    /// However, from a name lookup point of view, the scopes look more like
1020    /// as if the let-statements were `match` expressions:
1021    ///
1022    /// ```
1023    /// fn foo(x: &str) {
1024    ///     match {
1025    ///         match x.parse::<u32>().unwrap() {
1026    ///             y => y + 2
1027    ///         }
1028    ///     } {
1029    ///         x => drop(x)
1030    ///     };
1031    /// }
1032    /// ```
1033    ///
1034    /// We care about the name-lookup scopes for debuginfo - if the
1035    /// debuginfo instruction pointer is at the call to `x.parse()`, we
1036    /// want `x` to refer to `x: &str`, but if it is at the call to
1037    /// `drop(x)`, we want it to refer to `x: u32`.
1038    ///
1039    /// To allow both uses to work, we need to have more than a single scope
1040    /// for a local. We have the `source_info.scope` represent the "syntactic"
1041    /// lint scope (with a variable being under its let block) while the
1042    /// `var_debug_info.source_info.scope` represents the "local variable"
1043    /// scope (where the "rest" of a block is under all prior let-statements).
1044    ///
1045    /// The end result looks like this:
1046    ///
1047    /// ```text
1048    /// ROOT SCOPE
1049    ///  │{ argument x: &str }
1050    ///  │
1051    ///  │ │{ #[allow(unused_mut)] } // This is actually split into 2 scopes
1052    ///  │ │                         // in practice because I'm lazy.
1053    ///  │ │
1054    ///  │ │← x.source_info.scope
1055    ///  │ │← `x.parse().unwrap()`
1056    ///  │ │
1057    ///  │ │ │← y.source_info.scope
1058    ///  │ │
1059    ///  │ │ │{ let y: u32 }
1060    ///  │ │ │
1061    ///  │ │ │← y.var_debug_info.source_info.scope
1062    ///  │ │ │← `y + 2`
1063    ///  │
1064    ///  │ │{ let x: u32 }
1065    ///  │ │← x.var_debug_info.source_info.scope
1066    ///  │ │← `drop(x)` // This accesses `x: u32`.
1067    /// ```
1068    pub source_info: SourceInfo,
1069}
1070
1071/// Extra information about a some locals that's used for diagnostics and for
1072/// classifying variables into local variables, statics, etc, which is needed e.g.
1073/// for borrow checking.
1074///
1075/// Not used for non-StaticRef temporaries, the return place, or anonymous
1076/// function parameters.
1077#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for LocalInfo<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::User(__self_0) =>
                LocalInfo::User(::core::clone::Clone::clone(__self_0)),
            Self::StaticRef { def_id: __self_0, is_thread_local: __self_1 } =>
                LocalInfo::StaticRef {
                    def_id: ::core::clone::Clone::clone(__self_0),
                    is_thread_local: ::core::clone::Clone::clone(__self_1),
                },
            Self::ConstRef { def_id: __self_0 } =>
                LocalInfo::ConstRef {
                    def_id: ::core::clone::Clone::clone(__self_0),
                },
            Self::AggregateTemp => LocalInfo::AggregateTemp,
            Self::BlockTailTemp(__self_0) =>
                LocalInfo::BlockTailTemp(::core::clone::Clone::clone(__self_0)),
            Self::IfThenRescopeTemp { if_then: __self_0 } =>
                LocalInfo::IfThenRescopeTemp {
                    if_then: ::core::clone::Clone::clone(__self_0),
                },
            Self::DerefTemp => LocalInfo::DerefTemp,
            Self::FakeBorrow => LocalInfo::FakeBorrow,
            Self::Boring => LocalInfo::Boring,
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for LocalInfo<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::User(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "User",
                    &__self_0),
            Self::StaticRef { def_id: __self_0, is_thread_local: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "StaticRef", "def_id", __self_0, "is_thread_local",
                    &__self_1),
            Self::ConstRef { def_id: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "ConstRef", "def_id", &__self_0),
            Self::AggregateTemp =>
                ::core::fmt::Formatter::write_str(f, "AggregateTemp"),
            Self::BlockTailTemp(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "BlockTailTemp", &__self_0),
            Self::IfThenRescopeTemp { if_then: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "IfThenRescopeTemp", "if_then", &__self_0),
            Self::DerefTemp =>
                ::core::fmt::Formatter::write_str(f, "DerefTemp"),
            Self::FakeBorrow =>
                ::core::fmt::Formatter::write_str(f, "FakeBorrow"),
            Self::Boring => ::core::fmt::Formatter::write_str(f, "Boring"),
        }
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for LocalInfo<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        LocalInfo::User(ref __binding_0) => { 0usize }
                        LocalInfo::StaticRef {
                            def_id: ref __binding_0, is_thread_local: ref __binding_1 }
                            => {
                            1usize
                        }
                        LocalInfo::ConstRef { def_id: ref __binding_0 } => {
                            2usize
                        }
                        LocalInfo::AggregateTemp => { 3usize }
                        LocalInfo::BlockTailTemp(ref __binding_0) => { 4usize }
                        LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
                            {
                            5usize
                        }
                        LocalInfo::DerefTemp => { 6usize }
                        LocalInfo::FakeBorrow => { 7usize }
                        LocalInfo::Boring => { 8usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    LocalInfo::User(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    LocalInfo::StaticRef {
                        def_id: ref __binding_0, is_thread_local: ref __binding_1 }
                        => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    LocalInfo::ConstRef { def_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    LocalInfo::AggregateTemp => {}
                    LocalInfo::BlockTailTemp(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
                        {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    LocalInfo::DerefTemp => {}
                    LocalInfo::FakeBorrow => {}
                    LocalInfo::Boring => {}
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for LocalInfo<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        LocalInfo::User(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => {
                        LocalInfo::StaticRef {
                            def_id: ::rustc_serialize::Decodable::decode(__decoder),
                            is_thread_local: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    2usize => {
                        LocalInfo::ConstRef {
                            def_id: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    3usize => { LocalInfo::AggregateTemp }
                    4usize => {
                        LocalInfo::BlockTailTemp(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    5usize => {
                        LocalInfo::IfThenRescopeTemp {
                            if_then: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    6usize => { LocalInfo::DerefTemp }
                    7usize => { LocalInfo::FakeBorrow }
                    8usize => { LocalInfo::Boring }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `LocalInfo`, expected 0..9, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            LocalInfo<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    LocalInfo::User(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    LocalInfo::StaticRef {
                        def_id: ref __binding_0, is_thread_local: ref __binding_1 }
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    LocalInfo::ConstRef { def_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    LocalInfo::AggregateTemp => {}
                    LocalInfo::BlockTailTemp(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
                        {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    LocalInfo::DerefTemp => {}
                    LocalInfo::FakeBorrow => {}
                    LocalInfo::Boring => {}
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for LocalInfo<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        LocalInfo::User(__binding_0) => {
                            LocalInfo::User(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        LocalInfo::StaticRef {
                            def_id: __binding_0, is_thread_local: __binding_1 } => {
                            LocalInfo::StaticRef {
                                def_id: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                is_thread_local: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                            }
                        }
                        LocalInfo::ConstRef { def_id: __binding_0 } => {
                            LocalInfo::ConstRef {
                                def_id: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                            }
                        }
                        LocalInfo::AggregateTemp => { LocalInfo::AggregateTemp }
                        LocalInfo::BlockTailTemp(__binding_0) => {
                            LocalInfo::BlockTailTemp(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        LocalInfo::IfThenRescopeTemp { if_then: __binding_0 } => {
                            LocalInfo::IfThenRescopeTemp {
                                if_then: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                            }
                        }
                        LocalInfo::DerefTemp => { LocalInfo::DerefTemp }
                        LocalInfo::FakeBorrow => { LocalInfo::FakeBorrow }
                        LocalInfo::Boring => { LocalInfo::Boring }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    LocalInfo::User(__binding_0) => {
                        LocalInfo::User(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    LocalInfo::StaticRef {
                        def_id: __binding_0, is_thread_local: __binding_1 } => {
                        LocalInfo::StaticRef {
                            def_id: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            is_thread_local: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                    LocalInfo::ConstRef { def_id: __binding_0 } => {
                        LocalInfo::ConstRef {
                            def_id: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                        }
                    }
                    LocalInfo::AggregateTemp => { LocalInfo::AggregateTemp }
                    LocalInfo::BlockTailTemp(__binding_0) => {
                        LocalInfo::BlockTailTemp(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    LocalInfo::IfThenRescopeTemp { if_then: __binding_0 } => {
                        LocalInfo::IfThenRescopeTemp {
                            if_then: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                        }
                    }
                    LocalInfo::DerefTemp => { LocalInfo::DerefTemp }
                    LocalInfo::FakeBorrow => { LocalInfo::FakeBorrow }
                    LocalInfo::Boring => { LocalInfo::Boring }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for LocalInfo<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    LocalInfo::User(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    LocalInfo::StaticRef {
                        def_id: ref __binding_0, is_thread_local: ref __binding_1 }
                        => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    LocalInfo::ConstRef { def_id: ref __binding_0 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    LocalInfo::AggregateTemp => {}
                    LocalInfo::BlockTailTemp(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
                        {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    LocalInfo::DerefTemp => {}
                    LocalInfo::FakeBorrow => {}
                    LocalInfo::Boring => {}
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
1078pub enum LocalInfo<'tcx> {
1079    /// A user-defined local variable or function parameter
1080    ///
1081    /// The `BindingForm` is solely used for local diagnostics when generating
1082    /// warnings/errors when compiling the current crate, and therefore it need
1083    /// not be visible across crates.
1084    User(BindingForm<'tcx>),
1085    /// A temporary created that references the static with the given `DefId`.
1086    StaticRef { def_id: DefId, is_thread_local: bool },
1087    /// A temporary created that references the const with the given `DefId`
1088    ConstRef { def_id: DefId },
1089    /// A temporary created during the creation of an aggregate
1090    /// (e.g. a temporary for `foo` in `MyStruct { my_field: foo }`)
1091    AggregateTemp,
1092    /// A temporary created for evaluation of some subexpression of some block's tail expression
1093    /// (with no intervening statement context).
1094    BlockTailTemp(BlockTailInfo),
1095    /// A temporary created during evaluating `if` predicate, possibly for pattern matching for `let`s,
1096    /// and subject to Edition 2024 temporary lifetime rules
1097    IfThenRescopeTemp { if_then: HirId },
1098    /// A temporary created during the pass `Derefer` treated as a transparent alias
1099    /// for the place its copied from by analysis passes such as `AddRetag` and `ElaborateDrops`.
1100    ///
1101    /// It may only be written to by a `CopyForDeref` and otherwise only accessed through a deref.
1102    /// In runtime MIR, it is replaced with a normal `Boring` local.
1103    DerefTemp,
1104    /// A temporary created for borrow checking.
1105    FakeBorrow,
1106    /// A local without anything interesting about it.
1107    Boring,
1108}
1109
1110impl<'tcx> LocalDecl<'tcx> {
1111    pub fn local_info(&self) -> &LocalInfo<'tcx> {
1112        self.local_info.as_ref().unwrap_crate_local()
1113    }
1114
1115    /// Returns `true` only if local is a binding that can itself be
1116    /// made mutable via the addition of the `mut` keyword, namely
1117    /// something like the occurrences of `x` in:
1118    /// - `fn foo(x: Type) { ... }`,
1119    /// - `let x = ...`,
1120    /// - or `match ... { C(x) => ... }`
1121    pub fn can_be_made_mutable(&self) -> bool {
1122        #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
    LocalInfo::User(BindingForm::Var(VarBindingForm {
        binding_mode: BindingMode(ByRef::No, _), .. }) |
        BindingForm::ImplicitSelf(ImplicitSelfKind::Imm)) => true,
    _ => false,
}matches!(
1123            self.local_info(),
1124            LocalInfo::User(
1125                BindingForm::Var(VarBindingForm { binding_mode: BindingMode(ByRef::No, _), .. })
1126                    | BindingForm::ImplicitSelf(ImplicitSelfKind::Imm),
1127            )
1128        )
1129    }
1130
1131    /// Returns `true` if local is definitely not a `ref ident` or
1132    /// `ref mut ident` binding. (Such bindings cannot be made into
1133    /// mutable bindings, but the inverse does not necessarily hold).
1134    pub fn is_nonref_binding(&self) -> bool {
1135        #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
    LocalInfo::User(BindingForm::Var(VarBindingForm {
        binding_mode: BindingMode(ByRef::No, _), .. }) |
        BindingForm::ImplicitSelf(_)) => true,
    _ => false,
}matches!(
1136            self.local_info(),
1137            LocalInfo::User(
1138                BindingForm::Var(VarBindingForm { binding_mode: BindingMode(ByRef::No, _), .. })
1139                    | BindingForm::ImplicitSelf(_),
1140            )
1141        )
1142    }
1143
1144    /// Returns `true` if this variable is a named variable or function
1145    /// parameter declared by the user.
1146    #[inline]
1147    pub fn is_user_variable(&self) -> bool {
1148        #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
    LocalInfo::User(_) => true,
    _ => false,
}matches!(self.local_info(), LocalInfo::User(_))
1149    }
1150
1151    /// Returns `true` if this is a reference to a variable bound in a `match`
1152    /// expression that is used to access said variable for the guard of the
1153    /// match arm.
1154    pub fn is_ref_for_guard(&self) -> bool {
1155        #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
    LocalInfo::User(BindingForm::RefForGuard(_)) => true,
    _ => false,
}matches!(self.local_info(), LocalInfo::User(BindingForm::RefForGuard(_)))
1156    }
1157
1158    /// Returns `Some` if this is a reference to a static item that is used to
1159    /// access that static.
1160    pub fn is_ref_to_static(&self) -> bool {
1161        #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
    LocalInfo::StaticRef { .. } => true,
    _ => false,
}matches!(self.local_info(), LocalInfo::StaticRef { .. })
1162    }
1163
1164    /// Returns `Some` if this is a reference to a thread-local static item that is used to
1165    /// access that static.
1166    pub fn is_ref_to_thread_local(&self) -> bool {
1167        match self.local_info() {
1168            LocalInfo::StaticRef { is_thread_local, .. } => *is_thread_local,
1169            _ => false,
1170        }
1171    }
1172
1173    /// Returns `true` if this is a DerefTemp
1174    pub fn is_deref_temp(&self) -> bool {
1175        match self.local_info() {
1176            LocalInfo::DerefTemp => true,
1177            _ => false,
1178        }
1179    }
1180
1181    /// Returns `true` is the local is from a compiler desugaring, e.g.,
1182    /// `__next` from a `for` loop.
1183    #[inline]
1184    pub fn from_compiler_desugaring(&self) -> bool {
1185        self.source_info.span.desugaring_kind().is_some()
1186    }
1187
1188    /// Creates a new `LocalDecl` for a temporary, mutable.
1189    #[inline]
1190    pub fn new(ty: Ty<'tcx>, span: Span) -> Self {
1191        Self::with_source_info(ty, SourceInfo::outermost(span))
1192    }
1193
1194    /// Like `LocalDecl::new`, but takes a `SourceInfo` instead of a `Span`.
1195    #[inline]
1196    pub fn with_source_info(ty: Ty<'tcx>, source_info: SourceInfo) -> Self {
1197        LocalDecl {
1198            mutability: Mutability::Mut,
1199            local_info: ClearCrossCrate::Set(Box::new(LocalInfo::Boring)),
1200            ty,
1201            user_ty: None,
1202            source_info,
1203        }
1204    }
1205
1206    /// Converts `self` into same `LocalDecl` except tagged as immutable.
1207    #[inline]
1208    pub fn immutable(mut self) -> Self {
1209        self.mutability = Mutability::Not;
1210        self
1211    }
1212}
1213
1214#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for VarDebugInfoContents<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::Place(__self_0) =>
                VarDebugInfoContents::Place(::core::clone::Clone::clone(__self_0)),
            Self::Const(__self_0) =>
                VarDebugInfoContents::Const(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for VarDebugInfoContents<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        VarDebugInfoContents::Place(ref __binding_0) => { 0usize }
                        VarDebugInfoContents::Const(ref __binding_0) => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    VarDebugInfoContents::Place(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    VarDebugInfoContents::Const(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for VarDebugInfoContents<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        VarDebugInfoContents::Place(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => {
                        VarDebugInfoContents::Const(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `VarDebugInfoContents`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            VarDebugInfoContents<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    VarDebugInfoContents::Place(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    VarDebugInfoContents::Const(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for VarDebugInfoContents<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        VarDebugInfoContents::Place(__binding_0) => {
                            VarDebugInfoContents::Place(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        VarDebugInfoContents::Const(__binding_0) => {
                            VarDebugInfoContents::Const(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    VarDebugInfoContents::Place(__binding_0) => {
                        VarDebugInfoContents::Place(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    VarDebugInfoContents::Const(__binding_0) => {
                        VarDebugInfoContents::Const(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for VarDebugInfoContents<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    VarDebugInfoContents::Place(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    VarDebugInfoContents::Const(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
1215pub enum VarDebugInfoContents<'tcx> {
1216    /// This `Place` only contains projection which satisfy `can_use_in_debuginfo`.
1217    Place(Place<'tcx>),
1218    Const(ConstOperand<'tcx>),
1219}
1220
1221impl<'tcx> Debug for VarDebugInfoContents<'tcx> {
1222    fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
1223        match self {
1224            VarDebugInfoContents::Const(c) => fmt.write_fmt(format_args!("{0}", c))write!(fmt, "{c}"),
1225            VarDebugInfoContents::Place(p) => fmt.write_fmt(format_args!("{0:?}", p))write!(fmt, "{p:?}"),
1226        }
1227    }
1228}
1229
1230#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for VarDebugInfoFragment<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        VarDebugInfoFragment {
            ty: ::core::clone::Clone::clone(&self.ty),
            projection: ::core::clone::Clone::clone(&self.projection),
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for VarDebugInfoFragment<'tcx> {
    #[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, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for VarDebugInfoFragment<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let VarDebugInfoFragment {
                        ty: ref __binding_0, projection: ref __binding_1 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for VarDebugInfoFragment<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                VarDebugInfoFragment {
                    ty: ::rustc_serialize::Decodable::decode(__decoder),
                    projection: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            VarDebugInfoFragment<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    VarDebugInfoFragment {
                        ty: ref __binding_0, projection: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for VarDebugInfoFragment<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        VarDebugInfoFragment {
                            ty: __binding_0, projection: __binding_1 } => {
                            VarDebugInfoFragment {
                                ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                projection: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    VarDebugInfoFragment {
                        ty: __binding_0, projection: __binding_1 } => {
                        VarDebugInfoFragment {
                            ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            projection: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for VarDebugInfoFragment<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    VarDebugInfoFragment {
                        ty: ref __binding_0, projection: ref __binding_1 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
1231pub struct VarDebugInfoFragment<'tcx> {
1232    /// Type of the original user variable.
1233    /// This cannot contain a union or an enum.
1234    pub ty: Ty<'tcx>,
1235
1236    /// Where in the composite user variable this fragment is,
1237    /// represented as a "projection" into the composite variable.
1238    /// At lower levels, this corresponds to a byte/bit range.
1239    ///
1240    /// This can only contain `PlaceElem::Field`.
1241    // FIXME support this for `enum`s by either using DWARF's
1242    // more advanced control-flow features (unsupported by LLVM?)
1243    // to match on the discriminant, or by using custom type debuginfo
1244    // with non-overlapping variants for the composite variable.
1245    pub projection: Vec<PlaceElem<'tcx>>,
1246}
1247
1248/// Debug information pertaining to a user variable.
1249#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for VarDebugInfo<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        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, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for VarDebugInfo<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let VarDebugInfo {
                        name: ref __binding_0,
                        source_info: ref __binding_1,
                        composite: ref __binding_2,
                        value: ref __binding_3,
                        argument_index: ref __binding_4 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_4,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for VarDebugInfo<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                VarDebugInfo {
                    name: ::rustc_serialize::Decodable::decode(__decoder),
                    source_info: ::rustc_serialize::Decodable::decode(__decoder),
                    composite: ::rustc_serialize::Decodable::decode(__decoder),
                    value: ::rustc_serialize::Decodable::decode(__decoder),
                    argument_index: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            VarDebugInfo<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    VarDebugInfo {
                        name: ref __binding_0,
                        source_info: ref __binding_1,
                        composite: ref __binding_2,
                        value: ref __binding_3,
                        argument_index: ref __binding_4 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for VarDebugInfo<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        VarDebugInfo {
                            name: __binding_0,
                            source_info: __binding_1,
                            composite: __binding_2,
                            value: __binding_3,
                            argument_index: __binding_4 } => {
                            VarDebugInfo {
                                name: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                source_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                composite: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                                value: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
                                        __folder)?,
                                argument_index: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    VarDebugInfo {
                        name: __binding_0,
                        source_info: __binding_1,
                        composite: __binding_2,
                        value: __binding_3,
                        argument_index: __binding_4 } => {
                        VarDebugInfo {
                            name: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            source_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            composite: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
                                __folder),
                            value: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
                                __folder),
                            argument_index: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for VarDebugInfo<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    VarDebugInfo {
                        name: ref __binding_0,
                        source_info: ref __binding_1,
                        composite: ref __binding_2,
                        value: ref __binding_3,
                        argument_index: ref __binding_4 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
1250pub struct VarDebugInfo<'tcx> {
1251    pub name: Symbol,
1252
1253    /// Source info of the user variable, including the scope
1254    /// within which the variable is visible (to debuginfo)
1255    /// (see `LocalDecl`'s `source_info` field for more details).
1256    pub source_info: SourceInfo,
1257
1258    /// The user variable's data is split across several fragments,
1259    /// each described by a `VarDebugInfoFragment`.
1260    /// See DWARF 5's "2.6.1.2 Composite Location Descriptions"
1261    /// and LLVM's `DW_OP_LLVM_fragment` for more details on
1262    /// the underlying debuginfo feature this relies on.
1263    pub composite: Option<Box<VarDebugInfoFragment<'tcx>>>,
1264
1265    /// Where the data for this user variable is to be found.
1266    pub value: VarDebugInfoContents<'tcx>,
1267
1268    /// When present, indicates what argument number this variable is in the function that it
1269    /// originated from (starting from 1). Note, if MIR inlining is enabled, then this is the
1270    /// argument number in the original function before it was inlined.
1271    pub argument_index: Option<u16>,
1272}
1273
1274///////////////////////////////////////////////////////////////////////////
1275// BasicBlock
1276
1277#[automatically_derived]
impl ::core::marker::Copy for BasicBlock { }
pub const START_BLOCK: BasicBlock = BasicBlock::from_u32(0);
impl BasicBlock {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for BasicBlock {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for BasicBlock {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for BasicBlock {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for BasicBlock {
    #[inline]
    fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
        <usize as
                ::std::iter::Step>::steps_between(&Self::index(*start),
            &Self::index(*end))
    }
    #[inline]
    fn forward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_add(u).map(Self::from_usize)
    }
    #[inline]
    fn backward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_sub(u).map(Self::from_usize)
    }
    #[inline]
    fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_add(u);
        (Self::from_usize(s), o)
    }
    #[inline]
    fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_sub(u);
        (Self::from_usize(s), o)
    }
}
impl ::std::cmp::Ord for BasicBlock {
    #[inline]
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.as_u32().cmp(&other.as_u32())
    }
}
impl ::std::cmp::PartialOrd for BasicBlock {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl ::rustc_data_structures::stable_hash::StableHash for BasicBlock {
    fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
        hcx: &mut __Hcx,
        hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
        self.as_u32().stable_hash(hcx, hasher)
    }
}
impl From<BasicBlock> for u32 {
    #[inline]
    fn from(v: BasicBlock) -> u32 { v.as_u32() }
}
impl From<BasicBlock> for usize {
    #[inline]
    fn from(v: BasicBlock) -> usize { v.as_usize() }
}
impl From<usize> for BasicBlock {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for BasicBlock {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for BasicBlock {}
impl ::std::cmp::PartialEq for BasicBlock {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for BasicBlock {}
impl ::std::hash::Hash for BasicBlock {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
    BasicBlock {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
    BasicBlock {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for BasicBlock {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("bb{0}", self.as_u32()))
    }
}rustc_index::newtype_index! {
1278    /// A node in the MIR [control-flow graph][CFG].
1279    ///
1280    /// There are no branches (e.g., `if`s, function calls, etc.) within a basic block, which makes
1281    /// it easier to do [data-flow analyses] and optimizations. Instead, branches are represented
1282    /// as an edge in a graph between basic blocks.
1283    ///
1284    /// Basic blocks consist of a series of [statements][Statement], ending with a
1285    /// [terminator][Terminator]. Basic blocks can have multiple predecessors and successors,
1286    /// however there is a MIR pass ([`CriticalCallEdges`]) that removes *critical edges*, which
1287    /// are edges that go from a multi-successor node to a multi-predecessor node. This pass is
1288    /// needed because some analyses require that there are no critical edges in the CFG.
1289    ///
1290    /// Note that this type is just an index into [`Body.basic_blocks`](Body::basic_blocks);
1291    /// the actual data that a basic block holds is in [`BasicBlockData`].
1292    ///
1293    /// Read more about basic blocks in the [rustc-dev-guide][guide-mir].
1294    ///
1295    /// [CFG]: https://rustc-dev-guide.rust-lang.org/appendix/background.html#cfg
1296    /// [data-flow analyses]:
1297    ///     https://rustc-dev-guide.rust-lang.org/appendix/background.html#what-is-a-dataflow-analysis
1298    /// [`CriticalCallEdges`]: ../../rustc_mir_transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
1299    /// [guide-mir]: https://rustc-dev-guide.rust-lang.org/mir/
1300    #[stable_hash]
1301    #[encodable]
1302    #[orderable]
1303    #[debug_format = "bb{}"]
1304    pub struct BasicBlock {
1305        const START_BLOCK = 0;
1306    }
1307}
1308
1309impl BasicBlock {
1310    #[inline]
1311    pub fn start_location(self) -> Location {
1312        Location { block: self, statement_index: 0 }
1313    }
1314}
1315
1316///////////////////////////////////////////////////////////////////////////
1317// BasicBlockData
1318
1319/// Data for a basic block, including a list of its statements.
1320///
1321/// See [`BasicBlock`] for documentation on what basic blocks are at a high level.
1322#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for BasicBlockData<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        BasicBlockData {
            statements: ::core::clone::Clone::clone(&self.statements),
            after_last_stmt_debuginfos: ::core::clone::Clone::clone(&self.after_last_stmt_debuginfos),
            terminator: ::core::clone::Clone::clone(&self.terminator),
            is_cleanup: ::core::clone::Clone::clone(&self.is_cleanup),
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for BasicBlockData<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f,
            "BasicBlockData", "statements", &self.statements,
            "after_last_stmt_debuginfos", &self.after_last_stmt_debuginfos,
            "terminator", &self.terminator, "is_cleanup", &&self.is_cleanup)
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for BasicBlockData<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let BasicBlockData {
                        statements: ref __binding_0,
                        after_last_stmt_debuginfos: ref __binding_1,
                        terminator: ref __binding_2,
                        is_cleanup: ref __binding_3 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for BasicBlockData<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                BasicBlockData {
                    statements: ::rustc_serialize::Decodable::decode(__decoder),
                    after_last_stmt_debuginfos: ::rustc_serialize::Decodable::decode(__decoder),
                    terminator: ::rustc_serialize::Decodable::decode(__decoder),
                    is_cleanup: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            BasicBlockData<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    BasicBlockData {
                        statements: ref __binding_0,
                        after_last_stmt_debuginfos: ref __binding_1,
                        terminator: ref __binding_2,
                        is_cleanup: ref __binding_3 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for BasicBlockData<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        BasicBlockData {
                            statements: __binding_0,
                            after_last_stmt_debuginfos: __binding_1,
                            terminator: __binding_2,
                            is_cleanup: __binding_3 } => {
                            BasicBlockData {
                                statements: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                after_last_stmt_debuginfos: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                terminator: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                                is_cleanup: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    BasicBlockData {
                        statements: __binding_0,
                        after_last_stmt_debuginfos: __binding_1,
                        terminator: __binding_2,
                        is_cleanup: __binding_3 } => {
                        BasicBlockData {
                            statements: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            after_last_stmt_debuginfos: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            terminator: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
                                __folder),
                            is_cleanup: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for BasicBlockData<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    BasicBlockData {
                        statements: ref __binding_0,
                        after_last_stmt_debuginfos: ref __binding_1,
                        terminator: ref __binding_2,
                        is_cleanup: ref __binding_3 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
1323#[non_exhaustive]
1324pub struct BasicBlockData<'tcx> {
1325    /// List of statements in this block.
1326    pub statements: Vec<Statement<'tcx>>,
1327
1328    /// All debuginfos happen before the statement.
1329    /// Put debuginfos here when the last statement is eliminated.
1330    pub after_last_stmt_debuginfos: StmtDebugInfos<'tcx>,
1331
1332    /// Terminator for this block.
1333    ///
1334    /// N.B., this should generally ONLY be `None` during construction.
1335    /// Therefore, you should generally access it via the
1336    /// `terminator()` or `terminator_mut()` methods. The only
1337    /// exception is that certain passes, such as `simplify_cfg`, swap
1338    /// out the terminator temporarily with `None` while they continue
1339    /// to recurse over the set of basic blocks.
1340    pub terminator: Option<Terminator<'tcx>>,
1341
1342    /// If true, this block lies on an unwind path. This is used
1343    /// during codegen where distinct kinds of basic blocks may be
1344    /// generated (particularly for MSVC cleanup). Unwind blocks must
1345    /// only branch to other unwind blocks.
1346    pub is_cleanup: bool,
1347}
1348
1349impl<'tcx> BasicBlockData<'tcx> {
1350    pub fn new(terminator: Option<Terminator<'tcx>>, is_cleanup: bool) -> BasicBlockData<'tcx> {
1351        BasicBlockData::new_stmts(Vec::new(), terminator, is_cleanup)
1352    }
1353
1354    pub fn new_stmts(
1355        statements: Vec<Statement<'tcx>>,
1356        terminator: Option<Terminator<'tcx>>,
1357        is_cleanup: bool,
1358    ) -> BasicBlockData<'tcx> {
1359        BasicBlockData {
1360            statements,
1361            after_last_stmt_debuginfos: StmtDebugInfos::default(),
1362            terminator,
1363            is_cleanup,
1364        }
1365    }
1366
1367    /// Accessor for terminator.
1368    ///
1369    /// Terminator may not be None after construction of the basic block is complete. This accessor
1370    /// provides a convenient way to reach the terminator.
1371    #[inline]
1372    pub fn terminator(&self) -> &Terminator<'tcx> {
1373        self.terminator.as_ref().expect("invalid terminator state")
1374    }
1375
1376    #[inline]
1377    pub fn terminator_mut(&mut self) -> &mut Terminator<'tcx> {
1378        self.terminator.as_mut().expect("invalid terminator state")
1379    }
1380
1381    /// Does the block have no statements and an unreachable terminator?
1382    #[inline]
1383    pub fn is_empty_unreachable(&self) -> bool {
1384        self.statements.is_empty() && #[allow(non_exhaustive_omitted_patterns)] match self.terminator().kind {
    TerminatorKind::Unreachable => true,
    _ => false,
}matches!(self.terminator().kind, TerminatorKind::Unreachable)
1385    }
1386
1387    /// Like [`Terminator::successors`] but tries to use information available from the [`Instance`]
1388    /// to skip successors like the `false` side of an `if const {`.
1389    ///
1390    /// This is used to implement [`traversal::mono_reachable`] and
1391    /// [`traversal::mono_reachable_reverse_postorder`].
1392    pub fn mono_successors(&self, tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> Successors<'_> {
1393        if let Some((bits, targets)) = Body::try_const_mono_switchint(tcx, instance, self) {
1394            targets.successors_for_value(bits)
1395        } else {
1396            self.terminator().successors()
1397        }
1398    }
1399
1400    pub fn retain_statements<F>(&mut self, mut f: F)
1401    where
1402        F: FnMut(&Statement<'tcx>) -> bool,
1403    {
1404        // Place debuginfos into the next retained statement,
1405        // this `debuginfos` variable is used to cache debuginfos between two retained statements.
1406        let mut debuginfos = StmtDebugInfos::default();
1407        self.statements.retain_mut(|stmt| {
1408            let retain = f(stmt);
1409            if retain {
1410                stmt.debuginfos.prepend(&mut debuginfos);
1411            } else {
1412                debuginfos.append(&mut stmt.debuginfos);
1413            }
1414            retain
1415        });
1416        self.after_last_stmt_debuginfos.prepend(&mut debuginfos);
1417    }
1418
1419    pub fn strip_nops(&mut self) {
1420        self.retain_statements(|stmt| !#[allow(non_exhaustive_omitted_patterns)] match stmt.kind {
    StatementKind::Nop => true,
    _ => false,
}matches!(stmt.kind, StatementKind::Nop))
1421    }
1422
1423    pub fn drop_debuginfo(&mut self) {
1424        self.after_last_stmt_debuginfos.drop_debuginfo();
1425        for stmt in self.statements.iter_mut() {
1426            stmt.debuginfos.drop_debuginfo();
1427        }
1428    }
1429}
1430
1431///////////////////////////////////////////////////////////////////////////
1432// Scopes
1433
1434#[automatically_derived]
impl ::core::marker::Copy for SourceScope { }
pub const OUTERMOST_SOURCE_SCOPE: SourceScope = SourceScope::from_u32(0);
impl SourceScope {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for SourceScope {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for SourceScope {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for SourceScope {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::rustc_data_structures::stable_hash::StableHash for SourceScope {
    fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
        hcx: &mut __Hcx,
        hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
        self.as_u32().stable_hash(hcx, hasher)
    }
}
impl From<SourceScope> for u32 {
    #[inline]
    fn from(v: SourceScope) -> u32 { v.as_u32() }
}
impl From<SourceScope> for usize {
    #[inline]
    fn from(v: SourceScope) -> usize { v.as_usize() }
}
impl From<usize> for SourceScope {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for SourceScope {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for SourceScope {}
impl ::std::cmp::PartialEq for SourceScope {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for SourceScope {}
impl ::std::hash::Hash for SourceScope {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
    SourceScope {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
    SourceScope {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for SourceScope {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("scope[{0}]", self.as_u32()))
    }
}rustc_index::newtype_index! {
1435    #[stable_hash]
1436    #[encodable]
1437    #[debug_format = "scope[{}]"]
1438    pub struct SourceScope {
1439        const OUTERMOST_SOURCE_SCOPE = 0;
1440    }
1441}
1442
1443impl SourceScope {
1444    /// Finds the original HirId this MIR item came from.
1445    /// This is necessary after MIR optimizations, as otherwise we get a HirId
1446    /// from the function that was inlined instead of the function call site.
1447    pub fn lint_root(
1448        self,
1449        source_scopes: &IndexSlice<SourceScope, SourceScopeData<'_>>,
1450    ) -> Option<HirId> {
1451        let mut data = &source_scopes[self];
1452        // FIXME(oli-obk): we should be able to just walk the `inlined_parent_scope`, but it
1453        // does not work as I thought it would. Needs more investigation and documentation.
1454        while data.inlined.is_some() {
1455            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/19833af7224424e8b53e288097d56b6af43d5bcf/compiler/rustc_middle/src/mir/mod.rs:1455",
                        "rustc_middle::mir", ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/19833af7224424e8b53e288097d56b6af43d5bcf/compiler/rustc_middle/src/mir/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(1455u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_middle::mir"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("data")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("data");
                                            NAME.as_str()
                                        }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&data)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};trace!(?data);
1456            data = &source_scopes[data.parent_scope.unwrap()];
1457        }
1458        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/19833af7224424e8b53e288097d56b6af43d5bcf/compiler/rustc_middle/src/mir/mod.rs:1458",
                        "rustc_middle::mir", ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/19833af7224424e8b53e288097d56b6af43d5bcf/compiler/rustc_middle/src/mir/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(1458u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_middle::mir"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("data")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("data");
                                            NAME.as_str()
                                        }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&data)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};trace!(?data);
1459        match &data.local_data {
1460            ClearCrossCrate::Set(data) => Some(data.lint_root),
1461            ClearCrossCrate::Clear => None,
1462        }
1463    }
1464
1465    /// The instance this source scope was inlined from, if any.
1466    #[inline]
1467    pub fn inlined_instance<'tcx>(
1468        self,
1469        source_scopes: &IndexSlice<SourceScope, SourceScopeData<'tcx>>,
1470    ) -> Option<ty::Instance<'tcx>> {
1471        let scope_data = &source_scopes[self];
1472        if let Some((inlined_instance, _)) = scope_data.inlined {
1473            Some(inlined_instance)
1474        } else if let Some(inlined_scope) = scope_data.inlined_parent_scope {
1475            Some(source_scopes[inlined_scope].inlined.unwrap().0)
1476        } else {
1477            None
1478        }
1479    }
1480}
1481
1482#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for SourceScopeData<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        SourceScopeData {
            span: ::core::clone::Clone::clone(&self.span),
            parent_scope: ::core::clone::Clone::clone(&self.parent_scope),
            inlined: ::core::clone::Clone::clone(&self.inlined),
            inlined_parent_scope: ::core::clone::Clone::clone(&self.inlined_parent_scope),
            local_data: ::core::clone::Clone::clone(&self.local_data),
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for SourceScopeData<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f,
            "SourceScopeData", "span", &self.span, "parent_scope",
            &self.parent_scope, "inlined", &self.inlined,
            "inlined_parent_scope", &self.inlined_parent_scope, "local_data",
            &&self.local_data)
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for SourceScopeData<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let SourceScopeData {
                        span: ref __binding_0,
                        parent_scope: ref __binding_1,
                        inlined: ref __binding_2,
                        inlined_parent_scope: ref __binding_3,
                        local_data: ref __binding_4 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_4,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for SourceScopeData<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                SourceScopeData {
                    span: ::rustc_serialize::Decodable::decode(__decoder),
                    parent_scope: ::rustc_serialize::Decodable::decode(__decoder),
                    inlined: ::rustc_serialize::Decodable::decode(__decoder),
                    inlined_parent_scope: ::rustc_serialize::Decodable::decode(__decoder),
                    local_data: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
            SourceScopeData<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    SourceScopeData {
                        span: ref __binding_0,
                        parent_scope: ref __binding_1,
                        inlined: ref __binding_2,
                        inlined_parent_scope: ref __binding_3,
                        local_data: ref __binding_4 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for SourceScopeData<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        SourceScopeData {
                            span: __binding_0,
                            parent_scope: __binding_1,
                            inlined: __binding_2,
                            inlined_parent_scope: __binding_3,
                            local_data: __binding_4 } => {
                            SourceScopeData {
                                span: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                parent_scope: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                inlined: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                                inlined_parent_scope: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
                                        __folder)?,
                                local_data: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    SourceScopeData {
                        span: __binding_0,
                        parent_scope: __binding_1,
                        inlined: __binding_2,
                        inlined_parent_scope: __binding_3,
                        local_data: __binding_4 } => {
                        SourceScopeData {
                            span: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            parent_scope: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            inlined: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
                                __folder),
                            inlined_parent_scope: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
                                __folder),
                            local_data: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for SourceScopeData<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    SourceScopeData {
                        span: ref __binding_0,
                        parent_scope: ref __binding_1,
                        inlined: ref __binding_2,
                        inlined_parent_scope: ref __binding_3,
                        local_data: ref __binding_4 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
1483pub struct SourceScopeData<'tcx> {
1484    pub span: Span,
1485    pub parent_scope: Option<SourceScope>,
1486
1487    /// Whether this scope is the root of a scope tree of another body,
1488    /// inlined into this body by the MIR inliner.
1489    /// `ty::Instance` is the callee, and the `Span` is the call site.
1490    pub inlined: Option<(ty::Instance<'tcx>, Span)>,
1491
1492    /// Nearest (transitive) parent scope (if any) which is inlined.
1493    /// This is an optimization over walking up `parent_scope`
1494    /// until a scope with `inlined: Some(...)` is found.
1495    pub inlined_parent_scope: Option<SourceScope>,
1496
1497    /// Crate-local information for this source scope, that can't (and
1498    /// needn't) be tracked across crates.
1499    pub local_data: ClearCrossCrate<SourceScopeLocalData>,
1500}
1501
1502#[derive(#[automatically_derived]
impl ::core::clone::Clone for SourceScopeLocalData {
    #[inline]
    fn clone(&self) -> Self {
        SourceScopeLocalData {
            lint_root: ::core::clone::Clone::clone(&self.lint_root),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for SourceScopeLocalData {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f,
            "SourceScopeLocalData", "lint_root", &&self.lint_root)
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for SourceScopeLocalData {
            fn encode(&self, __encoder: &mut __E) {
                let SourceScopeLocalData { lint_root: ref __binding_0 } =
                    *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for SourceScopeLocalData {
            fn decode(__decoder: &mut __D) -> Self {
                SourceScopeLocalData {
                    lint_root: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            SourceScopeLocalData {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    SourceScopeLocalData { lint_root: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1503pub struct SourceScopeLocalData {
1504    /// An `HirId` with lint levels equivalent to this scope's lint levels.
1505    pub lint_root: HirId,
1506}
1507
1508/// A collection of projections into user types.
1509///
1510/// They are projections because a binding can occur a part of a
1511/// parent pattern that has been ascribed a type.
1512///
1513/// It's a collection because there can be multiple type ascriptions on
1514/// the path from the root of the pattern down to the binding itself.
1515///
1516/// An example:
1517///
1518/// ```ignore (illustrative)
1519/// struct S<'a>((i32, &'a str), String);
1520/// let S((_, w): (i32, &'static str), _): S = ...;
1521/// //    ------  ^^^^^^^^^^^^^^^^^^^ (1)
1522/// //  ---------------------------------  ^ (2)
1523/// ```
1524///
1525/// The highlights labelled `(1)` show the subpattern `(_, w)` being
1526/// ascribed the type `(i32, &'static str)`.
1527///
1528/// The highlights labelled `(2)` show the whole pattern being
1529/// ascribed the type `S`.
1530///
1531/// In this example, when we descend to `w`, we will have built up the
1532/// following two projected types:
1533///
1534///   * base: `S`,                   projection: `(base.0).1`
1535///   * base: `(i32, &'static str)`, projection: `base.1`
1536///
1537/// The first will lead to the constraint `w: &'1 str` (for some
1538/// inferred region `'1`). The second will lead to the constraint `w:
1539/// &'static str`.
1540#[derive(#[automatically_derived]
impl ::core::clone::Clone for UserTypeProjections {
    #[inline]
    fn clone(&self) -> Self {
        UserTypeProjections {
            contents: ::core::clone::Clone::clone(&self.contents),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for UserTypeProjections {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f,
            "UserTypeProjections", "contents", &&self.contents)
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for UserTypeProjections {
            fn encode(&self, __encoder: &mut __E) {
                let UserTypeProjections { contents: ref __binding_0 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for UserTypeProjections {
            fn decode(__decoder: &mut __D) -> Self {
                UserTypeProjections {
                    contents: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            UserTypeProjections {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    UserTypeProjections { contents: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for UserTypeProjections {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        UserTypeProjections { contents: __binding_0 } => {
                            UserTypeProjections {
                                contents: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    UserTypeProjections { contents: __binding_0 } => {
                        UserTypeProjections {
                            contents: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for UserTypeProjections {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    UserTypeProjections { contents: ref __binding_0 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
1541pub struct UserTypeProjections {
1542    pub contents: Vec<UserTypeProjection>,
1543}
1544
1545impl UserTypeProjections {
1546    pub fn projections(&self) -> impl Iterator<Item = &UserTypeProjection> + ExactSizeIterator {
1547        self.contents.iter()
1548    }
1549}
1550
1551/// Encodes the effect of a user-supplied type annotation on the
1552/// subcomponents of a pattern. The effect is determined by applying the
1553/// given list of projections to some underlying base type. Often,
1554/// the projection element list `projs` is empty, in which case this
1555/// directly encodes a type in `base`. But in the case of complex patterns with
1556/// subpatterns and bindings, we want to apply only a *part* of the type to a variable,
1557/// in which case the `projs` vector is used.
1558///
1559/// Examples:
1560///
1561/// * `let x: T = ...` -- here, the `projs` vector is empty.
1562///
1563/// * `let (x, _): T = ...` -- here, the `projs` vector would contain
1564///   `field[0]` (aka `.0`), indicating that the type of `s` is
1565///   determined by finding the type of the `.0` field from `T`.
1566#[derive(#[automatically_derived]
impl ::core::clone::Clone for UserTypeProjection {
    #[inline]
    fn clone(&self) -> Self {
        UserTypeProjection {
            base: ::core::clone::Clone::clone(&self.base),
            projs: ::core::clone::Clone::clone(&self.projs),
        }
    }
}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, "projs", &&self.projs)
    }
}Debug, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for UserTypeProjection {
            fn encode(&self, __encoder: &mut __E) {
                let UserTypeProjection {
                        base: ref __binding_0, projs: ref __binding_1 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for UserTypeProjection {
            fn decode(__decoder: &mut __D) -> Self {
                UserTypeProjection {
                    base: ::rustc_serialize::Decodable::decode(__decoder),
                    projs: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            UserTypeProjection {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    UserTypeProjection {
                        base: ref __binding_0, projs: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for UserTypeProjection { }
#[automatically_derived]
impl ::core::cmp::PartialEq for UserTypeProjection {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.base == other.base && self.projs == other.projs
    }
}PartialEq)]
1567#[derive(const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for UserTypeProjection {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        UserTypeProjection { base: __binding_0, projs: __binding_1 }
                            => {
                            UserTypeProjection {
                                base: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                projs: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    UserTypeProjection { base: __binding_0, projs: __binding_1 }
                        => {
                        UserTypeProjection {
                            base: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            projs: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for UserTypeProjection {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    UserTypeProjection {
                        base: ref __binding_0, projs: ref __binding_1 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
1568pub struct UserTypeProjection {
1569    pub base: UserTypeAnnotationIndex,
1570    pub projs: Vec<ProjectionKind>,
1571}
1572
1573#[automatically_derived]
impl ::core::marker::Copy for Promoted { }
impl Promoted {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for Promoted {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for Promoted {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for Promoted {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for Promoted {
    #[inline]
    fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
        <usize as
                ::std::iter::Step>::steps_between(&Self::index(*start),
            &Self::index(*end))
    }
    #[inline]
    fn forward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_add(u).map(Self::from_usize)
    }
    #[inline]
    fn backward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_sub(u).map(Self::from_usize)
    }
    #[inline]
    fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_add(u);
        (Self::from_usize(s), o)
    }
    #[inline]
    fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_sub(u);
        (Self::from_usize(s), o)
    }
}
impl ::std::cmp::Ord for Promoted {
    #[inline]
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.as_u32().cmp(&other.as_u32())
    }
}
impl ::std::cmp::PartialOrd for Promoted {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl ::rustc_data_structures::stable_hash::StableHash for Promoted {
    fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
        hcx: &mut __Hcx,
        hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
        self.as_u32().stable_hash(hcx, hasher)
    }
}
impl From<Promoted> for u32 {
    #[inline]
    fn from(v: Promoted) -> u32 { v.as_u32() }
}
impl From<Promoted> for usize {
    #[inline]
    fn from(v: Promoted) -> usize { v.as_usize() }
}
impl From<usize> for Promoted {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for Promoted {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for Promoted {}
impl ::std::cmp::PartialEq for Promoted {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for Promoted {}
impl ::std::hash::Hash for Promoted {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
    Promoted {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
    Promoted {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for Promoted {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("promoted[{0}]", self.as_u32()))
    }
}rustc_index::newtype_index! {
1574    #[stable_hash]
1575    #[encodable]
1576    #[orderable]
1577    #[debug_format = "promoted[{}]"]
1578    pub struct Promoted {}
1579}
1580
1581/// `Location` represents the position of the start of the statement; or, if
1582/// `statement_index` equals the number of statements, then the start of the
1583/// terminator.
1584#[derive(#[automatically_derived]
impl ::core::marker::Copy for Location { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Location { }
#[automatically_derived]
impl ::core::clone::Clone for Location {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<BasicBlock>;
        let _: ::core::clone::AssertParamIsClone<usize>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Location { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Location {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.block == other.block &&
            self.statement_index == other.statement_index
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Location {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<BasicBlock>;
        let _: ::core::cmp::AssertParamIsEq<usize>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for Location {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.block, state);
        ::core::hash::Hash::hash(&self.statement_index, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::Ord for Location {
    #[inline]
    fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
        match ::core::cmp::Ord::cmp(&self.block, &other.block) {
            ::core::cmp::Ordering::Equal =>
                ::core::cmp::Ord::cmp(&self.statement_index,
                    &other.statement_index),
            cmp => cmp,
        }
    }
}Ord, #[automatically_derived]
impl ::core::cmp::PartialOrd for Location {
    #[inline]
    fn partial_cmp(&self, other: &Self)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}PartialOrd, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for Location {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Location {
                        block: ref __binding_0, statement_index: ref __binding_1 }
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1585pub struct Location {
1586    /// The block that the location is within.
1587    pub block: BasicBlock,
1588
1589    pub statement_index: usize,
1590}
1591
1592impl fmt::Debug for Location {
1593    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1594        fmt.write_fmt(format_args!("{0:?}[{1}]", self.block, self.statement_index))write!(fmt, "{:?}[{}]", self.block, self.statement_index)
1595    }
1596}
1597
1598impl Location {
1599    pub const START: Location = Location { block: START_BLOCK, statement_index: 0 };
1600
1601    /// Returns the location immediately after this one within the enclosing block.
1602    ///
1603    /// Note that if this location represents a terminator, then the
1604    /// resulting location would be out of bounds and invalid.
1605    #[inline]
1606    pub fn successor_within_block(&self) -> Location {
1607        Location { block: self.block, statement_index: self.statement_index + 1 }
1608    }
1609
1610    /// Returns `true` if `other` is earlier in the control flow graph than `self`.
1611    pub fn is_predecessor_of<'tcx>(&self, other: Location, body: &Body<'tcx>) -> bool {
1612        // If we are in the same block as the other location and are an earlier statement
1613        // then we are a predecessor of `other`.
1614        if self.block == other.block && self.statement_index < other.statement_index {
1615            return true;
1616        }
1617
1618        let predecessors = body.basic_blocks.predecessors();
1619
1620        // If we're in another block, then we want to check that block is a predecessor of `other`.
1621        let mut queue: Vec<BasicBlock> = predecessors[other.block].to_vec();
1622        let mut visited = FxHashSet::default();
1623
1624        while let Some(block) = queue.pop() {
1625            // If we haven't visited this block before, then make sure we visit its predecessors.
1626            if visited.insert(block) {
1627                queue.extend(predecessors[block].iter().cloned());
1628            } else {
1629                continue;
1630            }
1631
1632            // If we found the block that `self` is in, then we are a predecessor of `other` (since
1633            // we found that block by looking at the predecessors of `other`).
1634            if self.block == block {
1635                return true;
1636            }
1637        }
1638
1639        false
1640    }
1641
1642    #[inline]
1643    pub fn dominates(&self, other: Location, dominators: &Dominators<BasicBlock>) -> bool {
1644        if self.block == other.block {
1645            self.statement_index <= other.statement_index
1646        } else {
1647            dominators.dominates(self.block, other.block)
1648        }
1649    }
1650
1651    #[inline]
1652    pub fn strictly_dominates(&self, other: Location, dominators: &Dominators<BasicBlock>) -> bool {
1653        self.block != other.block && dominators.strictly_dominates(self.block, other.block)
1654    }
1655}
1656
1657/// `DefLocation` represents the location of a definition - either an argument or an assignment
1658/// within MIR body.
1659#[derive(#[automatically_derived]
impl ::core::marker::Copy for DefLocation { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for DefLocation { }
#[automatically_derived]
impl ::core::clone::Clone for DefLocation {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<Location>;
        let _: ::core::clone::AssertParamIsClone<BasicBlock>;
        let _: ::core::clone::AssertParamIsClone<Option<BasicBlock>>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for DefLocation {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Argument =>
                ::core::fmt::Formatter::write_str(f, "Argument"),
            Self::Assignment(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Assignment", &__self_0),
            Self::CallReturn { call: __self_0, target: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "CallReturn", "call", __self_0, "target", &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for DefLocation { }
#[automatically_derived]
impl ::core::cmp::PartialEq for DefLocation {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Assignment(__self_0), Self::Assignment(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::CallReturn { call: __self_0, target: __self_1 },
                    Self::CallReturn { call: __arg1_0, target: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for DefLocation {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Location>;
        let _: ::core::cmp::AssertParamIsEq<BasicBlock>;
        let _: ::core::cmp::AssertParamIsEq<Option<BasicBlock>>;
    }
}Eq)]
1660pub enum DefLocation {
1661    Argument,
1662    Assignment(Location),
1663    CallReturn { call: BasicBlock, target: Option<BasicBlock> },
1664}
1665
1666impl DefLocation {
1667    #[inline]
1668    pub fn dominates(self, location: Location, dominators: &Dominators<BasicBlock>) -> bool {
1669        match self {
1670            DefLocation::Argument => true,
1671            DefLocation::Assignment(def) => {
1672                def.successor_within_block().dominates(location, dominators)
1673            }
1674            DefLocation::CallReturn { target: None, .. } => false,
1675            DefLocation::CallReturn { call, target: Some(target) } => {
1676                // The definition occurs on the call -> target edge. The definition dominates a use
1677                // if and only if the edge is on all paths from the entry to the use.
1678                //
1679                // Note that a call terminator has only one edge that can reach the target, so when
1680                // the call strongly dominates the target, all paths from the entry to the target
1681                // go through the call -> target edge.
1682                call != target
1683                    && dominators.dominates(call, target)
1684                    && dominators.dominates(target, location.block)
1685            }
1686        }
1687    }
1688}
1689
1690/// Checks if the specified `local` is used as the `self` parameter of a method call
1691/// in the provided `BasicBlock`. If it is, then the `DefId` of the called method is
1692/// returned.
1693pub fn find_self_call<'tcx>(
1694    tcx: TyCtxt<'tcx>,
1695    body: &Body<'tcx>,
1696    local: Local,
1697    block: BasicBlock,
1698) -> Option<(DefId, GenericArgsRef<'tcx>)> {
1699    {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/19833af7224424e8b53e288097d56b6af43d5bcf/compiler/rustc_middle/src/mir/mod.rs:1699",
                        "rustc_middle::mir", ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/19833af7224424e8b53e288097d56b6af43d5bcf/compiler/rustc_middle/src/mir/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(1699u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_middle::mir"),
                        ::tracing_core::field::FieldSet::new(&["message"],
                            ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("find_self_call(local={0:?}): terminator={1:?}",
                                                    local, body[block].terminator) as
                                            &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("find_self_call(local={:?}): terminator={:?}", local, body[block].terminator);
1700    if let Some(Terminator { kind: TerminatorKind::Call { func, args, .. }, .. }) =
1701        &body[block].terminator
1702        && let Operand::Constant(ConstOperand { const_, .. }) = func
1703        && let ty::FnDef(def_id, fn_args) = *const_.ty().kind()
1704        && let Some(item) = tcx.opt_associated_item(def_id)
1705        && item.is_method()
1706        && let [Spanned { node: Operand::Move(self_place) | Operand::Copy(self_place), .. }, ..] =
1707            **args
1708    {
1709        let fn_args = fn_args.no_bound_vars().unwrap();
1710
1711        if self_place.as_local() == Some(local) {
1712            return Some((def_id, fn_args));
1713        }
1714
1715        // Handle the case where `self_place` gets reborrowed.
1716        // This happens when the receiver is `&T`.
1717        for stmt in &body[block].statements {
1718            if let StatementKind::Assign((place, rvalue)) = &stmt.kind
1719                && let Some(reborrow_local) = place.as_local()
1720                && self_place.as_local() == Some(reborrow_local)
1721                && let Rvalue::Ref(_, _, deref_place) = rvalue
1722                && let PlaceRef { local: deref_local, projection: [ProjectionElem::Deref] } =
1723                    deref_place.as_ref()
1724                && deref_local == local
1725            {
1726                return Some((def_id, fn_args));
1727            }
1728        }
1729    }
1730    None
1731}
1732
1733// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
1734#[cfg(target_pointer_width = "64")]
1735mod size_asserts {
1736    use rustc_data_structures::static_assert_size;
1737
1738    use super::*;
1739    // tidy-alphabetical-start
1740    const _: [(); 136] = [(); ::std::mem::size_of::<BasicBlockData<'_>>()];static_assert_size!(BasicBlockData<'_>, 136);
1741    const _: [(); 40] = [(); ::std::mem::size_of::<LocalDecl<'_>>()];static_assert_size!(LocalDecl<'_>, 40);
1742    const _: [(); 64] = [(); ::std::mem::size_of::<SourceScopeData<'_>>()];static_assert_size!(SourceScopeData<'_>, 64);
1743    const _: [(); 40] = [(); ::std::mem::size_of::<Statement<'_>>()];static_assert_size!(Statement<'_>, 40);
1744    const _: [(); 96] = [(); ::std::mem::size_of::<Terminator<'_>>()];static_assert_size!(Terminator<'_>, 96);
1745    const _: [(); 88] = [(); ::std::mem::size_of::<VarDebugInfo<'_>>()];static_assert_size!(VarDebugInfo<'_>, 88);
1746    // tidy-alphabetical-end
1747}