1use std::borrow::Cow;
6use std::fmt::{self, Debug, Formatter};
7use std::iter;
8use std::ops::{Index, IndexMut};
9
10pub use basic_blocks::{BasicBlocks, SwitchTargetValue};
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::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagArg};
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::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
26use rustc_serialize::{Decodable, Encodable};
27use rustc_span::source_map::Spanned;
28use rustc_span::{DUMMY_SP, Span, Symbol};
29use tracing::{debug, trace};
30
31pub use self::query::*;
32use crate::mir::interpret::{AllocRange, Scalar};
33use crate::ty::codec::{TyDecoder, TyEncoder};
34use crate::ty::print::{FmtPrinter, Printer, pretty_print_const, with_no_trimmed_paths};
35use crate::ty::{
36 self, GenericArg, GenericArgsRef, Instance, InstanceKind, List, Ty, TyCtxt, TypeVisitableExt,
37 TypingEnv, UserTypeAnnotationIndex,
38};
39
40mod basic_blocks;
41mod consts;
42pub mod coverage;
43mod generic_graph;
44pub mod generic_graphviz;
45pub mod graphviz;
46pub mod interpret;
47pub mod mono;
48pub mod pretty;
49mod query;
50mod statement;
51mod syntax;
52mod terminator;
53
54pub mod loops;
55pub mod traversal;
56pub mod visit;
57
58pub use consts::*;
59use pretty::pretty_print_const_value;
60pub use statement::*;
61pub use syntax::*;
62pub use terminator::*;
63
64pub use self::generic_graph::graphviz_safe_def_name;
65pub use self::graphviz::write_mir_graphviz;
66pub use self::pretty::{MirDumper, PassWhere, display_allocation, write_mir_pretty};
67
68pub type LocalDecls<'tcx> = IndexSlice<Local, LocalDecl<'tcx>>;
70
71pub trait HasLocalDecls<'tcx> {
72 fn local_decls(&self) -> &LocalDecls<'tcx>;
73}
74
75impl<'tcx> HasLocalDecls<'tcx> for IndexVec<Local, LocalDecl<'tcx>> {
76 #[inline]
77 fn local_decls(&self) -> &LocalDecls<'tcx> {
78 self
79 }
80}
81
82impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> {
83 #[inline]
84 fn local_decls(&self) -> &LocalDecls<'tcx> {
85 self
86 }
87}
88
89impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> {
90 #[inline]
91 fn local_decls(&self) -> &LocalDecls<'tcx> {
92 &self.local_decls
93 }
94}
95
96impl MirPhase {
97 pub fn name(&self) -> &'static str {
98 match *self {
99 MirPhase::Built => "built",
100 MirPhase::Analysis(AnalysisPhase::Initial) => "analysis",
101 MirPhase::Analysis(AnalysisPhase::PostCleanup) => "analysis-post-cleanup",
102 MirPhase::Runtime(RuntimePhase::Initial) => "runtime",
103 MirPhase::Runtime(RuntimePhase::PostCleanup) => "runtime-post-cleanup",
104 MirPhase::Runtime(RuntimePhase::Optimized) => "runtime-optimized",
105 }
106 }
107
108 pub fn index(&self) -> (usize, usize) {
111 match *self {
112 MirPhase::Built => (1, 1),
113 MirPhase::Analysis(analysis_phase) => (2, 1 + analysis_phase as usize),
114 MirPhase::Runtime(runtime_phase) => (3, 1 + runtime_phase as usize),
115 }
116 }
117}
118
119#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for MirSource<'tcx> { }Copy, #[automatically_derived]
impl<'tcx> ::core::clone::Clone for MirSource<'tcx> {
#[inline]
fn clone(&self) -> MirSource<'tcx> {
let _: ::core::clone::AssertParamIsClone<InstanceKind<'tcx>>;
let _: ::core::clone::AssertParamIsClone<Option<Promoted>>;
*self
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for MirSource<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "MirSource",
"instance", &self.instance, "promoted", &&self.promoted)
}
}Debug, #[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for MirSource<'tcx> {
#[inline]
fn eq(&self, other: &MirSource<'tcx>) -> 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_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<InstanceKind<'tcx>>;
let _: ::core::cmp::AssertParamIsEq<Option<Promoted>>;
}
}Eq)]
121#[derive(const _: () =
{
impl<'tcx, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for MirSource<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
MirSource {
instance: ref __binding_0, promoted: ref __binding_1 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for MirSource<'tcx> {
fn encode(&self, __encoder: &mut __E) {
match *self {
MirSource {
instance: ref __binding_0, promoted: ref __binding_1 } => {
::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)]
122pub struct MirSource<'tcx> {
123 pub instance: InstanceKind<'tcx>,
124
125 pub promoted: Option<Promoted>,
127}
128
129impl<'tcx> MirSource<'tcx> {
130 pub fn item(def_id: DefId) -> Self {
131 MirSource { instance: InstanceKind::Item(def_id), promoted: None }
132 }
133
134 pub fn from_instance(instance: InstanceKind<'tcx>) -> Self {
135 MirSource { instance, promoted: None }
136 }
137
138 #[inline]
139 pub fn def_id(&self) -> DefId {
140 self.instance.def_id()
141 }
142}
143
144#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for CoroutineInfo<'tcx> {
#[inline]
fn clone(&self) -> CoroutineInfo<'tcx> {
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) {
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 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_5,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_6,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for CoroutineInfo<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
CoroutineInfo {
yield_ty: ::rustc_serialize::Decodable::decode(__decoder),
resume_ty: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_drop: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_drop_async: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_drop_proxy_async: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_layout: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_kind: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for CoroutineInfo<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["yield_ty", "resume_ty", "coroutine_drop",
"coroutine_drop_async", "coroutine_drop_proxy_async",
"coroutine_layout", "coroutine_kind"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.yield_ty, &self.resume_ty, &self.coroutine_drop,
&self.coroutine_drop_async,
&self.coroutine_drop_proxy_async, &self.coroutine_layout,
&&self.coroutine_kind];
::core::fmt::Formatter::debug_struct_fields_finish(f, "CoroutineInfo",
names, values)
}
}Debug, const _: () =
{
impl<'tcx, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for CoroutineInfo<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
{ __binding_2.hash_stable(__hcx, __hasher); }
{ __binding_3.hash_stable(__hcx, __hasher); }
{ __binding_4.hash_stable(__hcx, __hasher); }
{ __binding_5.hash_stable(__hcx, __hasher); }
{ __binding_6.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
150pub struct CoroutineInfo<'tcx> {
151 pub yield_ty: Option<Ty<'tcx>>,
153
154 pub resume_ty: Option<Ty<'tcx>>,
156
157 pub coroutine_drop: Option<Body<'tcx>>,
159
160 pub coroutine_drop_async: Option<Body<'tcx>>,
162
163 pub coroutine_drop_proxy_async: Option<Body<'tcx>>,
165
166 pub coroutine_layout: Option<CoroutineLayout<'tcx>>,
168
169 pub coroutine_kind: CoroutineKind,
172}
173
174impl<'tcx> CoroutineInfo<'tcx> {
175 pub fn initial(
177 coroutine_kind: CoroutineKind,
178 yield_ty: Ty<'tcx>,
179 resume_ty: Ty<'tcx>,
180 ) -> CoroutineInfo<'tcx> {
181 CoroutineInfo {
182 coroutine_kind,
183 yield_ty: Some(yield_ty),
184 resume_ty: Some(resume_ty),
185 coroutine_drop: None,
186 coroutine_drop_async: None,
187 coroutine_drop_proxy_async: None,
188 coroutine_layout: None,
189 }
190 }
191}
192
193#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for MentionedItem<'tcx> { }Copy, #[automatically_derived]
impl<'tcx> ::core::clone::Clone for MentionedItem<'tcx> {
#[inline]
fn clone(&self) -> MentionedItem<'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>>;
let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
*self
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for MentionedItem<'tcx> {
#[inline]
fn eq(&self, other: &MentionedItem<'tcx>) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(MentionedItem::Fn(__self_0), MentionedItem::Fn(__arg1_0)) =>
__self_0 == __arg1_0,
(MentionedItem::Drop(__self_0), MentionedItem::Drop(__arg1_0))
=> __self_0 == __arg1_0,
(MentionedItem::UnsizeCast {
source_ty: __self_0, target_ty: __self_1 },
MentionedItem::UnsizeCast {
source_ty: __arg1_0, target_ty: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(MentionedItem::Closure(__self_0),
MentionedItem::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_receiver_is_total_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 {
MentionedItem::Fn(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Fn",
&__self_0),
MentionedItem::Drop(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Drop",
&__self_0),
MentionedItem::UnsizeCast {
source_ty: __self_0, target_ty: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"UnsizeCast", "source_ty", __self_0, "target_ty",
&__self_1),
MentionedItem::Closure(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Closure", &__self_0),
}
}
}Debug, #[automatically_derived]
impl<'tcx> ::core::hash::Hash for MentionedItem<'tcx> {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state);
match self {
MentionedItem::Fn(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
MentionedItem::Drop(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
MentionedItem::UnsizeCast {
source_ty: __self_0, target_ty: __self_1 } => {
::core::hash::Hash::hash(__self_0, state);
::core::hash::Hash::hash(__self_1, state)
}
MentionedItem::Closure(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
}
}
}Hash, const _: () =
{
impl<'tcx, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for MentionedItem<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
MentionedItem::Fn(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
MentionedItem::Drop(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
MentionedItem::UnsizeCast {
source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
{
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
MentionedItem::Closure(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
195#[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)]
196pub enum MentionedItem<'tcx> {
197 Fn(Ty<'tcx>),
200 Drop(Ty<'tcx>),
202 UnsizeCast { source_ty: Ty<'tcx>, target_ty: Ty<'tcx> },
204 Closure(Ty<'tcx>),
206}
207
208#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for Body<'tcx> {
#[inline]
fn clone(&self) -> Body<'tcx> {
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_info_hi: ::core::clone::Clone::clone(&self.coverage_info_hi),
function_coverage_info: ::core::clone::Clone::clone(&self.function_coverage_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) {
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_info_hi: ref __binding_17,
function_coverage_info: ref __binding_18 } => {
::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_info_hi: ::rustc_serialize::Decodable::decode(__decoder),
function_coverage_info: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for Body<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["basic_blocks", "phase", "pass_count", "source",
"source_scopes", "coroutine", "local_decls",
"user_type_annotations", "arg_count", "spread_arg",
"var_debug_info", "span", "required_consts",
"mentioned_items", "is_polymorphic", "injection_phase",
"tainted_by_errors", "coverage_info_hi",
"function_coverage_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_info_hi,
&&self.function_coverage_info];
::core::fmt::Formatter::debug_struct_fields_finish(f, "Body", names,
values)
}
}Debug, const _: () =
{
impl<'tcx, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for Body<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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_info_hi: ref __binding_17,
function_coverage_info: ref __binding_18 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
{ __binding_2.hash_stable(__hcx, __hasher); }
{ __binding_3.hash_stable(__hcx, __hasher); }
{ __binding_4.hash_stable(__hcx, __hasher); }
{ __binding_5.hash_stable(__hcx, __hasher); }
{ __binding_6.hash_stable(__hcx, __hasher); }
{ __binding_7.hash_stable(__hcx, __hasher); }
{ __binding_8.hash_stable(__hcx, __hasher); }
{ __binding_9.hash_stable(__hcx, __hasher); }
{ __binding_10.hash_stable(__hcx, __hasher); }
{ __binding_11.hash_stable(__hcx, __hasher); }
{ __binding_12.hash_stable(__hcx, __hasher); }
{ __binding_13.hash_stable(__hcx, __hasher); }
{ __binding_14.hash_stable(__hcx, __hasher); }
{ __binding_15.hash_stable(__hcx, __hasher); }
{ __binding_16.hash_stable(__hcx, __hasher); }
{ __binding_17.hash_stable(__hcx, __hasher); }
{ __binding_18.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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_info_hi: __binding_17,
function_coverage_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_info_hi: __binding_17,
function_coverage_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_info_hi: __binding_17,
function_coverage_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_info_hi: __binding_17,
function_coverage_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)]
210pub struct Body<'tcx> {
211 pub basic_blocks: BasicBlocks<'tcx>,
214
215 pub phase: MirPhase,
221
222 pub pass_count: usize,
224
225 pub source: MirSource<'tcx>,
226
227 pub source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
230
231 pub coroutine: Option<Box<CoroutineInfo<'tcx>>>,
238
239 pub local_decls: IndexVec<Local, LocalDecl<'tcx>>,
245
246 pub user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>,
248
249 pub arg_count: usize,
256
257 pub spread_arg: Option<Local>,
262
263 pub var_debug_info: Vec<VarDebugInfo<'tcx>>,
265
266 pub span: Span,
268
269 pub required_consts: Option<Vec<ConstOperand<'tcx>>>,
276
277 pub mentioned_items: Option<Vec<Spanned<MentionedItem<'tcx>>>>,
290
291 pub is_polymorphic: bool,
307
308 pub injection_phase: Option<MirPhase>,
314
315 pub tainted_by_errors: Option<ErrorGuaranteed>,
316
317 #[type_foldable(identity)]
323 #[type_visitable(ignore)]
324 pub coverage_info_hi: Option<Box<coverage::CoverageInfoHi>>,
325
326 #[type_foldable(identity)]
333 #[type_visitable(ignore)]
334 pub function_coverage_info: Option<Box<coverage::FunctionCoverageInfo>>,
335}
336
337impl<'tcx> Body<'tcx> {
338 pub fn new(
339 source: MirSource<'tcx>,
340 basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
341 source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
342 local_decls: IndexVec<Local, LocalDecl<'tcx>>,
343 user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>,
344 arg_count: usize,
345 var_debug_info: Vec<VarDebugInfo<'tcx>>,
346 span: Span,
347 coroutine: Option<Box<CoroutineInfo<'tcx>>>,
348 tainted_by_errors: Option<ErrorGuaranteed>,
349 ) -> Self {
350 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!(
352 local_decls.len() > arg_count,
353 "expected at least {} locals, got {}",
354 arg_count + 1,
355 local_decls.len()
356 );
357
358 let mut body = Body {
359 phase: MirPhase::Built,
360 pass_count: 0,
361 source,
362 basic_blocks: BasicBlocks::new(basic_blocks),
363 source_scopes,
364 coroutine,
365 local_decls,
366 user_type_annotations,
367 arg_count,
368 spread_arg: None,
369 var_debug_info,
370 span,
371 required_consts: None,
372 mentioned_items: None,
373 is_polymorphic: false,
374 injection_phase: None,
375 tainted_by_errors,
376 coverage_info_hi: None,
377 function_coverage_info: None,
378 };
379 body.is_polymorphic = body.has_non_region_param();
380 body
381 }
382
383 pub fn new_cfg_only(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>) -> Self {
389 let mut body = Body {
390 phase: MirPhase::Built,
391 pass_count: 0,
392 source: MirSource::item(CRATE_DEF_ID.to_def_id()),
393 basic_blocks: BasicBlocks::new(basic_blocks),
394 source_scopes: IndexVec::new(),
395 coroutine: None,
396 local_decls: IndexVec::new(),
397 user_type_annotations: IndexVec::new(),
398 arg_count: 0,
399 spread_arg: None,
400 span: DUMMY_SP,
401 required_consts: None,
402 mentioned_items: None,
403 var_debug_info: Vec::new(),
404 is_polymorphic: false,
405 injection_phase: None,
406 tainted_by_errors: None,
407 coverage_info_hi: None,
408 function_coverage_info: None,
409 };
410 body.is_polymorphic = body.has_non_region_param();
411 body
412 }
413
414 #[inline]
415 pub fn basic_blocks_mut(&mut self) -> &mut IndexVec<BasicBlock, BasicBlockData<'tcx>> {
416 self.basic_blocks.as_mut()
417 }
418
419 pub fn typing_env(&self, tcx: TyCtxt<'tcx>) -> TypingEnv<'tcx> {
420 match self.phase {
421 MirPhase::Built | MirPhase::Analysis(_) => TypingEnv {
423 typing_mode: ty::TypingMode::non_body_analysis(),
424 param_env: tcx.param_env(self.source.def_id()),
425 },
426 MirPhase::Runtime(_) => TypingEnv::post_analysis(tcx, self.source.def_id()),
427 }
428 }
429
430 #[inline]
431 pub fn local_kind(&self, local: Local) -> LocalKind {
432 let index = local.as_usize();
433 if index == 0 {
434 if true {
if !(self.local_decls[local].mutability == Mutability::Mut) {
{
::core::panicking::panic_fmt(format_args!("return place should be mutable"));
}
};
};debug_assert!(
435 self.local_decls[local].mutability == Mutability::Mut,
436 "return place should be mutable"
437 );
438
439 LocalKind::ReturnPointer
440 } else if index < self.arg_count + 1 {
441 LocalKind::Arg
442 } else {
443 LocalKind::Temp
444 }
445 }
446
447 #[inline]
449 pub fn mut_vars_iter(&self) -> impl Iterator<Item = Local> {
450 (self.arg_count + 1..self.local_decls.len()).filter_map(move |index| {
451 let local = Local::new(index);
452 let decl = &self.local_decls[local];
453 (decl.is_user_variable() && decl.mutability.is_mut()).then_some(local)
454 })
455 }
456
457 #[inline]
459 pub fn mut_vars_and_args_iter(&self) -> impl Iterator<Item = Local> {
460 (1..self.local_decls.len()).filter_map(move |index| {
461 let local = Local::new(index);
462 let decl = &self.local_decls[local];
463 if (decl.is_user_variable() || index < self.arg_count + 1)
464 && decl.mutability == Mutability::Mut
465 {
466 Some(local)
467 } else {
468 None
469 }
470 })
471 }
472
473 #[inline]
475 pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator + use<> {
476 (1..self.arg_count + 1).map(Local::new)
477 }
478
479 #[inline]
482 pub fn vars_and_temps_iter(
483 &self,
484 ) -> impl DoubleEndedIterator<Item = Local> + ExactSizeIterator {
485 (self.arg_count + 1..self.local_decls.len()).map(Local::new)
486 }
487
488 #[inline]
489 pub fn drain_vars_and_temps(&mut self) -> impl Iterator<Item = LocalDecl<'tcx>> {
490 self.local_decls.drain(self.arg_count + 1..)
491 }
492
493 pub fn source_info(&self, location: Location) -> &SourceInfo {
495 let block = &self[location.block];
496 let stmts = &block.statements;
497 let idx = location.statement_index;
498 if idx < stmts.len() {
499 &stmts[idx].source_info
500 } else {
501 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());
502 &block.terminator().source_info
503 }
504 }
505
506 #[inline]
508 pub fn return_ty(&self) -> Ty<'tcx> {
509 self.local_decls[RETURN_PLACE].ty
510 }
511
512 #[inline]
514 pub fn bound_return_ty(&self) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
515 ty::EarlyBinder::bind(self.local_decls[RETURN_PLACE].ty)
516 }
517
518 #[inline]
520 pub fn terminator_loc(&self, bb: BasicBlock) -> Location {
521 Location { block: bb, statement_index: self[bb].statements.len() }
522 }
523
524 pub fn stmt_at(&self, location: Location) -> Either<&Statement<'tcx>, &Terminator<'tcx>> {
525 let Location { block, statement_index } = location;
526 let block_data = &self.basic_blocks[block];
527 block_data
528 .statements
529 .get(statement_index)
530 .map(Either::Left)
531 .unwrap_or_else(|| Either::Right(block_data.terminator()))
532 }
533
534 #[inline]
535 pub fn yield_ty(&self) -> Option<Ty<'tcx>> {
536 self.coroutine.as_ref().and_then(|coroutine| coroutine.yield_ty)
537 }
538
539 #[inline]
540 pub fn resume_ty(&self) -> Option<Ty<'tcx>> {
541 self.coroutine.as_ref().and_then(|coroutine| coroutine.resume_ty)
542 }
543
544 #[inline]
546 pub fn coroutine_layout_raw(&self) -> Option<&CoroutineLayout<'tcx>> {
547 self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_layout.as_ref())
548 }
549
550 #[inline]
551 pub fn coroutine_drop(&self) -> Option<&Body<'tcx>> {
552 self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_drop.as_ref())
553 }
554
555 #[inline]
556 pub fn coroutine_drop_async(&self) -> Option<&Body<'tcx>> {
557 self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_drop_async.as_ref())
558 }
559
560 #[inline]
561 pub fn coroutine_requires_async_drop(&self) -> bool {
562 self.coroutine_drop_async().is_some()
563 }
564
565 #[inline]
566 pub fn future_drop_poll(&self) -> Option<&Body<'tcx>> {
567 self.coroutine.as_ref().and_then(|coroutine| {
568 coroutine
569 .coroutine_drop_async
570 .as_ref()
571 .or(coroutine.coroutine_drop_proxy_async.as_ref())
572 })
573 }
574
575 #[inline]
576 pub fn coroutine_kind(&self) -> Option<CoroutineKind> {
577 self.coroutine.as_ref().map(|coroutine| coroutine.coroutine_kind)
578 }
579
580 #[inline]
581 pub fn should_skip(&self) -> bool {
582 let Some(injection_phase) = self.injection_phase else {
583 return false;
584 };
585 injection_phase > self.phase
586 }
587
588 #[inline]
589 pub fn is_custom_mir(&self) -> bool {
590 self.injection_phase.is_some()
591 }
592
593 fn try_const_mono_switchint<'a>(
597 tcx: TyCtxt<'tcx>,
598 instance: Instance<'tcx>,
599 block: &'a BasicBlockData<'tcx>,
600 ) -> Option<(u128, &'a SwitchTargets)> {
601 let eval_mono_const = |constant: &ConstOperand<'tcx>| {
603 let typing_env = ty::TypingEnv::fully_monomorphized();
605 let mono_literal = instance.instantiate_mir_and_normalize_erasing_regions(
606 tcx,
607 typing_env,
608 crate::ty::EarlyBinder::bind(constant.const_),
609 );
610 mono_literal.try_eval_bits(tcx, typing_env)
611 };
612
613 let TerminatorKind::SwitchInt { discr, targets } = &block.terminator().kind else {
614 return None;
615 };
616
617 let discr = match discr {
619 Operand::Constant(constant) => {
620 let bits = eval_mono_const(constant)?;
621 return Some((bits, targets));
622 }
623 Operand::RuntimeChecks(check) => {
624 let bits = check.value(tcx.sess) as u128;
625 return Some((bits, targets));
626 }
627 Operand::Move(place) | Operand::Copy(place) => place,
628 };
629
630 let last_stmt = block.statements.iter().rev().find(|stmt| {
646 !#[allow(non_exhaustive_omitted_patterns)] match stmt.kind {
StatementKind::StorageDead(_) | StatementKind::StorageLive(_) => true,
_ => false,
}matches!(stmt.kind, StatementKind::StorageDead(_) | StatementKind::StorageLive(_))
647 })?;
648
649 let (place, rvalue) = last_stmt.kind.as_assign()?;
650
651 if discr != place {
652 return None;
653 }
654
655 match rvalue {
656 Rvalue::Use(Operand::Constant(constant)) => {
657 let bits = eval_mono_const(constant)?;
658 Some((bits, targets))
659 }
660 _ => None,
661 }
662 }
663
664 pub fn caller_location_span<T>(
669 &self,
670 mut source_info: SourceInfo,
671 caller_location: Option<T>,
672 tcx: TyCtxt<'tcx>,
673 from_span: impl FnOnce(Span) -> T,
674 ) -> T {
675 loop {
676 let scope_data = &self.source_scopes[source_info.scope];
677
678 if let Some((callee, callsite_span)) = scope_data.inlined {
679 if !callee.def.requires_caller_location(tcx) {
682 return from_span(source_info.span);
683 }
684 source_info.span = callsite_span;
685 }
686
687 match scope_data.inlined_parent_scope {
689 Some(parent) => source_info.scope = parent,
690 None => break,
691 }
692 }
693
694 caller_location.unwrap_or_else(|| from_span(source_info.span))
696 }
697
698 #[track_caller]
699 pub fn set_required_consts(&mut self, required_consts: Vec<ConstOperand<'tcx>>) {
700 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!(
701 self.required_consts.is_none(),
702 "required_consts for {:?} have already been set",
703 self.source.def_id()
704 );
705 self.required_consts = Some(required_consts);
706 }
707 #[track_caller]
708 pub fn required_consts(&self) -> &[ConstOperand<'tcx>] {
709 match &self.required_consts {
710 Some(l) => l,
711 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()),
712 }
713 }
714
715 #[track_caller]
716 pub fn set_mentioned_items(&mut self, mentioned_items: Vec<Spanned<MentionedItem<'tcx>>>) {
717 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!(
718 self.mentioned_items.is_none(),
719 "mentioned_items for {:?} have already been set",
720 self.source.def_id()
721 );
722 self.mentioned_items = Some(mentioned_items);
723 }
724 #[track_caller]
725 pub fn mentioned_items(&self) -> &[Spanned<MentionedItem<'tcx>>] {
726 match &self.mentioned_items {
727 Some(l) => l,
728 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()),
729 }
730 }
731}
732
733impl<'tcx> Index<BasicBlock> for Body<'tcx> {
734 type Output = BasicBlockData<'tcx>;
735
736 #[inline]
737 fn index(&self, index: BasicBlock) -> &BasicBlockData<'tcx> {
738 &self.basic_blocks[index]
739 }
740}
741
742impl<'tcx> IndexMut<BasicBlock> for Body<'tcx> {
743 #[inline]
744 fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx> {
745 &mut self.basic_blocks.as_mut()[index]
746 }
747}
748
749#[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) -> ClearCrossCrate<T> {
match self {
ClearCrossCrate::Clear => ClearCrossCrate::Clear,
ClearCrossCrate::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 {
ClearCrossCrate::Clear =>
::core::fmt::Formatter::write_str(f, "Clear"),
ClearCrossCrate::Set(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Set",
&__self_0),
}
}
}Debug, const _: () =
{
impl<'__ctx, T>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for ClearCrossCrate<T> where
T: ::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
{
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
ClearCrossCrate::Clear => {}
ClearCrossCrate::Set(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
750pub enum ClearCrossCrate<T> {
751 Clear,
752 Set(T),
753}
754
755impl<T> ClearCrossCrate<T> {
756 pub fn as_ref(&self) -> ClearCrossCrate<&T> {
757 match self {
758 ClearCrossCrate::Clear => ClearCrossCrate::Clear,
759 ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
760 }
761 }
762
763 pub fn as_mut(&mut self) -> ClearCrossCrate<&mut T> {
764 match self {
765 ClearCrossCrate::Clear => ClearCrossCrate::Clear,
766 ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
767 }
768 }
769
770 pub fn unwrap_crate_local(self) -> T {
771 match self {
772 ClearCrossCrate::Clear => crate::util::bug::bug_fmt(format_args!("unwrapping cross-crate data"))bug!("unwrapping cross-crate data"),
773 ClearCrossCrate::Set(v) => v,
774 }
775 }
776}
777
778const TAG_CLEAR_CROSS_CRATE_CLEAR: u8 = 0;
779const TAG_CLEAR_CROSS_CRATE_SET: u8 = 1;
780
781impl<'tcx, E: TyEncoder<'tcx>, T: Encodable<E>> Encodable<E> for ClearCrossCrate<T> {
782 #[inline]
783 fn encode(&self, e: &mut E) {
784 if E::CLEAR_CROSS_CRATE {
785 return;
786 }
787
788 match *self {
789 ClearCrossCrate::Clear => TAG_CLEAR_CROSS_CRATE_CLEAR.encode(e),
790 ClearCrossCrate::Set(ref val) => {
791 TAG_CLEAR_CROSS_CRATE_SET.encode(e);
792 val.encode(e);
793 }
794 }
795 }
796}
797impl<'tcx, D: TyDecoder<'tcx>, T: Decodable<D>> Decodable<D> for ClearCrossCrate<T> {
798 #[inline]
799 fn decode(d: &mut D) -> ClearCrossCrate<T> {
800 if D::CLEAR_CROSS_CRATE {
801 return ClearCrossCrate::Clear;
802 }
803
804 let discr = u8::decode(d);
805
806 match discr {
807 TAG_CLEAR_CROSS_CRATE_CLEAR => ClearCrossCrate::Clear,
808 TAG_CLEAR_CROSS_CRATE_SET => {
809 let val = T::decode(d);
810 ClearCrossCrate::Set(val)
811 }
812 tag => {
::core::panicking::panic_fmt(format_args!("Invalid tag for ClearCrossCrate: {0:?}",
tag));
}panic!("Invalid tag for ClearCrossCrate: {tag:?}"),
813 }
814 }
815}
816
817#[derive(#[automatically_derived]
impl ::core::marker::Copy for SourceInfo { }Copy, #[automatically_derived]
impl ::core::clone::Clone for SourceInfo {
#[inline]
fn clone(&self) -> SourceInfo {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<SourceScope>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for SourceInfo {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "SourceInfo",
"span", &self.span, "scope", &&self.scope)
}
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for SourceInfo {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Span>;
let _: ::core::cmp::AssertParamIsEq<SourceScope>;
}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for SourceInfo {
#[inline]
fn eq(&self, other: &SourceInfo) -> bool {
self.span == other.span && self.scope == other.scope
}
}PartialEq, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for SourceInfo {
fn encode(&self, __encoder: &mut __E) {
match *self {
SourceInfo { span: ref __binding_0, scope: ref __binding_1 }
=> {
::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<'__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for SourceInfo {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
SourceInfo { span: ref __binding_0, scope: ref __binding_1 }
=> {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable)]
823pub struct SourceInfo {
824 pub span: Span,
826
827 pub scope: SourceScope,
830}
831
832impl SourceInfo {
833 #[inline]
834 pub fn outermost(span: Span) -> Self {
835 SourceInfo { span, scope: OUTERMOST_SOURCE_SCOPE }
836 }
837}
838
839impl ::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! {
843 #[derive(HashStable)]
844 #[encodable]
845 #[orderable]
846 #[debug_format = "_{}"]
847 pub struct Local {
848 const RETURN_PLACE = 0;
849 }
850}
851
852impl Atom for Local {
853 fn index(self) -> usize {
854 Idx::index(self)
855 }
856}
857
858#[derive(#[automatically_derived]
impl ::core::clone::Clone for LocalKind {
#[inline]
fn clone(&self) -> LocalKind { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for LocalKind { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for LocalKind {
#[inline]
fn eq(&self, other: &LocalKind) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for LocalKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}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<'__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for LocalKind {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
LocalKind::Temp => {}
LocalKind::Arg => {}
LocalKind::ReturnPointer => {}
}
}
}
};HashStable)]
860pub enum LocalKind {
861 Temp,
863 Arg,
865 ReturnPointer,
867}
868
869#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for VarBindingForm<'tcx> {
#[inline]
fn clone(&self) -> VarBindingForm<'tcx> {
VarBindingForm {
binding_mode: ::core::clone::Clone::clone(&self.binding_mode),
opt_ty_info: ::core::clone::Clone::clone(&self.opt_ty_info),
opt_match_place: ::core::clone::Clone::clone(&self.opt_match_place),
pat_span: ::core::clone::Clone::clone(&self.pat_span),
introductions: ::core::clone::Clone::clone(&self.introductions),
}
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for VarBindingForm<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"VarBindingForm", "binding_mode", &self.binding_mode,
"opt_ty_info", &self.opt_ty_info, "opt_match_place",
&self.opt_match_place, "pat_span", &self.pat_span,
"introductions", &&self.introductions)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for VarBindingForm<'tcx> {
fn encode(&self, __encoder: &mut __E) {
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 } => {
::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, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for VarBindingForm<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
{ __binding_2.hash_stable(__hcx, __hasher); }
{ __binding_3.hash_stable(__hcx, __hasher); }
{ __binding_4.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable)]
870pub struct VarBindingForm<'tcx> {
871 pub binding_mode: BindingMode,
873 pub opt_ty_info: Option<Span>,
880 pub opt_match_place: Option<(Option<Place<'tcx>>, Span)>,
887 pub pat_span: Span,
889 pub introductions: Vec<VarBindingIntroduction>,
892}
893
894#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for BindingForm<'tcx> {
#[inline]
fn clone(&self) -> BindingForm<'tcx> {
match self {
BindingForm::Var(__self_0) =>
BindingForm::Var(::core::clone::Clone::clone(__self_0)),
BindingForm::ImplicitSelf(__self_0) =>
BindingForm::ImplicitSelf(::core::clone::Clone::clone(__self_0)),
BindingForm::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 {
BindingForm::Var(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Var",
&__self_0),
BindingForm::ImplicitSelf(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ImplicitSelf", &__self_0),
BindingForm::RefForGuard(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"RefForGuard", &__self_0),
}
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for BindingForm<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
BindingForm::Var(ref __binding_0) => { 0usize }
BindingForm::ImplicitSelf(ref __binding_0) => { 1usize }
BindingForm::RefForGuard(ref __binding_0) => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
BindingForm::Var(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
BindingForm::ImplicitSelf(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
BindingForm::RefForGuard(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for BindingForm<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
BindingForm::Var(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
BindingForm::ImplicitSelf(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
BindingForm::RefForGuard(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `BindingForm`, expected 0..3, actual {0}",
n));
}
}
}
}
};TyDecodable)]
895pub enum BindingForm<'tcx> {
896 Var(VarBindingForm<'tcx>),
898 ImplicitSelf(ImplicitSelfKind),
900 RefForGuard(Local),
902}
903
904#[derive(#[automatically_derived]
impl ::core::clone::Clone for VarBindingIntroduction {
#[inline]
fn clone(&self) -> VarBindingIntroduction {
VarBindingIntroduction {
span: ::core::clone::Clone::clone(&self.span),
is_shorthand: ::core::clone::Clone::clone(&self.is_shorthand),
}
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for VarBindingIntroduction {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"VarBindingIntroduction", "span", &self.span, "is_shorthand",
&&self.is_shorthand)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for VarBindingIntroduction {
fn encode(&self, __encoder: &mut __E) {
match *self {
VarBindingIntroduction {
span: ref __binding_0, is_shorthand: ref __binding_1 } => {
::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<'__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for VarBindingIntroduction {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
VarBindingIntroduction {
span: ref __binding_0, is_shorthand: ref __binding_1 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable)]
905pub struct VarBindingIntroduction {
906 pub span: Span,
908 pub is_shorthand: bool,
910}
911
912mod binding_form_impl {
913 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
914 use rustc_query_system::ich::StableHashingContext;
915
916 impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for super::BindingForm<'tcx> {
917 fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
918 use super::BindingForm::*;
919 std::mem::discriminant(self).hash_stable(hcx, hasher);
920
921 match self {
922 Var(binding) => binding.hash_stable(hcx, hasher),
923 ImplicitSelf(kind) => kind.hash_stable(hcx, hasher),
924 RefForGuard(local) => local.hash_stable(hcx, hasher),
925 }
926 }
927 }
928}
929
930#[derive(#[automatically_derived]
impl ::core::clone::Clone for BlockTailInfo {
#[inline]
fn clone(&self) -> BlockTailInfo {
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for BlockTailInfo { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for BlockTailInfo {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "BlockTailInfo",
"tail_result_is_ignored", &self.tail_result_is_ignored, "span",
&&self.span)
}
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for BlockTailInfo {
#[inline]
fn eq(&self, other: &BlockTailInfo) -> 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_receiver_is_total_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) {
match *self {
BlockTailInfo {
tail_result_is_ignored: ref __binding_0,
span: ref __binding_1 } => {
::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<'__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for BlockTailInfo {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
BlockTailInfo {
tail_result_is_ignored: ref __binding_0,
span: ref __binding_1 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable)]
939pub struct BlockTailInfo {
940 pub tail_result_is_ignored: bool,
946
947 pub span: Span,
949}
950
951#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for LocalDecl<'tcx> {
#[inline]
fn clone(&self) -> LocalDecl<'tcx> {
LocalDecl {
mutability: ::core::clone::Clone::clone(&self.mutability),
local_info: ::core::clone::Clone::clone(&self.local_info),
ty: ::core::clone::Clone::clone(&self.ty),
user_ty: ::core::clone::Clone::clone(&self.user_ty),
source_info: ::core::clone::Clone::clone(&self.source_info),
}
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for LocalDecl<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "LocalDecl",
"mutability", &self.mutability, "local_info", &self.local_info,
"ty", &self.ty, "user_ty", &self.user_ty, "source_info",
&&self.source_info)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for LocalDecl<'tcx> {
fn encode(&self, __encoder: &mut __E) {
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 } => {
::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, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for LocalDecl<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
{ __binding_2.hash_stable(__hcx, __hasher); }
{ __binding_3.hash_stable(__hcx, __hasher); }
{ __binding_4.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
956pub struct LocalDecl<'tcx> {
957 pub mutability: Mutability,
961
962 pub local_info: ClearCrossCrate<Box<LocalInfo<'tcx>>>,
963
964 pub ty: Ty<'tcx>,
966
967 pub user_ty: Option<Box<UserTypeProjections>>,
972
973 pub source_info: SourceInfo,
1054}
1055
1056#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for LocalInfo<'tcx> {
#[inline]
fn clone(&self) -> LocalInfo<'tcx> {
match self {
LocalInfo::User(__self_0) =>
LocalInfo::User(::core::clone::Clone::clone(__self_0)),
LocalInfo::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),
},
LocalInfo::ConstRef { def_id: __self_0 } =>
LocalInfo::ConstRef {
def_id: ::core::clone::Clone::clone(__self_0),
},
LocalInfo::AggregateTemp => LocalInfo::AggregateTemp,
LocalInfo::BlockTailTemp(__self_0) =>
LocalInfo::BlockTailTemp(::core::clone::Clone::clone(__self_0)),
LocalInfo::IfThenRescopeTemp { if_then: __self_0 } =>
LocalInfo::IfThenRescopeTemp {
if_then: ::core::clone::Clone::clone(__self_0),
},
LocalInfo::DerefTemp => LocalInfo::DerefTemp,
LocalInfo::FakeBorrow => LocalInfo::FakeBorrow,
LocalInfo::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 {
LocalInfo::User(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "User",
&__self_0),
LocalInfo::StaticRef { def_id: __self_0, is_thread_local: __self_1
} =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"StaticRef", "def_id", __self_0, "is_thread_local",
&__self_1),
LocalInfo::ConstRef { def_id: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ConstRef", "def_id", &__self_0),
LocalInfo::AggregateTemp =>
::core::fmt::Formatter::write_str(f, "AggregateTemp"),
LocalInfo::BlockTailTemp(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"BlockTailTemp", &__self_0),
LocalInfo::IfThenRescopeTemp { if_then: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"IfThenRescopeTemp", "if_then", &__self_0),
LocalInfo::DerefTemp =>
::core::fmt::Formatter::write_str(f, "DerefTemp"),
LocalInfo::FakeBorrow =>
::core::fmt::Formatter::write_str(f, "FakeBorrow"),
LocalInfo::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, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for LocalInfo<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
LocalInfo::User(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
LocalInfo::StaticRef {
def_id: ref __binding_0, is_thread_local: ref __binding_1 }
=> {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
LocalInfo::ConstRef { def_id: ref __binding_0 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
LocalInfo::AggregateTemp => {}
LocalInfo::BlockTailTemp(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
{
{ __binding_0.hash_stable(__hcx, __hasher); }
}
LocalInfo::DerefTemp => {}
LocalInfo::FakeBorrow => {}
LocalInfo::Boring => {}
}
}
}
};HashStable, 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)]
1063pub enum LocalInfo<'tcx> {
1064 User(BindingForm<'tcx>),
1070 StaticRef { def_id: DefId, is_thread_local: bool },
1072 ConstRef { def_id: DefId },
1074 AggregateTemp,
1077 BlockTailTemp(BlockTailInfo),
1080 IfThenRescopeTemp { if_then: HirId },
1083 DerefTemp,
1089 FakeBorrow,
1091 Boring,
1093}
1094
1095impl<'tcx> LocalDecl<'tcx> {
1096 pub fn local_info(&self) -> &LocalInfo<'tcx> {
1097 self.local_info.as_ref().unwrap_crate_local()
1098 }
1099
1100 pub fn can_be_made_mutable(&self) -> bool {
1107 #[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!(
1108 self.local_info(),
1109 LocalInfo::User(
1110 BindingForm::Var(VarBindingForm { binding_mode: BindingMode(ByRef::No, _), .. })
1111 | BindingForm::ImplicitSelf(ImplicitSelfKind::Imm),
1112 )
1113 )
1114 }
1115
1116 pub fn is_nonref_binding(&self) -> bool {
1120 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::User(BindingForm::Var(VarBindingForm {
binding_mode: BindingMode(ByRef::No, _), .. }) |
BindingForm::ImplicitSelf(_)) => true,
_ => false,
}matches!(
1121 self.local_info(),
1122 LocalInfo::User(
1123 BindingForm::Var(VarBindingForm { binding_mode: BindingMode(ByRef::No, _), .. })
1124 | BindingForm::ImplicitSelf(_),
1125 )
1126 )
1127 }
1128
1129 #[inline]
1132 pub fn is_user_variable(&self) -> bool {
1133 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::User(_) => true,
_ => false,
}matches!(self.local_info(), LocalInfo::User(_))
1134 }
1135
1136 pub fn is_ref_for_guard(&self) -> bool {
1140 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::User(BindingForm::RefForGuard(_)) => true,
_ => false,
}matches!(self.local_info(), LocalInfo::User(BindingForm::RefForGuard(_)))
1141 }
1142
1143 pub fn is_ref_to_static(&self) -> bool {
1146 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::StaticRef { .. } => true,
_ => false,
}matches!(self.local_info(), LocalInfo::StaticRef { .. })
1147 }
1148
1149 pub fn is_ref_to_thread_local(&self) -> bool {
1152 match self.local_info() {
1153 LocalInfo::StaticRef { is_thread_local, .. } => *is_thread_local,
1154 _ => false,
1155 }
1156 }
1157
1158 pub fn is_deref_temp(&self) -> bool {
1160 match self.local_info() {
1161 LocalInfo::DerefTemp => true,
1162 _ => false,
1163 }
1164 }
1165
1166 #[inline]
1169 pub fn from_compiler_desugaring(&self) -> bool {
1170 self.source_info.span.desugaring_kind().is_some()
1171 }
1172
1173 #[inline]
1175 pub fn new(ty: Ty<'tcx>, span: Span) -> Self {
1176 Self::with_source_info(ty, SourceInfo::outermost(span))
1177 }
1178
1179 #[inline]
1181 pub fn with_source_info(ty: Ty<'tcx>, source_info: SourceInfo) -> Self {
1182 LocalDecl {
1183 mutability: Mutability::Mut,
1184 local_info: ClearCrossCrate::Set(Box::new(LocalInfo::Boring)),
1185 ty,
1186 user_ty: None,
1187 source_info,
1188 }
1189 }
1190
1191 #[inline]
1193 pub fn immutable(mut self) -> Self {
1194 self.mutability = Mutability::Not;
1195 self
1196 }
1197}
1198
1199#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for VarDebugInfoContents<'tcx> {
#[inline]
fn clone(&self) -> VarDebugInfoContents<'tcx> {
match self {
VarDebugInfoContents::Place(__self_0) =>
VarDebugInfoContents::Place(::core::clone::Clone::clone(__self_0)),
VarDebugInfoContents::Const(__self_0) =>
VarDebugInfoContents::Const(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, 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, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for VarDebugInfoContents<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
VarDebugInfoContents::Place(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
VarDebugInfoContents::Const(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
1200pub enum VarDebugInfoContents<'tcx> {
1201 Place(Place<'tcx>),
1203 Const(ConstOperand<'tcx>),
1204}
1205
1206impl<'tcx> Debug for VarDebugInfoContents<'tcx> {
1207 fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
1208 match self {
1209 VarDebugInfoContents::Const(c) => fmt.write_fmt(format_args!("{0}", c))write!(fmt, "{c}"),
1210 VarDebugInfoContents::Place(p) => fmt.write_fmt(format_args!("{0:?}", p))write!(fmt, "{p:?}"),
1211 }
1212 }
1213}
1214
1215#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for VarDebugInfoFragment<'tcx> {
#[inline]
fn clone(&self) -> VarDebugInfoFragment<'tcx> {
VarDebugInfoFragment {
ty: ::core::clone::Clone::clone(&self.ty),
projection: ::core::clone::Clone::clone(&self.projection),
}
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for VarDebugInfoFragment<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"VarDebugInfoFragment", "ty", &self.ty, "projection",
&&self.projection)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for VarDebugInfoFragment<'tcx> {
fn encode(&self, __encoder: &mut __E) {
match *self {
VarDebugInfoFragment {
ty: ref __binding_0, projection: ref __binding_1 } => {
::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, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for VarDebugInfoFragment<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
VarDebugInfoFragment {
ty: ref __binding_0, projection: ref __binding_1 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
1216pub struct VarDebugInfoFragment<'tcx> {
1217 pub ty: Ty<'tcx>,
1220
1221 pub projection: Vec<PlaceElem<'tcx>>,
1231}
1232
1233#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for VarDebugInfo<'tcx> {
#[inline]
fn clone(&self) -> VarDebugInfo<'tcx> {
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) {
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 } => {
::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, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for VarDebugInfo<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
{ __binding_2.hash_stable(__hcx, __hasher); }
{ __binding_3.hash_stable(__hcx, __hasher); }
{ __binding_4.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
1235pub struct VarDebugInfo<'tcx> {
1236 pub name: Symbol,
1237
1238 pub source_info: SourceInfo,
1242
1243 pub composite: Option<Box<VarDebugInfoFragment<'tcx>>>,
1249
1250 pub value: VarDebugInfoContents<'tcx>,
1252
1253 pub argument_index: Option<u16>,
1257}
1258
1259impl ::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! {
1263 #[derive(HashStable)]
1286 #[encodable]
1287 #[orderable]
1288 #[debug_format = "bb{}"]
1289 pub struct BasicBlock {
1290 const START_BLOCK = 0;
1291 }
1292}
1293
1294impl BasicBlock {
1295 pub fn start_location(self) -> Location {
1296 Location { block: self, statement_index: 0 }
1297 }
1298}
1299
1300#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for BasicBlockData<'tcx> {
#[inline]
fn clone(&self) -> BasicBlockData<'tcx> {
BasicBlockData {
statements: ::core::clone::Clone::clone(&self.statements),
after_last_stmt_debuginfos: ::core::clone::Clone::clone(&self.after_last_stmt_debuginfos),
terminator: ::core::clone::Clone::clone(&self.terminator),
is_cleanup: ::core::clone::Clone::clone(&self.is_cleanup),
}
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for BasicBlockData<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"BasicBlockData", "statements", &self.statements,
"after_last_stmt_debuginfos", &self.after_last_stmt_debuginfos,
"terminator", &self.terminator, "is_cleanup", &&self.is_cleanup)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for BasicBlockData<'tcx> {
fn encode(&self, __encoder: &mut __E) {
match *self {
BasicBlockData {
statements: ref __binding_0,
after_last_stmt_debuginfos: ref __binding_1,
terminator: ref __binding_2,
is_cleanup: ref __binding_3 } => {
::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, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for BasicBlockData<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
{ __binding_2.hash_stable(__hcx, __hasher); }
{ __binding_3.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
1307#[non_exhaustive]
1308pub struct BasicBlockData<'tcx> {
1309 pub statements: Vec<Statement<'tcx>>,
1311
1312 pub after_last_stmt_debuginfos: StmtDebugInfos<'tcx>,
1315
1316 pub terminator: Option<Terminator<'tcx>>,
1325
1326 pub is_cleanup: bool,
1331}
1332
1333impl<'tcx> BasicBlockData<'tcx> {
1334 pub fn new(terminator: Option<Terminator<'tcx>>, is_cleanup: bool) -> BasicBlockData<'tcx> {
1335 BasicBlockData::new_stmts(Vec::new(), terminator, is_cleanup)
1336 }
1337
1338 pub fn new_stmts(
1339 statements: Vec<Statement<'tcx>>,
1340 terminator: Option<Terminator<'tcx>>,
1341 is_cleanup: bool,
1342 ) -> BasicBlockData<'tcx> {
1343 BasicBlockData {
1344 statements,
1345 after_last_stmt_debuginfos: StmtDebugInfos::default(),
1346 terminator,
1347 is_cleanup,
1348 }
1349 }
1350
1351 #[inline]
1356 pub fn terminator(&self) -> &Terminator<'tcx> {
1357 self.terminator.as_ref().expect("invalid terminator state")
1358 }
1359
1360 #[inline]
1361 pub fn terminator_mut(&mut self) -> &mut Terminator<'tcx> {
1362 self.terminator.as_mut().expect("invalid terminator state")
1363 }
1364
1365 #[inline]
1367 pub fn is_empty_unreachable(&self) -> bool {
1368 self.statements.is_empty() && #[allow(non_exhaustive_omitted_patterns)] match self.terminator().kind {
TerminatorKind::Unreachable => true,
_ => false,
}matches!(self.terminator().kind, TerminatorKind::Unreachable)
1369 }
1370
1371 pub fn mono_successors(&self, tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> Successors<'_> {
1377 if let Some((bits, targets)) = Body::try_const_mono_switchint(tcx, instance, self) {
1378 targets.successors_for_value(bits)
1379 } else {
1380 self.terminator().successors()
1381 }
1382 }
1383
1384 pub fn retain_statements<F>(&mut self, mut f: F)
1385 where
1386 F: FnMut(&Statement<'tcx>) -> bool,
1387 {
1388 let mut debuginfos = StmtDebugInfos::default();
1391 self.statements.retain_mut(|stmt| {
1392 let retain = f(stmt);
1393 if retain {
1394 stmt.debuginfos.prepend(&mut debuginfos);
1395 } else {
1396 debuginfos.append(&mut stmt.debuginfos);
1397 }
1398 retain
1399 });
1400 self.after_last_stmt_debuginfos.prepend(&mut debuginfos);
1401 }
1402
1403 pub fn strip_nops(&mut self) {
1404 self.retain_statements(|stmt| !#[allow(non_exhaustive_omitted_patterns)] match stmt.kind {
StatementKind::Nop => true,
_ => false,
}matches!(stmt.kind, StatementKind::Nop))
1405 }
1406
1407 pub fn drop_debuginfo(&mut self) {
1408 self.after_last_stmt_debuginfos.drop_debuginfo();
1409 for stmt in self.statements.iter_mut() {
1410 stmt.debuginfos.drop_debuginfo();
1411 }
1412 }
1413}
1414
1415impl ::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! {
1419 #[derive(HashStable)]
1420 #[encodable]
1421 #[debug_format = "scope[{}]"]
1422 pub struct SourceScope {
1423 const OUTERMOST_SOURCE_SCOPE = 0;
1424 }
1425}
1426
1427impl SourceScope {
1428 pub fn lint_root(
1432 self,
1433 source_scopes: &IndexSlice<SourceScope, SourceScopeData<'_>>,
1434 ) -> Option<HirId> {
1435 let mut data = &source_scopes[self];
1436 while data.inlined.is_some() {
1439 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_middle/src/mir/mod.rs:1439",
"rustc_middle::mir", ::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("compiler/rustc_middle/src/mir/mod.rs"),
::tracing_core::__macro_support::Option::Some(1439u32),
::tracing_core::__macro_support::Option::Some("rustc_middle::mir"),
::tracing_core::field::FieldSet::new(&["data"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&debug(&data) as
&dyn Value))])
});
} else { ; }
};trace!(?data);
1440 data = &source_scopes[data.parent_scope.unwrap()];
1441 }
1442 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_middle/src/mir/mod.rs:1442",
"rustc_middle::mir", ::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("compiler/rustc_middle/src/mir/mod.rs"),
::tracing_core::__macro_support::Option::Some(1442u32),
::tracing_core::__macro_support::Option::Some("rustc_middle::mir"),
::tracing_core::field::FieldSet::new(&["data"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&debug(&data) as
&dyn Value))])
});
} else { ; }
};trace!(?data);
1443 match &data.local_data {
1444 ClearCrossCrate::Set(data) => Some(data.lint_root),
1445 ClearCrossCrate::Clear => None,
1446 }
1447 }
1448
1449 #[inline]
1451 pub fn inlined_instance<'tcx>(
1452 self,
1453 source_scopes: &IndexSlice<SourceScope, SourceScopeData<'tcx>>,
1454 ) -> Option<ty::Instance<'tcx>> {
1455 let scope_data = &source_scopes[self];
1456 if let Some((inlined_instance, _)) = scope_data.inlined {
1457 Some(inlined_instance)
1458 } else if let Some(inlined_scope) = scope_data.inlined_parent_scope {
1459 Some(source_scopes[inlined_scope].inlined.unwrap().0)
1460 } else {
1461 None
1462 }
1463 }
1464}
1465
1466#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for SourceScopeData<'tcx> {
#[inline]
fn clone(&self) -> SourceScopeData<'tcx> {
SourceScopeData {
span: ::core::clone::Clone::clone(&self.span),
parent_scope: ::core::clone::Clone::clone(&self.parent_scope),
inlined: ::core::clone::Clone::clone(&self.inlined),
inlined_parent_scope: ::core::clone::Clone::clone(&self.inlined_parent_scope),
local_data: ::core::clone::Clone::clone(&self.local_data),
}
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for SourceScopeData<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"SourceScopeData", "span", &self.span, "parent_scope",
&self.parent_scope, "inlined", &self.inlined,
"inlined_parent_scope", &self.inlined_parent_scope, "local_data",
&&self.local_data)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for SourceScopeData<'tcx> {
fn encode(&self, __encoder: &mut __E) {
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 } => {
::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, '__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for SourceScopeData<'tcx> {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
{ __binding_2.hash_stable(__hcx, __hasher); }
{ __binding_3.hash_stable(__hcx, __hasher); }
{ __binding_4.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
1467pub struct SourceScopeData<'tcx> {
1468 pub span: Span,
1469 pub parent_scope: Option<SourceScope>,
1470
1471 pub inlined: Option<(ty::Instance<'tcx>, Span)>,
1475
1476 pub inlined_parent_scope: Option<SourceScope>,
1480
1481 pub local_data: ClearCrossCrate<SourceScopeLocalData>,
1484}
1485
1486#[derive(#[automatically_derived]
impl ::core::clone::Clone for SourceScopeLocalData {
#[inline]
fn clone(&self) -> SourceScopeLocalData {
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) {
match *self {
SourceScopeLocalData { lint_root: 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 SourceScopeLocalData {
fn decode(__decoder: &mut __D) -> Self {
SourceScopeLocalData {
lint_root: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for SourceScopeLocalData {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
SourceScopeLocalData { lint_root: ref __binding_0 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable)]
1487pub struct SourceScopeLocalData {
1488 pub lint_root: HirId,
1490}
1491
1492#[derive(#[automatically_derived]
impl ::core::clone::Clone for UserTypeProjections {
#[inline]
fn clone(&self) -> UserTypeProjections {
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) {
match *self {
UserTypeProjections { contents: 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 UserTypeProjections {
fn decode(__decoder: &mut __D) -> Self {
UserTypeProjections {
contents: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for UserTypeProjections {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
UserTypeProjections { contents: ref __binding_0 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, 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)]
1525pub struct UserTypeProjections {
1526 pub contents: Vec<UserTypeProjection>,
1527}
1528
1529impl UserTypeProjections {
1530 pub fn projections(&self) -> impl Iterator<Item = &UserTypeProjection> + ExactSizeIterator {
1531 self.contents.iter()
1532 }
1533}
1534
1535#[derive(#[automatically_derived]
impl ::core::clone::Clone for UserTypeProjection {
#[inline]
fn clone(&self) -> UserTypeProjection {
UserTypeProjection {
base: ::core::clone::Clone::clone(&self.base),
projs: ::core::clone::Clone::clone(&self.projs),
}
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for UserTypeProjection {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"UserTypeProjection", "base", &self.base, "projs", &&self.projs)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for UserTypeProjection {
fn encode(&self, __encoder: &mut __E) {
match *self {
UserTypeProjection {
base: ref __binding_0, projs: ref __binding_1 } => {
::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, #[automatically_derived]
impl ::core::hash::Hash for UserTypeProjection {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
::core::hash::Hash::hash(&self.base, state);
::core::hash::Hash::hash(&self.projs, state)
}
}Hash, const _: () =
{
impl<'__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for UserTypeProjection {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
UserTypeProjection {
base: ref __binding_0, projs: ref __binding_1 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable, #[automatically_derived]
impl ::core::cmp::PartialEq for UserTypeProjection {
#[inline]
fn eq(&self, other: &UserTypeProjection) -> bool {
self.base == other.base && self.projs == other.projs
}
}PartialEq)]
1551#[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)]
1552pub struct UserTypeProjection {
1553 pub base: UserTypeAnnotationIndex,
1554 pub projs: Vec<ProjectionKind>,
1555}
1556
1557impl ::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! {
1558 #[derive(HashStable)]
1559 #[encodable]
1560 #[orderable]
1561 #[debug_format = "promoted[{}]"]
1562 pub struct Promoted {}
1563}
1564
1565#[derive(#[automatically_derived]
impl ::core::marker::Copy for Location { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Location {
#[inline]
fn clone(&self) -> Location {
let _: ::core::clone::AssertParamIsClone<BasicBlock>;
let _: ::core::clone::AssertParamIsClone<usize>;
*self
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Location {
#[inline]
fn eq(&self, other: &Location) -> 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_receiver_is_total_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: &Location) -> ::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: &Location)
-> ::core::option::Option<::core::cmp::Ordering> {
match ::core::cmp::PartialOrd::partial_cmp(&self.block, &other.block)
{
::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
::core::cmp::PartialOrd::partial_cmp(&self.statement_index,
&other.statement_index),
cmp => cmp,
}
}
}PartialOrd, const _: () =
{
impl<'__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for Location {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
Location {
block: ref __binding_0, statement_index: ref __binding_1 }
=> {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable)]
1569pub struct Location {
1570 pub block: BasicBlock,
1572
1573 pub statement_index: usize,
1574}
1575
1576impl fmt::Debug for Location {
1577 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1578 fmt.write_fmt(format_args!("{0:?}[{1}]", self.block, self.statement_index))write!(fmt, "{:?}[{}]", self.block, self.statement_index)
1579 }
1580}
1581
1582impl Location {
1583 pub const START: Location = Location { block: START_BLOCK, statement_index: 0 };
1584
1585 #[inline]
1590 pub fn successor_within_block(&self) -> Location {
1591 Location { block: self.block, statement_index: self.statement_index + 1 }
1592 }
1593
1594 pub fn is_predecessor_of<'tcx>(&self, other: Location, body: &Body<'tcx>) -> bool {
1596 if self.block == other.block && self.statement_index < other.statement_index {
1599 return true;
1600 }
1601
1602 let predecessors = body.basic_blocks.predecessors();
1603
1604 let mut queue: Vec<BasicBlock> = predecessors[other.block].to_vec();
1606 let mut visited = FxHashSet::default();
1607
1608 while let Some(block) = queue.pop() {
1609 if visited.insert(block) {
1611 queue.extend(predecessors[block].iter().cloned());
1612 } else {
1613 continue;
1614 }
1615
1616 if self.block == block {
1619 return true;
1620 }
1621 }
1622
1623 false
1624 }
1625
1626 #[inline]
1627 pub fn dominates(&self, other: Location, dominators: &Dominators<BasicBlock>) -> bool {
1628 if self.block == other.block {
1629 self.statement_index <= other.statement_index
1630 } else {
1631 dominators.dominates(self.block, other.block)
1632 }
1633 }
1634}
1635
1636#[derive(#[automatically_derived]
impl ::core::marker::Copy for DefLocation { }Copy, #[automatically_derived]
impl ::core::clone::Clone for DefLocation {
#[inline]
fn clone(&self) -> DefLocation {
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 {
DefLocation::Argument =>
::core::fmt::Formatter::write_str(f, "Argument"),
DefLocation::Assignment(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Assignment", &__self_0),
DefLocation::CallReturn { call: __self_0, target: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"CallReturn", "call", __self_0, "target", &__self_1),
}
}
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for DefLocation {
#[inline]
fn eq(&self, other: &DefLocation) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(DefLocation::Assignment(__self_0),
DefLocation::Assignment(__arg1_0)) => __self_0 == __arg1_0,
(DefLocation::CallReturn { call: __self_0, target: __self_1 },
DefLocation::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_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Location>;
let _: ::core::cmp::AssertParamIsEq<BasicBlock>;
let _: ::core::cmp::AssertParamIsEq<Option<BasicBlock>>;
}
}Eq)]
1639pub enum DefLocation {
1640 Argument,
1641 Assignment(Location),
1642 CallReturn { call: BasicBlock, target: Option<BasicBlock> },
1643}
1644
1645impl DefLocation {
1646 #[inline]
1647 pub fn dominates(self, location: Location, dominators: &Dominators<BasicBlock>) -> bool {
1648 match self {
1649 DefLocation::Argument => true,
1650 DefLocation::Assignment(def) => {
1651 def.successor_within_block().dominates(location, dominators)
1652 }
1653 DefLocation::CallReturn { target: None, .. } => false,
1654 DefLocation::CallReturn { call, target: Some(target) } => {
1655 call != target
1662 && dominators.dominates(call, target)
1663 && dominators.dominates(target, location.block)
1664 }
1665 }
1666 }
1667}
1668
1669pub fn find_self_call<'tcx>(
1673 tcx: TyCtxt<'tcx>,
1674 body: &Body<'tcx>,
1675 local: Local,
1676 block: BasicBlock,
1677) -> Option<(DefId, GenericArgsRef<'tcx>)> {
1678 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_middle/src/mir/mod.rs:1678",
"rustc_middle::mir", ::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_middle/src/mir/mod.rs"),
::tracing_core::__macro_support::Option::Some(1678u32),
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("find_self_call(local={0:?}): terminator={1:?}",
local, body[block].terminator) as &dyn Value))])
});
} else { ; }
};debug!("find_self_call(local={:?}): terminator={:?}", local, body[block].terminator);
1679 if let Some(Terminator { kind: TerminatorKind::Call { func, args, .. }, .. }) =
1680 &body[block].terminator
1681 && let Operand::Constant(box ConstOperand { const_, .. }) = func
1682 && let ty::FnDef(def_id, fn_args) = *const_.ty().kind()
1683 && let Some(item) = tcx.opt_associated_item(def_id)
1684 && item.is_method()
1685 && let [Spanned { node: Operand::Move(self_place) | Operand::Copy(self_place), .. }, ..] =
1686 **args
1687 {
1688 if self_place.as_local() == Some(local) {
1689 return Some((def_id, fn_args));
1690 }
1691
1692 for stmt in &body[block].statements {
1695 if let StatementKind::Assign(box (place, rvalue)) = &stmt.kind
1696 && let Some(reborrow_local) = place.as_local()
1697 && self_place.as_local() == Some(reborrow_local)
1698 && let Rvalue::Ref(_, _, deref_place) = rvalue
1699 && let PlaceRef { local: deref_local, projection: [ProjectionElem::Deref] } =
1700 deref_place.as_ref()
1701 && deref_local == local
1702 {
1703 return Some((def_id, fn_args));
1704 }
1705 }
1706 }
1707 None
1708}
1709
1710#[cfg(target_pointer_width = "64")]
1712mod size_asserts {
1713 use rustc_data_structures::static_assert_size;
1714
1715 use super::*;
1716 const _: [(); 152] = [(); ::std::mem::size_of::<BasicBlockData<'_>>()];static_assert_size!(BasicBlockData<'_>, 152);
1718 const _: [(); 40] = [(); ::std::mem::size_of::<LocalDecl<'_>>()];static_assert_size!(LocalDecl<'_>, 40);
1719 const _: [(); 64] = [(); ::std::mem::size_of::<SourceScopeData<'_>>()];static_assert_size!(SourceScopeData<'_>, 64);
1720 const _: [(); 56] = [(); ::std::mem::size_of::<Statement<'_>>()];static_assert_size!(Statement<'_>, 56);
1721 const _: [(); 96] = [(); ::std::mem::size_of::<Terminator<'_>>()];static_assert_size!(Terminator<'_>, 96);
1722 const _: [(); 88] = [(); ::std::mem::size_of::<VarDebugInfo<'_>>()];static_assert_size!(VarDebugInfo<'_>, 88);
1723 }