1use 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, GenericArgs, Instance, InstanceKind, List, ShimKind, Ty, TyCtxt,
36 TypeVisitableExt, TypingEnv, UserTypeAnnotationIndex,
37};
38
39pub mod basic_blocks;
40mod consts;
41pub mod coverage;
42mod generic_graph;
43pub mod graphviz;
44pub mod interpret;
45pub mod pretty;
46mod query;
47mod statement;
48mod syntax;
49mod terminator;
50pub mod traversal;
51pub mod visit;
52
53pub use consts::*;
54use pretty::pretty_print_const_value;
55pub use statement::*;
56pub use syntax::*;
57pub use terminator::*;
58
59pub use self::generic_graph::graphviz_safe_def_name;
60pub use self::graphviz::write_mir_graphviz;
61pub use self::pretty::{MirDumper, PassWhere, display_allocation, write_mir_pretty};
62
63pub type LocalDecls<'tcx> = IndexSlice<Local, LocalDecl<'tcx>>;
65
66pub trait HasLocalDecls<'tcx> {
67 fn local_decls(&self) -> &LocalDecls<'tcx>;
68}
69
70impl<'tcx> HasLocalDecls<'tcx> for IndexVec<Local, LocalDecl<'tcx>> {
71 #[inline]
72 fn local_decls(&self) -> &LocalDecls<'tcx> {
73 self
74 }
75}
76
77impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> {
78 #[inline]
79 fn local_decls(&self) -> &LocalDecls<'tcx> {
80 self
81 }
82}
83
84impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> {
85 #[inline]
86 fn local_decls(&self) -> &LocalDecls<'tcx> {
87 &self.local_decls
88 }
89}
90
91impl MirPhase {
92 pub fn name(&self) -> &'static str {
93 match *self {
94 MirPhase::Built => "built",
95 MirPhase::Analysis(AnalysisPhase::Initial) => "analysis",
96 MirPhase::Analysis(AnalysisPhase::PostCleanup) => "analysis-post-cleanup",
97 MirPhase::Runtime(RuntimePhase::Initial) => "runtime",
98 MirPhase::Runtime(RuntimePhase::PostCleanup) => "runtime-post-cleanup",
99 MirPhase::Runtime(RuntimePhase::Optimized) => "runtime-optimized",
100 }
101 }
102
103 pub fn index(&self) -> (usize, usize) {
106 match *self {
107 MirPhase::Built => (1, 1),
108 MirPhase::Analysis(analysis_phase) => (2, 1 + analysis_phase as usize),
109 MirPhase::Runtime(runtime_phase) => (3, 1 + runtime_phase as usize),
110 }
111 }
112}
113
114#[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 promoted", &self.instance, &&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)]
116#[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)]
117pub struct MirSource<'tcx> {
118 pub instance: InstanceKind<'tcx>,
119
120 pub promoted: Option<Promoted>,
122}
123
124impl<'tcx> MirSource<'tcx> {
125 pub fn item(def_id: DefId) -> Self {
126 MirSource { instance: InstanceKind::Item(def_id), promoted: None }
127 }
128
129 pub fn from_shim(shim: ShimKind<'tcx>) -> Self {
130 MirSource { instance: InstanceKind::Shim(shim), promoted: None }
131 }
132
133 #[inline]
134 pub fn def_id(&self) -> DefId {
135 self.instance.def_id()
136 }
137}
138
139#[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 _ =
"CoroutineInfo 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, 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)]
145pub struct CoroutineInfo<'tcx> {
146 pub yield_ty: Option<Ty<'tcx>>,
148
149 pub resume_ty: Option<Ty<'tcx>>,
151
152 pub coroutine_drop: Option<Body<'tcx>>,
154
155 pub coroutine_drop_async: Option<Body<'tcx>>,
157
158 pub coroutine_drop_proxy_async: Option<Body<'tcx>>,
160
161 pub coroutine_layout: Option<CoroutineLayout<'tcx>>,
163
164 pub coroutine_kind: CoroutineKind,
167}
168
169impl<'tcx> CoroutineInfo<'tcx> {
170 pub fn initial(
172 coroutine_kind: CoroutineKind,
173 yield_ty: Ty<'tcx>,
174 resume_ty: Ty<'tcx>,
175 ) -> CoroutineInfo<'tcx> {
176 CoroutineInfo {
177 coroutine_kind,
178 yield_ty: Some(yield_ty),
179 resume_ty: Some(resume_ty),
180 coroutine_drop: None,
181 coroutine_drop_async: None,
182 coroutine_drop_proxy_async: None,
183 coroutine_layout: None,
184 }
185 }
186}
187
188#[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_struct_field1_finish(f, "Fn",
&__self_0),
Self::Drop(__self_0) =>
::core::fmt::Formatter::debug_struct_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 target_ty", __self_0, &__self_1),
Self::Closure(__self_0) =>
::core::fmt::Formatter::debug_struct_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) {
match *self {
MentionedItem::Fn(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
MentionedItem::Drop(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
MentionedItem::UnsizeCast {
source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
2u8.stable_hash(__hcx, __hasher),
MentionedItem::Closure(ref __binding_0) =>
3u8.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)]
190#[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)]
191pub enum MentionedItem<'tcx> {
192 Fn(Ty<'tcx>),
195 Drop(Ty<'tcx>),
197 UnsizeCast { source_ty: Ty<'tcx>, target_ty: Ty<'tcx> },
199 Closure(Ty<'tcx>),
201}
202
203#[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 _ =
"Body 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, 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)]
205pub struct Body<'tcx> {
206 pub basic_blocks: BasicBlocks<'tcx>,
209
210 pub phase: MirPhase,
216
217 pub pass_count: usize,
219
220 pub source: MirSource<'tcx>,
221
222 pub source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
225
226 pub coroutine: Option<Box<CoroutineInfo<'tcx>>>,
233
234 pub local_decls: IndexVec<Local, LocalDecl<'tcx>>,
240
241 pub user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>,
243
244 pub arg_count: usize,
251
252 pub spread_arg: Option<Local>,
257
258 pub var_debug_info: Vec<VarDebugInfo<'tcx>>,
260
261 pub span: Span,
263
264 pub required_consts: Option<Vec<ConstOperand<'tcx>>>,
271
272 pub mentioned_items: Option<Vec<Spanned<MentionedItem<'tcx>>>>,
285
286 pub is_polymorphic: bool,
302
303 pub injection_phase: Option<MirPhase>,
309
310 pub tainted_by_errors: Option<ErrorGuaranteed>,
311
312 #[type_foldable(identity)]
318 #[type_visitable(ignore)]
319 pub coverage_early_info: Option<Box<coverage::CoverageEarlyInfo>>,
320
321 #[type_foldable(identity)]
328 #[type_visitable(ignore)]
329 pub coverage_mir_info: Option<Box<coverage::CoverageMirInfo>>,
330}
331
332impl<'tcx> Body<'tcx> {
333 pub fn new(
334 source: MirSource<'tcx>,
335 basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
336 source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
337 local_decls: IndexVec<Local, LocalDecl<'tcx>>,
338 user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>,
339 arg_count: usize,
340 var_debug_info: Vec<VarDebugInfo<'tcx>>,
341 span: Span,
342 coroutine: Option<Box<CoroutineInfo<'tcx>>>,
343 tainted_by_errors: Option<ErrorGuaranteed>,
344 ) -> Self {
345 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!(
347 local_decls.len() > arg_count,
348 "expected at least {} locals, got {}",
349 arg_count + 1,
350 local_decls.len()
351 );
352
353 let mut body = Body {
354 phase: MirPhase::Built,
355 pass_count: 0,
356 source,
357 basic_blocks: BasicBlocks::new(basic_blocks),
358 source_scopes,
359 coroutine,
360 local_decls,
361 user_type_annotations,
362 arg_count,
363 spread_arg: None,
364 var_debug_info,
365 span,
366 required_consts: None,
367 mentioned_items: None,
368 is_polymorphic: false,
369 injection_phase: None,
370 tainted_by_errors,
371 coverage_early_info: None,
372 coverage_mir_info: None,
373 };
374 body.is_polymorphic = body.has_non_region_param();
375 body
376 }
377
378 pub fn new_cfg_only(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>) -> Self {
384 let mut body = Body {
385 phase: MirPhase::Built,
386 pass_count: 0,
387 source: MirSource::item(CRATE_DEF_ID.to_def_id()),
388 basic_blocks: BasicBlocks::new(basic_blocks),
389 source_scopes: IndexVec::new(),
390 coroutine: None,
391 local_decls: IndexVec::new(),
392 user_type_annotations: IndexVec::new(),
393 arg_count: 0,
394 spread_arg: None,
395 span: DUMMY_SP,
396 required_consts: None,
397 mentioned_items: None,
398 var_debug_info: Vec::new(),
399 is_polymorphic: false,
400 injection_phase: None,
401 tainted_by_errors: None,
402 coverage_early_info: None,
403 coverage_mir_info: None,
404 };
405 body.is_polymorphic = body.has_non_region_param();
406 body
407 }
408
409 #[inline]
410 pub fn basic_blocks_mut(&mut self) -> &mut IndexVec<BasicBlock, BasicBlockData<'tcx>> {
411 self.basic_blocks.as_mut()
412 }
413
414 pub fn typing_env(&self, tcx: TyCtxt<'tcx>) -> TypingEnv<'tcx> {
415 if tcx.use_typing_mode_post_typeck_through_borrowck() {
416 match self.phase {
417 MirPhase::Built | MirPhase::Analysis(AnalysisPhase::Initial)
418 if let Some(def_id) = self.source.def_id().as_local() =>
419 {
420 TypingEnv::new(
421 tcx.param_env(self.source.def_id()),
422 ty::TypingMode::borrowck(tcx, def_id),
423 )
424 }
425 MirPhase::Analysis(AnalysisPhase::PostCleanup)
426 if let Some(def_id) = self.source.def_id().as_local() =>
427 {
428 TypingEnv::new(
429 tcx.param_env(self.source.def_id()),
430 ty::TypingMode::post_borrowck_analysis(tcx, def_id),
431 )
432 }
433 MirPhase::Built | MirPhase::Analysis(_) => {
434 TypingEnv::post_analysis(tcx, self.source.def_id())
438 }
439 MirPhase::Runtime(_) => TypingEnv::post_analysis(tcx, self.source.def_id()),
440 }
441 } else {
442 match self.phase {
443 MirPhase::Built | MirPhase::Analysis(_) => TypingEnv::new(
444 tcx.param_env(self.source.def_id()),
445 ty::TypingMode::non_body_analysis(),
446 ),
447 MirPhase::Runtime(_) => TypingEnv::post_analysis(tcx, self.source.def_id()),
448 }
449 }
450 }
451
452 #[inline]
453 pub fn local_kind(&self, local: Local) -> LocalKind {
454 let index = local.as_usize();
455 if index == 0 {
456 if true {
if !(self.local_decls[local].mutability == Mutability::Mut) {
{
::core::panicking::panic_fmt(format_args!("return place should be mutable"));
}
};
};debug_assert!(
457 self.local_decls[local].mutability == Mutability::Mut,
458 "return place should be mutable"
459 );
460
461 LocalKind::ReturnPointer
462 } else if index < self.arg_count + 1 {
463 LocalKind::Arg
464 } else {
465 LocalKind::Temp
466 }
467 }
468
469 #[inline]
471 pub fn mut_vars_iter(&self) -> impl Iterator<Item = Local> {
472 (self.arg_count + 1..self.local_decls.len()).filter_map(move |index| {
473 let local = Local::new(index);
474 let decl = &self.local_decls[local];
475 (decl.is_user_variable() && decl.mutability.is_mut()).then_some(local)
476 })
477 }
478
479 #[inline]
481 pub fn mut_vars_and_args_iter(&self) -> impl Iterator<Item = Local> {
482 (1..self.local_decls.len()).filter_map(move |index| {
483 let local = Local::new(index);
484 let decl = &self.local_decls[local];
485 if (decl.is_user_variable() || index < self.arg_count + 1)
486 && decl.mutability == Mutability::Mut
487 {
488 Some(local)
489 } else {
490 None
491 }
492 })
493 }
494
495 #[inline]
497 pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator + use<> {
498 (1..self.arg_count + 1).map(Local::new)
499 }
500
501 #[inline]
504 pub fn vars_and_temps_iter(
505 &self,
506 ) -> impl DoubleEndedIterator<Item = Local> + ExactSizeIterator {
507 (self.arg_count + 1..self.local_decls.len()).map(Local::new)
508 }
509
510 #[inline]
511 pub fn drain_vars_and_temps(&mut self) -> impl Iterator<Item = LocalDecl<'tcx>> {
512 self.local_decls.drain(self.arg_count + 1..)
513 }
514
515 pub fn source_info(&self, location: Location) -> &SourceInfo {
517 let block = &self[location.block];
518 let stmts = &block.statements;
519 let idx = location.statement_index;
520 if idx < stmts.len() {
521 &stmts[idx].source_info
522 } else {
523 {
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());
524 &block.terminator().source_info
525 }
526 }
527
528 #[inline]
530 pub fn return_ty(&self) -> Ty<'tcx> {
531 self.local_decls[RETURN_PLACE].ty
532 }
533
534 #[inline]
536 pub fn bound_return_ty(&self, tcx: TyCtxt<'tcx>) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
537 ty::EarlyBinder::bind(tcx, self.local_decls[RETURN_PLACE].ty)
538 }
539
540 #[inline]
542 pub fn terminator_loc(&self, bb: BasicBlock) -> Location {
543 Location { block: bb, statement_index: self[bb].statements.len() }
544 }
545
546 pub fn stmt_at(&self, location: Location) -> Either<&Statement<'tcx>, &Terminator<'tcx>> {
547 let Location { block, statement_index } = location;
548 let block_data = &self.basic_blocks[block];
549 block_data
550 .statements
551 .get(statement_index)
552 .map(Either::Left)
553 .unwrap_or_else(|| Either::Right(block_data.terminator()))
554 }
555
556 #[inline]
557 pub fn yield_ty(&self) -> Option<Ty<'tcx>> {
558 self.coroutine.as_ref().and_then(|coroutine| coroutine.yield_ty)
559 }
560
561 #[inline]
562 pub fn resume_ty(&self) -> Option<Ty<'tcx>> {
563 self.coroutine.as_ref().and_then(|coroutine| coroutine.resume_ty)
564 }
565
566 #[inline]
568 pub fn coroutine_layout_raw(&self) -> Option<&CoroutineLayout<'tcx>> {
569 self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_layout.as_ref())
570 }
571
572 #[inline]
573 pub fn coroutine_drop(&self) -> Option<&Body<'tcx>> {
574 self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_drop.as_ref())
575 }
576
577 #[inline]
578 pub fn coroutine_drop_async(&self) -> Option<&Body<'tcx>> {
579 self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_drop_async.as_ref())
580 }
581
582 #[inline]
583 pub fn coroutine_requires_async_drop(&self) -> bool {
584 self.coroutine_drop_async().is_some()
585 }
586
587 #[inline]
588 pub fn future_drop_poll(&self) -> Option<&Body<'tcx>> {
589 self.coroutine.as_ref().and_then(|coroutine| {
590 coroutine
591 .coroutine_drop_async
592 .as_ref()
593 .or(coroutine.coroutine_drop_proxy_async.as_ref())
594 })
595 }
596
597 #[inline]
598 pub fn coroutine_kind(&self) -> Option<CoroutineKind> {
599 self.coroutine.as_ref().map(|coroutine| coroutine.coroutine_kind)
600 }
601
602 #[inline]
603 pub fn should_skip(&self) -> bool {
604 let Some(injection_phase) = self.injection_phase else {
605 return false;
606 };
607 injection_phase > self.phase
608 }
609
610 #[inline]
611 pub fn is_custom_mir(&self) -> bool {
612 self.injection_phase.is_some()
613 }
614
615 fn try_const_mono_switchint<'a>(
619 tcx: TyCtxt<'tcx>,
620 instance: Instance<'tcx>,
621 block: &'a BasicBlockData<'tcx>,
622 ) -> Option<(u128, &'a SwitchTargets)> {
623 let eval_mono_const = |constant: &ConstOperand<'tcx>| {
625 let typing_env = ty::TypingEnv::fully_monomorphized();
627 let mono_literal = instance.instantiate_mir_and_normalize_erasing_regions(
628 tcx,
629 typing_env,
630 crate::ty::EarlyBinder::bind(tcx, constant.const_),
631 );
632 mono_literal.try_eval_bits(tcx, typing_env)
633 };
634
635 let TerminatorKind::SwitchInt { discr, targets } = &block.terminator().kind else {
636 return None;
637 };
638
639 let discr = match discr {
641 Operand::Constant(constant) => {
642 let bits = eval_mono_const(constant)?;
643 return Some((bits, targets));
644 }
645 Operand::RuntimeChecks(check) => {
646 let bits = check.value(tcx.sess) as u128;
647 return Some((bits, targets));
648 }
649 Operand::Move(place) | Operand::Copy(place) => place,
650 };
651
652 let last_stmt = block.statements.iter().rev().find(|stmt| {
668 !#[allow(non_exhaustive_omitted_patterns)] match stmt.kind {
StatementKind::StorageDead(_) | StatementKind::StorageLive(_) => true,
_ => false,
}matches!(stmt.kind, StatementKind::StorageDead(_) | StatementKind::StorageLive(_))
669 })?;
670
671 let (place, rvalue) = last_stmt.kind.as_assign()?;
672
673 if discr != place {
674 return None;
675 }
676
677 match rvalue {
678 Rvalue::Use(Operand::Constant(constant), _) => {
679 let bits = eval_mono_const(constant)?;
680 Some((bits, targets))
681 }
682 _ => None,
683 }
684 }
685
686 pub fn caller_location_span<T>(
691 &self,
692 mut source_info: SourceInfo,
693 caller_location: Option<T>,
694 tcx: TyCtxt<'tcx>,
695 from_span: impl FnOnce(Span) -> T,
696 ) -> T {
697 loop {
698 let scope_data = &self.source_scopes[source_info.scope];
699
700 if let Some((callee, callsite_span)) = scope_data.inlined {
701 if !callee.def.requires_caller_location(tcx) {
704 return from_span(source_info.span);
705 }
706 source_info.span = callsite_span;
707 }
708
709 match scope_data.inlined_parent_scope {
711 Some(parent) => source_info.scope = parent,
712 None => break,
713 }
714 }
715
716 caller_location.unwrap_or_else(|| from_span(source_info.span))
718 }
719
720 #[track_caller]
721 pub fn set_required_consts(&mut self, required_consts: Vec<ConstOperand<'tcx>>) {
722 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!(
723 self.required_consts.is_none(),
724 "required_consts for {:?} have already been set",
725 self.source.def_id()
726 );
727 self.required_consts = Some(required_consts);
728 }
729 #[track_caller]
730 pub fn required_consts(&self) -> &[ConstOperand<'tcx>] {
731 match &self.required_consts {
732 Some(l) => l,
733 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()),
734 }
735 }
736
737 #[track_caller]
738 pub fn set_mentioned_items(&mut self, mentioned_items: Vec<Spanned<MentionedItem<'tcx>>>) {
739 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!(
740 self.mentioned_items.is_none(),
741 "mentioned_items for {:?} have already been set",
742 self.source.def_id()
743 );
744 self.mentioned_items = Some(mentioned_items);
745 }
746 #[track_caller]
747 pub fn mentioned_items(&self) -> &[Spanned<MentionedItem<'tcx>>] {
748 match &self.mentioned_items {
749 Some(l) => l,
750 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()),
751 }
752 }
753}
754
755impl<'tcx> Index<BasicBlock> for Body<'tcx> {
756 type Output = BasicBlockData<'tcx>;
757
758 #[inline]
759 fn index(&self, index: BasicBlock) -> &BasicBlockData<'tcx> {
760 &self.basic_blocks[index]
761 }
762}
763
764impl<'tcx> IndexMut<BasicBlock> for Body<'tcx> {
765 #[inline]
766 fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx> {
767 &mut self.basic_blocks.as_mut()[index]
768 }
769}
770
771#[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_struct_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) {
match *self {
ClearCrossCrate::Clear => 0u8.stable_hash(__hcx, __hasher),
ClearCrossCrate::Set(ref __binding_0) =>
1u8.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)]
772pub enum ClearCrossCrate<T> {
773 Clear,
774 Set(T),
775}
776
777impl<T> ClearCrossCrate<T> {
778 pub fn as_ref(&self) -> ClearCrossCrate<&T> {
779 match self {
780 ClearCrossCrate::Clear => ClearCrossCrate::Clear,
781 ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
782 }
783 }
784
785 pub fn as_mut(&mut self) -> ClearCrossCrate<&mut T> {
786 match self {
787 ClearCrossCrate::Clear => ClearCrossCrate::Clear,
788 ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
789 }
790 }
791
792 pub fn unwrap_crate_local(self) -> T {
793 match self {
794 ClearCrossCrate::Clear => ::rustc_span::macros::bug_impl(None,
format_args!("unwrapping cross-crate data"), Location::caller())bug!("unwrapping cross-crate data"),
795 ClearCrossCrate::Set(v) => v,
796 }
797 }
798}
799
800const TAG_CLEAR_CROSS_CRATE_CLEAR: u8 = 0;
801const TAG_CLEAR_CROSS_CRATE_SET: u8 = 1;
802
803impl<'tcx, E: TyEncoder<'tcx>, T: Encodable<E>> Encodable<E> for ClearCrossCrate<T> {
804 #[inline]
805 fn encode(&self, e: &mut E) {
806 if E::CLEAR_CROSS_CRATE {
807 return;
808 }
809
810 match *self {
811 ClearCrossCrate::Clear => TAG_CLEAR_CROSS_CRATE_CLEAR.encode(e),
812 ClearCrossCrate::Set(ref val) => {
813 TAG_CLEAR_CROSS_CRATE_SET.encode(e);
814 val.encode(e);
815 }
816 }
817 }
818}
819impl<'tcx, D: TyDecoder<'tcx>, T: Decodable<D>> Decodable<D> for ClearCrossCrate<T> {
820 #[inline]
821 fn decode(d: &mut D) -> ClearCrossCrate<T> {
822 if D::CLEAR_CROSS_CRATE {
823 return ClearCrossCrate::Clear;
824 }
825
826 let discr = u8::decode(d);
827
828 match discr {
829 TAG_CLEAR_CROSS_CRATE_CLEAR => ClearCrossCrate::Clear,
830 TAG_CLEAR_CROSS_CRATE_SET => {
831 let val = T::decode(d);
832 ClearCrossCrate::Set(val)
833 }
834 tag => {
::core::panicking::panic_fmt(format_args!("Invalid tag for ClearCrossCrate: {0:?}",
tag));
}panic!("Invalid tag for ClearCrossCrate: {tag:?}"),
835 }
836 }
837}
838
839#[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 scope", &self.span, &&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)]
845pub struct SourceInfo {
846 pub span: Span,
848
849 pub scope: SourceScope,
852}
853
854impl SourceInfo {
855 #[inline]
856 pub fn outermost(span: Span) -> Self {
857 SourceInfo { span, scope: OUTERMOST_SOURCE_SCOPE }
858 }
859}
860
861#[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! {
865 #[stable_hash]
866 #[encodable]
867 #[orderable]
868 #[debug_format = "_{}"]
869 pub struct Local {
870 const RETURN_PLACE = 0;
871 }
872}
873
874impl Local {
875 pub const fn arg(i: usize) -> Local {
880 Local::from_usize(i + 1)
881 }
882}
883
884impl Atom for Local {
885 fn index(self) -> usize {
886 Idx::index(self)
887 }
888}
889
890#[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) {
match *self {
LocalKind::Temp => 0u8.stable_hash(__hcx, __hasher),
LocalKind::Arg => 1u8.stable_hash(__hcx, __hasher),
LocalKind::ReturnPointer =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
LocalKind::Temp => {}
LocalKind::Arg => {}
LocalKind::ReturnPointer => {}
}
}
}
};StableHash)]
892pub enum LocalKind {
893 Temp,
895 Arg,
897 ReturnPointer,
899}
900
901#[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 opt_ty_info opt_match_place pat_span introductions",
&self.binding_mode, &self.opt_ty_info, &self.opt_match_place,
&self.pat_span, &&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)]
902pub struct VarBindingForm<'tcx> {
903 pub binding_mode: BindingMode,
905 pub opt_ty_info: Option<Span>,
912 pub opt_match_place: Option<(Option<Place<'tcx>>, Span)>,
919 pub pat_span: Span,
921 pub introductions: Vec<VarBindingIntroduction>,
924}
925
926#[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_struct_field1_finish(f, "Var",
&__self_0),
Self::ImplicitSelf(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ImplicitSelf", &__self_0),
Self::RefForGuard(__self_0) =>
::core::fmt::Formatter::debug_struct_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) {
match *self {
BindingForm::Var(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
BindingForm::ImplicitSelf(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
BindingForm::RefForGuard(ref __binding_0) =>
2u8.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)]
927pub enum BindingForm<'tcx> {
928 Var(VarBindingForm<'tcx>),
930 ImplicitSelf(ImplicitSelfKind),
932 RefForGuard(Local),
934}
935
936#[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 is_shorthand", &self.span,
&&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)]
937pub struct VarBindingIntroduction {
938 pub span: Span,
940 pub is_shorthand: bool,
942}
943
944#[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 span",
&self.tail_result_is_ignored, &&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)]
953pub struct BlockTailInfo {
954 pub tail_result_is_ignored: bool,
960
961 pub span: Span,
963}
964
965#[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 local_info ty user_ty source_info",
&self.mutability, &self.local_info, &self.ty, &self.user_ty,
&&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)]
970pub struct LocalDecl<'tcx> {
971 pub mutability: Mutability,
975
976 pub local_info: ClearCrossCrate<Box<LocalInfo<'tcx>>>,
977
978 pub ty: Ty<'tcx>,
980
981 pub user_ty: Option<Box<UserTypeProjections>>,
986
987 pub source_info: SourceInfo,
1068}
1069
1070#[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_struct_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 is_thread_local", __self_0, &__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_struct_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) {
match *self {
LocalInfo::User(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
LocalInfo::StaticRef {
def_id: ref __binding_0, is_thread_local: ref __binding_1 }
=> 1u8.stable_hash(__hcx, __hasher),
LocalInfo::ConstRef { def_id: ref __binding_0 } =>
2u8.stable_hash(__hcx, __hasher),
LocalInfo::AggregateTemp =>
3u8.stable_hash(__hcx, __hasher),
LocalInfo::BlockTailTemp(ref __binding_0) =>
4u8.stable_hash(__hcx, __hasher),
LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
5u8.stable_hash(__hcx, __hasher),
LocalInfo::DerefTemp => 6u8.stable_hash(__hcx, __hasher),
LocalInfo::FakeBorrow => 7u8.stable_hash(__hcx, __hasher),
LocalInfo::Boring => 8u8.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)]
1077pub enum LocalInfo<'tcx> {
1078 User(BindingForm<'tcx>),
1084 StaticRef { def_id: DefId, is_thread_local: bool },
1086 ConstRef { def_id: DefId },
1088 AggregateTemp,
1091 BlockTailTemp(BlockTailInfo),
1094 IfThenRescopeTemp { if_then: HirId },
1097 DerefTemp,
1103 FakeBorrow,
1105 Boring,
1107}
1108
1109impl<'tcx> LocalDecl<'tcx> {
1110 pub fn local_info(&self) -> &LocalInfo<'tcx> {
1111 self.local_info.as_ref().unwrap_crate_local()
1112 }
1113
1114 pub fn can_be_made_mutable(&self) -> bool {
1121 #[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!(
1122 self.local_info(),
1123 LocalInfo::User(
1124 BindingForm::Var(VarBindingForm { binding_mode: BindingMode(ByRef::No, _), .. })
1125 | BindingForm::ImplicitSelf(ImplicitSelfKind::Imm),
1126 )
1127 )
1128 }
1129
1130 pub fn is_nonref_binding(&self) -> bool {
1134 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::User(BindingForm::Var(VarBindingForm {
binding_mode: BindingMode(ByRef::No, _), .. }) |
BindingForm::ImplicitSelf(_)) => true,
_ => false,
}matches!(
1135 self.local_info(),
1136 LocalInfo::User(
1137 BindingForm::Var(VarBindingForm { binding_mode: BindingMode(ByRef::No, _), .. })
1138 | BindingForm::ImplicitSelf(_),
1139 )
1140 )
1141 }
1142
1143 #[inline]
1146 pub fn is_user_variable(&self) -> bool {
1147 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::User(_) => true,
_ => false,
}matches!(self.local_info(), LocalInfo::User(_))
1148 }
1149
1150 pub fn is_ref_for_guard(&self) -> bool {
1154 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::User(BindingForm::RefForGuard(_)) => true,
_ => false,
}matches!(self.local_info(), LocalInfo::User(BindingForm::RefForGuard(_)))
1155 }
1156
1157 pub fn is_ref_to_static(&self) -> bool {
1160 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::StaticRef { .. } => true,
_ => false,
}matches!(self.local_info(), LocalInfo::StaticRef { .. })
1161 }
1162
1163 pub fn is_ref_to_thread_local(&self) -> bool {
1166 match self.local_info() {
1167 LocalInfo::StaticRef { is_thread_local, .. } => *is_thread_local,
1168 _ => false,
1169 }
1170 }
1171
1172 pub fn is_deref_temp(&self) -> bool {
1174 match self.local_info() {
1175 LocalInfo::DerefTemp => true,
1176 _ => false,
1177 }
1178 }
1179
1180 #[inline]
1183 pub fn from_compiler_desugaring(&self) -> bool {
1184 self.source_info.span.desugaring_kind().is_some()
1185 }
1186
1187 #[inline]
1189 pub fn new(ty: Ty<'tcx>, span: Span) -> Self {
1190 Self::with_source_info(ty, SourceInfo::outermost(span))
1191 }
1192
1193 #[inline]
1195 pub fn with_source_info(ty: Ty<'tcx>, source_info: SourceInfo) -> Self {
1196 LocalDecl {
1197 mutability: Mutability::Mut,
1198 local_info: ClearCrossCrate::Set(Box::new(LocalInfo::Boring)),
1199 ty,
1200 user_ty: None,
1201 source_info,
1202 }
1203 }
1204
1205 #[inline]
1207 pub fn immutable(mut self) -> Self {
1208 self.mutability = Mutability::Not;
1209 self
1210 }
1211}
1212
1213#[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) {
match *self {
VarDebugInfoContents::Place(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
VarDebugInfoContents::Const(ref __binding_0) =>
1u8.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)]
1214pub enum VarDebugInfoContents<'tcx> {
1215 Place(Place<'tcx>),
1217 Const(ConstOperand<'tcx>),
1218}
1219
1220impl<'tcx> Debug for VarDebugInfoContents<'tcx> {
1221 fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
1222 match self {
1223 VarDebugInfoContents::Const(c) => fmt.write_fmt(format_args!("{0}", c))write!(fmt, "{c}"),
1224 VarDebugInfoContents::Place(p) => fmt.write_fmt(format_args!("{0:?}", p))write!(fmt, "{p:?}"),
1225 }
1226 }
1227}
1228
1229#[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 projection", &self.ty, &&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)]
1230pub struct VarDebugInfoFragment<'tcx> {
1231 pub ty: Ty<'tcx>,
1234
1235 pub projection: Vec<PlaceElem<'tcx>>,
1245}
1246
1247#[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)]
1249pub struct VarDebugInfo<'tcx> {
1250 pub name: Symbol,
1251
1252 pub source_info: SourceInfo,
1256
1257 pub composite: Option<Box<VarDebugInfoFragment<'tcx>>>,
1263
1264 pub value: VarDebugInfoContents<'tcx>,
1266
1267 pub argument_index: Option<u16>,
1271}
1272
1273#[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! {
1277 #[stable_hash]
1300 #[encodable]
1301 #[orderable]
1302 #[debug_format = "bb{}"]
1303 pub struct BasicBlock {
1304 const START_BLOCK = 0;
1305 }
1306}
1307
1308impl BasicBlock {
1309 #[inline]
1310 pub fn start_location(self) -> Location {
1311 Location { block: self, statement_index: 0 }
1312 }
1313}
1314
1315#[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 after_last_stmt_debuginfos terminator is_cleanup",
&self.statements, &self.after_last_stmt_debuginfos,
&self.terminator, &&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)]
1322#[non_exhaustive]
1323pub struct BasicBlockData<'tcx> {
1324 pub statements: Vec<Statement<'tcx>>,
1326
1327 pub after_last_stmt_debuginfos: StmtDebugInfos<'tcx>,
1330
1331 pub terminator: Option<Terminator<'tcx>>,
1340
1341 pub is_cleanup: bool,
1346}
1347
1348impl<'tcx> BasicBlockData<'tcx> {
1349 pub fn new(terminator: Terminator<'tcx>, is_cleanup: bool) -> BasicBlockData<'tcx> {
1350 BasicBlockData::new_stmts(Vec::new(), terminator, is_cleanup)
1351 }
1352
1353 pub fn new_stmts(
1354 statements: Vec<Statement<'tcx>>,
1355 terminator: Terminator<'tcx>,
1356 is_cleanup: bool,
1357 ) -> BasicBlockData<'tcx> {
1358 BasicBlockData {
1359 statements,
1360 after_last_stmt_debuginfos: StmtDebugInfos::default(),
1361 terminator: Some(terminator),
1362 is_cleanup,
1363 }
1364 }
1365
1366 pub fn maybe_unterminated(
1368 terminator: Option<Terminator<'tcx>>,
1369 is_cleanup: bool,
1370 ) -> BasicBlockData<'tcx> {
1371 BasicBlockData::maybe_unterminated_stmts(Vec::new(), terminator, is_cleanup)
1372 }
1373
1374 pub fn maybe_unterminated_stmts(
1376 statements: Vec<Statement<'tcx>>,
1377 terminator: Option<Terminator<'tcx>>,
1378 is_cleanup: bool,
1379 ) -> BasicBlockData<'tcx> {
1380 BasicBlockData {
1381 statements,
1382 after_last_stmt_debuginfos: StmtDebugInfos::default(),
1383 terminator,
1384 is_cleanup,
1385 }
1386 }
1387
1388 #[inline]
1393 pub fn terminator(&self) -> &Terminator<'tcx> {
1394 self.terminator.as_ref().expect("invalid terminator state")
1395 }
1396
1397 #[inline]
1398 pub fn terminator_mut(&mut self) -> &mut Terminator<'tcx> {
1399 self.terminator.as_mut().expect("invalid terminator state")
1400 }
1401
1402 #[inline]
1404 pub fn is_empty_unreachable(&self) -> bool {
1405 self.statements.is_empty() && #[allow(non_exhaustive_omitted_patterns)] match self.terminator().kind {
TerminatorKind::Unreachable => true,
_ => false,
}matches!(self.terminator().kind, TerminatorKind::Unreachable)
1406 }
1407
1408 pub fn mono_successors(&self, tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> Successors<'_> {
1414 if let Some((bits, targets)) = Body::try_const_mono_switchint(tcx, instance, self) {
1415 targets.successors_for_value(bits)
1416 } else {
1417 self.terminator().successors()
1418 }
1419 }
1420
1421 pub fn retain_statements<F>(&mut self, mut f: F)
1422 where
1423 F: FnMut(&Statement<'tcx>) -> bool,
1424 {
1425 let mut debuginfos = StmtDebugInfos::default();
1428 self.statements.retain_mut(|stmt| {
1429 let retain = f(stmt);
1430 if retain {
1431 stmt.debuginfos.prepend(&mut debuginfos);
1432 } else {
1433 debuginfos.append(&mut stmt.debuginfos);
1434 }
1435 retain
1436 });
1437 self.after_last_stmt_debuginfos.prepend(&mut debuginfos);
1438 }
1439
1440 pub fn strip_nops(&mut self) {
1441 self.retain_statements(|stmt| !#[allow(non_exhaustive_omitted_patterns)] match stmt.kind {
StatementKind::Nop => true,
_ => false,
}matches!(stmt.kind, StatementKind::Nop))
1442 }
1443
1444 pub fn drop_debuginfo(&mut self) {
1445 self.after_last_stmt_debuginfos.drop_debuginfo();
1446 for stmt in self.statements.iter_mut() {
1447 stmt.debuginfos.drop_debuginfo();
1448 }
1449 }
1450}
1451
1452#[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! {
1456 #[stable_hash]
1457 #[encodable]
1458 #[debug_format = "scope[{}]"]
1459 pub struct SourceScope {
1460 const OUTERMOST_SOURCE_SCOPE = 0;
1461 }
1462}
1463
1464impl SourceScope {
1465 pub fn lint_root(
1469 self,
1470 source_scopes: &IndexSlice<SourceScope, SourceScopeData<'_>>,
1471 ) -> Option<HirId> {
1472 let mut data = &source_scopes[self];
1473 while data.inlined.is_some() {
1476 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/ac8310ba643a3796cbe77d2e06944d7c8513999f/compiler/rustc_middle/src/mir/mod.rs:1476",
"rustc_middle::mir", ::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/ac8310ba643a3796cbe77d2e06944d7c8513999f/compiler/rustc_middle/src/mir/mod.rs"),
::tracing_core::__macro_support::Option::Some(1476u32),
::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);
1477 data = &source_scopes[data.parent_scope.unwrap()];
1478 }
1479 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/ac8310ba643a3796cbe77d2e06944d7c8513999f/compiler/rustc_middle/src/mir/mod.rs:1479",
"rustc_middle::mir", ::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/ac8310ba643a3796cbe77d2e06944d7c8513999f/compiler/rustc_middle/src/mir/mod.rs"),
::tracing_core::__macro_support::Option::Some(1479u32),
::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);
1480 match &data.local_data {
1481 ClearCrossCrate::Set(data) => Some(data.lint_root),
1482 ClearCrossCrate::Clear => None,
1483 }
1484 }
1485
1486 #[inline]
1488 pub fn inlined_instance<'tcx>(
1489 self,
1490 source_scopes: &IndexSlice<SourceScope, SourceScopeData<'tcx>>,
1491 ) -> Option<ty::Instance<'tcx>> {
1492 let scope_data = &source_scopes[self];
1493 if let Some((inlined_instance, _)) = scope_data.inlined {
1494 Some(inlined_instance)
1495 } else if let Some(inlined_scope) = scope_data.inlined_parent_scope {
1496 Some(source_scopes[inlined_scope].inlined.unwrap().0)
1497 } else {
1498 None
1499 }
1500 }
1501}
1502
1503#[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 parent_scope inlined inlined_parent_scope local_data",
&self.span, &self.parent_scope, &self.inlined,
&self.inlined_parent_scope, &&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)]
1504pub struct SourceScopeData<'tcx> {
1505 pub span: Span,
1506 pub parent_scope: Option<SourceScope>,
1507
1508 pub inlined: Option<(ty::Instance<'tcx>, Span)>,
1512
1513 pub inlined_parent_scope: Option<SourceScope>,
1517
1518 pub local_data: ClearCrossCrate<SourceScopeLocalData>,
1521}
1522
1523#[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)]
1524pub struct SourceScopeLocalData {
1525 pub lint_root: HirId,
1527}
1528
1529#[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)]
1562pub struct UserTypeProjections {
1563 pub contents: Vec<UserTypeProjection>,
1564}
1565
1566impl UserTypeProjections {
1567 pub fn projections(&self) -> impl Iterator<Item = &UserTypeProjection> + ExactSizeIterator {
1568 self.contents.iter()
1569 }
1570}
1571
1572#[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 projs", &self.base, &&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)]
1588#[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)]
1589pub struct UserTypeProjection {
1590 pub base: UserTypeAnnotationIndex,
1591 pub projs: Vec<ProjectionKind>,
1592}
1593
1594#[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! {
1595 #[stable_hash]
1596 #[encodable]
1597 #[orderable]
1598 #[debug_format = "promoted[{}]"]
1599 pub struct Promoted {}
1600}
1601
1602#[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)]
1606pub struct Location {
1607 pub block: BasicBlock,
1609
1610 pub statement_index: usize,
1611}
1612
1613impl fmt::Debug for Location {
1614 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1615 fmt.write_fmt(format_args!("{0:?}[{1}]", self.block, self.statement_index))write!(fmt, "{:?}[{}]", self.block, self.statement_index)
1616 }
1617}
1618
1619impl Location {
1620 pub const START: Location = Location { block: START_BLOCK, statement_index: 0 };
1621
1622 #[inline]
1627 pub fn successor_within_block(&self) -> Location {
1628 Location { block: self.block, statement_index: self.statement_index + 1 }
1629 }
1630
1631 pub fn is_predecessor_of<'tcx>(&self, other: Location, body: &Body<'tcx>) -> bool {
1633 if self.block == other.block && self.statement_index < other.statement_index {
1636 return true;
1637 }
1638
1639 let predecessors = body.basic_blocks.predecessors();
1640
1641 let mut queue: Vec<BasicBlock> = predecessors[other.block].to_vec();
1643 let mut visited = FxHashSet::default();
1644
1645 while let Some(block) = queue.pop() {
1646 if visited.insert(block) {
1648 queue.extend(predecessors[block].iter().cloned());
1649 } else {
1650 continue;
1651 }
1652
1653 if self.block == block {
1656 return true;
1657 }
1658 }
1659
1660 false
1661 }
1662
1663 #[inline]
1664 pub fn dominates(&self, other: Location, dominators: &Dominators<BasicBlock>) -> bool {
1665 if self.block == other.block {
1666 self.statement_index <= other.statement_index
1667 } else {
1668 dominators.dominates(self.block, other.block)
1669 }
1670 }
1671
1672 #[inline]
1673 pub fn strictly_dominates(&self, other: Location, dominators: &Dominators<BasicBlock>) -> bool {
1674 self.block != other.block && dominators.strictly_dominates(self.block, other.block)
1675 }
1676}
1677
1678#[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_struct_field1_finish(f,
"Assignment", &__self_0),
Self::CallReturn { call: __self_0, target: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"CallReturn call target", __self_0, &__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)]
1681pub enum DefLocation {
1682 Argument,
1683 Assignment(Location),
1684 CallReturn { call: BasicBlock, target: Option<BasicBlock> },
1685}
1686
1687impl DefLocation {
1688 #[inline]
1689 pub fn dominates(self, location: Location, dominators: &Dominators<BasicBlock>) -> bool {
1690 match self {
1691 DefLocation::Argument => true,
1692 DefLocation::Assignment(def) => {
1693 def.successor_within_block().dominates(location, dominators)
1694 }
1695 DefLocation::CallReturn { target: None, .. } => false,
1696 DefLocation::CallReturn { call, target: Some(target) } => {
1697 call != target
1704 && dominators.dominates(call, target)
1705 && dominators.dominates(target, location.block)
1706 }
1707 }
1708 }
1709}
1710
1711pub fn find_self_call<'tcx>(
1715 tcx: TyCtxt<'tcx>,
1716 body: &Body<'tcx>,
1717 local: Local,
1718 block: BasicBlock,
1719) -> Option<(DefId, GenericArgs<'tcx>)> {
1720 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/ac8310ba643a3796cbe77d2e06944d7c8513999f/compiler/rustc_middle/src/mir/mod.rs:1720",
"rustc_middle::mir", ::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/ac8310ba643a3796cbe77d2e06944d7c8513999f/compiler/rustc_middle/src/mir/mod.rs"),
::tracing_core::__macro_support::Option::Some(1720u32),
::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);
1721 if let Some(Terminator { kind: TerminatorKind::Call { func, args, .. }, .. }) =
1722 &body[block].terminator
1723 && let Operand::Constant(ConstOperand { const_, .. }) = func
1724 && let ty::FnDef(def_id, fn_args) = *const_.ty().kind()
1725 && let Some(item) = tcx.opt_associated_item(def_id)
1726 && item.is_method()
1727 && let [Spanned { node: Operand::Move(self_place) | Operand::Copy(self_place), .. }, ..] =
1728 **args
1729 {
1730 let fn_args = fn_args.no_bound_vars().unwrap();
1731
1732 if self_place.as_local() == Some(local) {
1733 return Some((def_id, fn_args));
1734 }
1735
1736 for stmt in &body[block].statements {
1739 if let StatementKind::Assign((place, rvalue)) = &stmt.kind
1740 && let Some(reborrow_local) = place.as_local()
1741 && self_place.as_local() == Some(reborrow_local)
1742 && let Rvalue::Ref(_, _, deref_place) = rvalue
1743 && let PlaceRef { local: deref_local, projection: [ProjectionElem::Deref] } =
1744 deref_place.as_ref()
1745 && deref_local == local
1746 {
1747 return Some((def_id, fn_args));
1748 }
1749 }
1750 }
1751 None
1752}
1753
1754#[cfg(target_pointer_width = "64")]
1756mod size_asserts {
1757 use rustc_data_structures::static_assert_size;
1758
1759 use super::*;
1760 const _: [(); 136] = [(); ::std::mem::size_of::<BasicBlockData<'_>>()];static_assert_size!(BasicBlockData<'_>, 136);
1762 const _: [(); 40] = [(); ::std::mem::size_of::<LocalDecl<'_>>()];static_assert_size!(LocalDecl<'_>, 40);
1763 const _: [(); 64] = [(); ::std::mem::size_of::<SourceScopeData<'_>>()];static_assert_size!(SourceScopeData<'_>, 64);
1764 const _: [(); 40] = [(); ::std::mem::size_of::<Statement<'_>>()];static_assert_size!(Statement<'_>, 40);
1765 const _: [(); 96] = [(); ::std::mem::size_of::<Terminator<'_>>()];static_assert_size!(Terminator<'_>, 96);
1766 const _: [(); 88] = [(); ::std::mem::size_of::<VarDebugInfo<'_>>()];static_assert_size!(VarDebugInfo<'_>, 88);
1767 }