1use std::borrow::Cow;
6use std::fmt::{self, Debug, Formatter};
7use std::iter;
8use std::ops::{Index, IndexMut};
9
10pub use basic_blocks::BasicBlocks;
11use either::Either;
12use polonius_engine::Atom;
13use rustc_abi::{FieldIdx, VariantIdx};
14pub use rustc_ast::{Mutability, Pinnedness};
15use rustc_data_structures::fx::{FxHashMap, FxHashSet};
16use rustc_data_structures::graph::dominators::Dominators;
17use rustc_errors::ErrorGuaranteed;
18use rustc_hir::def::{CtorKind, Namespace};
19use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
20use rustc_hir::{
21 self as hir, BindingMode, ByRef, CoroutineDesugaring, CoroutineKind, HirId, ImplicitSelfKind,
22};
23use rustc_index::bit_set::DenseBitSet;
24use rustc_index::{Idx, IndexSlice, IndexVec};
25use rustc_macros::{StableHash, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
26use rustc_serialize::{Decodable, Encodable};
27use rustc_span::{DUMMY_SP, Span, Spanned, Symbol, bug};
28use tracing::{debug, trace};
29
30pub use self::query::*;
31use crate::mir::interpret::{AllocRange, Scalar};
32use crate::ty::codec::{TyDecoder, TyEncoder};
33use crate::ty::print::{FmtPrinter, Printer, pretty_print_const, with_no_trimmed_paths};
34use crate::ty::{
35 self, GenericArg, GenericArgs, Instance, InstanceKind, List, ShimKind, Ty, TyCtxt,
36 TypeVisitableExt, TypingEnv, UserTypeAnnotationIndex,
37};
38
39pub mod basic_blocks;
40mod consts;
41pub mod coverage;
42mod generic_graph;
43pub mod graphviz;
44pub mod interpret;
45pub mod pretty;
46mod query;
47mod statement;
48mod syntax;
49mod terminator;
50pub mod traversal;
51pub mod visit;
52
53pub use consts::*;
54use pretty::pretty_print_const_value;
55pub use statement::*;
56pub use syntax::*;
57pub use terminator::*;
58
59pub use self::generic_graph::graphviz_safe_def_name;
60pub use self::graphviz::write_mir_graphviz;
61pub use self::pretty::{MirDumper, PassWhere, display_allocation, write_mir_pretty};
62
63pub type LocalDecls<'tcx> = IndexSlice<Local, LocalDecl<'tcx>>;
65
66pub trait HasLocalDecls<'tcx> {
67 fn local_decls(&self) -> &LocalDecls<'tcx>;
68}
69
70impl<'tcx> HasLocalDecls<'tcx> for IndexVec<Local, LocalDecl<'tcx>> {
71 #[inline]
72 fn local_decls(&self) -> &LocalDecls<'tcx> {
73 self
74 }
75}
76
77impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> {
78 #[inline]
79 fn local_decls(&self) -> &LocalDecls<'tcx> {
80 self
81 }
82}
83
84impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> {
85 #[inline]
86 fn local_decls(&self) -> &LocalDecls<'tcx> {
87 &self.local_decls
88 }
89}
90
91impl MirPhase {
92 pub fn name(&self) -> &'static str {
93 match *self {
94 MirPhase::Built => "built",
95 MirPhase::Analysis(AnalysisPhase::Initial) => "analysis",
96 MirPhase::Analysis(AnalysisPhase::PostCleanup) => "analysis-post-cleanup",
97 MirPhase::Runtime(RuntimePhase::Initial) => "runtime",
98 MirPhase::Runtime(RuntimePhase::PostCleanup) => "runtime-post-cleanup",
99 MirPhase::Runtime(RuntimePhase::Optimized) => "runtime-optimized",
100 }
101 }
102
103 pub fn index(&self) -> (usize, usize) {
106 match *self {
107 MirPhase::Built => (1, 1),
108 MirPhase::Analysis(analysis_phase) => (2, 1 + analysis_phase as usize),
109 MirPhase::Runtime(runtime_phase) => (3, 1 + runtime_phase as usize),
110 }
111 }
112}
113
114#[derive(#[automatically_derived]impl<'tcx> ::core::marker::Copy for MirSource<'tcx> {
}Copy, #[automatically_derived]#[doc(hidden)]unsafe impl<'tcx>
::core::clone::TrivialClone for MirSource<'tcx> {
}
#[automatically_derived]impl<'tcx> ::core::clone::Clone for MirSource<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<InstanceKind<'tcx>>;
let _: ::core::clone::AssertParamIsClone<Option<Promoted>>;
*self
}
}Clone, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for MirSource<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"MirSource instance promoted", &self.instance, &&self.promoted)
}
}Debug, #[automatically_derived]impl<'tcx> ::core::marker::StructuralPartialEq for
MirSource<'tcx> {
}
#[automatically_derived]impl<'tcx> ::core::cmp::PartialEq for MirSource<'tcx>
{
#[inline]
fn eq(&self, other: &Self) -> bool {
self.instance == other.instance && self.promoted == other.promoted
}
}PartialEq, #[automatically_derived]impl<'tcx> ::core::cmp::Eq for MirSource<'tcx> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<InstanceKind<'tcx>>;
let _: ::core::cmp::AssertParamIsEq<Option<Promoted>>;
}
}Eq)]
116#[derive(const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
MirSource<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
MirSource {
instance: ref __binding_0, promoted: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for MirSource<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let MirSource {
instance: ref __binding_0, promoted: ref __binding_1 } =
*self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for MirSource<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
MirSource {
instance: ::rustc_serialize::Decodable::decode(__decoder),
promoted: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for MirSource<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
MirSource { instance: __binding_0, promoted: __binding_1 }
=> {
MirSource {
instance: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
promoted: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
MirSource { instance: __binding_0, promoted: __binding_1 }
=> {
MirSource {
instance: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
promoted: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for MirSource<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
MirSource {
instance: ref __binding_0, promoted: ref __binding_1 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
117pub struct MirSource<'tcx> {
118 pub instance: InstanceKind<'tcx>,
119
120 pub promoted: Option<Promoted>,
122}
123
124impl<'tcx> MirSource<'tcx> {
125 pub fn item(def_id: DefId) -> Self {
126 MirSource { instance: InstanceKind::Item(def_id), promoted: None }
127 }
128
129 pub fn from_shim(shim: ShimKind<'tcx>) -> Self {
130 MirSource { instance: InstanceKind::Shim(shim), promoted: None }
131 }
132
133 #[inline]
134 pub fn def_id(&self) -> DefId {
135 self.instance.def_id()
136 }
137}
138
139#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for
CoroutineInfo<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
CoroutineInfo {
yield_ty: ::core::clone::Clone::clone(&self.yield_ty),
resume_ty: ::core::clone::Clone::clone(&self.resume_ty),
coroutine_drop: ::core::clone::Clone::clone(&self.coroutine_drop),
coroutine_drop_async: ::core::clone::Clone::clone(&self.coroutine_drop_async),
coroutine_drop_proxy_async: ::core::clone::Clone::clone(&self.coroutine_drop_proxy_async),
coroutine_layout: ::core::clone::Clone::clone(&self.coroutine_layout),
coroutine_kind: ::core::clone::Clone::clone(&self.coroutine_kind),
}
}
}Clone, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for CoroutineInfo<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let CoroutineInfo {
yield_ty: ref __binding_0,
resume_ty: ref __binding_1,
coroutine_drop: ref __binding_2,
coroutine_drop_async: ref __binding_3,
coroutine_drop_proxy_async: ref __binding_4,
coroutine_layout: ref __binding_5,
coroutine_kind: ref __binding_6 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_5,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_6,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for CoroutineInfo<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
CoroutineInfo {
yield_ty: ::rustc_serialize::Decodable::decode(__decoder),
resume_ty: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_drop: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_drop_async: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_drop_proxy_async: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_layout: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_kind: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for CoroutineInfo<'tcx>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"CoroutineInfo yield_ty resume_ty coroutine_drop coroutine_drop_async coroutine_drop_proxy_async coroutine_layout coroutine_kind",
&[&self.yield_ty, &self.resume_ty, &self.coroutine_drop,
&self.coroutine_drop_async,
&self.coroutine_drop_proxy_async, &self.coroutine_layout,
&&self.coroutine_kind])
}
}Debug, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
CoroutineInfo<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
CoroutineInfo {
yield_ty: ref __binding_0,
resume_ty: ref __binding_1,
coroutine_drop: ref __binding_2,
coroutine_drop_async: ref __binding_3,
coroutine_drop_proxy_async: ref __binding_4,
coroutine_layout: ref __binding_5,
coroutine_kind: ref __binding_6 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
{ __binding_5.stable_hash(__hcx, __hasher); }
{ __binding_6.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for CoroutineInfo<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
CoroutineInfo {
yield_ty: __binding_0,
resume_ty: __binding_1,
coroutine_drop: __binding_2,
coroutine_drop_async: __binding_3,
coroutine_drop_proxy_async: __binding_4,
coroutine_layout: __binding_5,
coroutine_kind: __binding_6 } => {
CoroutineInfo {
yield_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
resume_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
coroutine_drop: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
__folder)?,
coroutine_drop_async: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
__folder)?,
coroutine_drop_proxy_async: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
__folder)?,
coroutine_layout: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_5,
__folder)?,
coroutine_kind: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_6,
__folder)?,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
CoroutineInfo {
yield_ty: __binding_0,
resume_ty: __binding_1,
coroutine_drop: __binding_2,
coroutine_drop_async: __binding_3,
coroutine_drop_proxy_async: __binding_4,
coroutine_layout: __binding_5,
coroutine_kind: __binding_6 } => {
CoroutineInfo {
yield_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
resume_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
coroutine_drop: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
__folder),
coroutine_drop_async: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
__folder),
coroutine_drop_proxy_async: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
__folder),
coroutine_layout: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_5,
__folder),
coroutine_kind: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_6,
__folder),
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for CoroutineInfo<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
CoroutineInfo {
yield_ty: ref __binding_0,
resume_ty: ref __binding_1,
coroutine_drop: ref __binding_2,
coroutine_drop_async: ref __binding_3,
coroutine_drop_proxy_async: ref __binding_4,
coroutine_layout: ref __binding_5,
coroutine_kind: ref __binding_6 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_5,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_6,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
145pub struct CoroutineInfo<'tcx> {
146 pub yield_ty: Option<Ty<'tcx>>,
148
149 pub resume_ty: Option<Ty<'tcx>>,
151
152 pub coroutine_drop: Option<Body<'tcx>>,
154
155 pub coroutine_drop_async: Option<Body<'tcx>>,
157
158 pub coroutine_drop_proxy_async: Option<Body<'tcx>>,
160
161 pub coroutine_layout: Option<CoroutineLayout<'tcx>>,
163
164 pub coroutine_kind: CoroutineKind,
167}
168
169impl<'tcx> CoroutineInfo<'tcx> {
170 pub fn initial(
172 coroutine_kind: CoroutineKind,
173 yield_ty: Ty<'tcx>,
174 resume_ty: Ty<'tcx>,
175 ) -> CoroutineInfo<'tcx> {
176 CoroutineInfo {
177 coroutine_kind,
178 yield_ty: Some(yield_ty),
179 resume_ty: Some(resume_ty),
180 coroutine_drop: None,
181 coroutine_drop_async: None,
182 coroutine_drop_proxy_async: None,
183 coroutine_layout: None,
184 }
185 }
186}
187
188#[derive(#[automatically_derived]impl<'tcx> ::core::marker::Copy for
MentionedItem<'tcx> {
}Copy, #[automatically_derived]#[doc(hidden)]unsafe impl<'tcx>
::core::clone::TrivialClone for MentionedItem<'tcx> {
}
#[automatically_derived]impl<'tcx> ::core::clone::Clone for
MentionedItem<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
let _: ::core::clone::AssertParamIsClone<Ty<'tcx>>;
*self
}
}Clone, #[automatically_derived]impl<'tcx> ::core::marker::StructuralPartialEq for
MentionedItem<'tcx> {
}
#[automatically_derived]impl<'tcx> ::core::cmp::PartialEq for
MentionedItem<'tcx> {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Fn(__self_0), Self::Fn(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::Drop(__self_0), Self::Drop(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::UnsizeCast { source_ty: __self_0, target_ty: __self_1
}, Self::UnsizeCast {
source_ty: __arg1_0, target_ty: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(Self::Closure(__self_0), Self::Closure(__arg1_0)) =>
__self_0 == __arg1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
}
}PartialEq, #[automatically_derived]impl<'tcx> ::core::cmp::Eq for MentionedItem<'tcx> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
}
}Eq, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for MentionedItem<'tcx>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Fn(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Fn",
&__self_0),
Self::Drop(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Drop",
&__self_0),
Self::UnsizeCast { source_ty: __self_0, target_ty: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"UnsizeCast source_ty target_ty", __self_0, &__self_1),
Self::Closure(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Closure", &__self_0),
}
}
}Debug, #[automatically_derived]impl<'tcx> ::core::hash::Hash for MentionedItem<'tcx>
{
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
match self {
Self::Fn(__self_0) => ::core::hash::Hash::hash(__self_0, state),
Self::Drop(__self_0) => ::core::hash::Hash::hash(__self_0, state),
Self::UnsizeCast { source_ty: __self_0, target_ty: __self_1 } => {
::core::hash::Hash::hash(__self_0, state);
::core::hash::Hash::hash(__self_1, state)
}
Self::Closure(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
}
}
}Hash, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
MentionedItem<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
MentionedItem::Fn(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
MentionedItem::Drop(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
MentionedItem::UnsizeCast {
source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
2u8.stable_hash(__hcx, __hasher),
MentionedItem::Closure(ref __binding_0) =>
3u8.stable_hash(__hcx, __hasher),
}
match *self {
MentionedItem::Fn(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
MentionedItem::Drop(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
MentionedItem::UnsizeCast {
source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
MentionedItem::Closure(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for MentionedItem<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
MentionedItem::Fn(ref __binding_0) => { 0usize }
MentionedItem::Drop(ref __binding_0) => { 1usize }
MentionedItem::UnsizeCast {
source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
{
2usize
}
MentionedItem::Closure(ref __binding_0) => { 3usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
MentionedItem::Fn(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
MentionedItem::Drop(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
MentionedItem::UnsizeCast {
source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
{
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
MentionedItem::Closure(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for MentionedItem<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
MentionedItem::Fn(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
MentionedItem::Drop(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
MentionedItem::UnsizeCast {
source_ty: ::rustc_serialize::Decodable::decode(__decoder),
target_ty: ::rustc_serialize::Decodable::decode(__decoder),
}
}
3usize => {
MentionedItem::Closure(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `MentionedItem`, expected 0..4, actual {0}",
n));
}
}
}
}
};TyDecodable)]
190#[derive(const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for MentionedItem<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
MentionedItem::Fn(__binding_0) => {
MentionedItem::Fn(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
MentionedItem::Drop(__binding_0) => {
MentionedItem::Drop(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
MentionedItem::UnsizeCast {
source_ty: __binding_0, target_ty: __binding_1 } => {
MentionedItem::UnsizeCast {
source_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
target_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
}
}
MentionedItem::Closure(__binding_0) => {
MentionedItem::Closure(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
MentionedItem::Fn(__binding_0) => {
MentionedItem::Fn(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
MentionedItem::Drop(__binding_0) => {
MentionedItem::Drop(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
MentionedItem::UnsizeCast {
source_ty: __binding_0, target_ty: __binding_1 } => {
MentionedItem::UnsizeCast {
source_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
target_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
}
}
MentionedItem::Closure(__binding_0) => {
MentionedItem::Closure(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for MentionedItem<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
MentionedItem::Fn(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
MentionedItem::Drop(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
MentionedItem::UnsizeCast {
source_ty: ref __binding_0, target_ty: ref __binding_1 } =>
{
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
MentionedItem::Closure(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
191pub enum MentionedItem<'tcx> {
192 Fn(Ty<'tcx>),
195 Drop(Ty<'tcx>),
197 UnsizeCast { source_ty: Ty<'tcx>, target_ty: Ty<'tcx> },
199 Closure(Ty<'tcx>),
201}
202
203#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for Body<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
Body {
basic_blocks: ::core::clone::Clone::clone(&self.basic_blocks),
phase: ::core::clone::Clone::clone(&self.phase),
pass_count: ::core::clone::Clone::clone(&self.pass_count),
source: ::core::clone::Clone::clone(&self.source),
source_scopes: ::core::clone::Clone::clone(&self.source_scopes),
coroutine: ::core::clone::Clone::clone(&self.coroutine),
local_decls: ::core::clone::Clone::clone(&self.local_decls),
user_type_annotations: ::core::clone::Clone::clone(&self.user_type_annotations),
arg_count: ::core::clone::Clone::clone(&self.arg_count),
spread_arg: ::core::clone::Clone::clone(&self.spread_arg),
var_debug_info: ::core::clone::Clone::clone(&self.var_debug_info),
span: ::core::clone::Clone::clone(&self.span),
required_consts: ::core::clone::Clone::clone(&self.required_consts),
mentioned_items: ::core::clone::Clone::clone(&self.mentioned_items),
is_polymorphic: ::core::clone::Clone::clone(&self.is_polymorphic),
injection_phase: ::core::clone::Clone::clone(&self.injection_phase),
tainted_by_errors: ::core::clone::Clone::clone(&self.tainted_by_errors),
coverage_early_info: ::core::clone::Clone::clone(&self.coverage_early_info),
coverage_mir_info: ::core::clone::Clone::clone(&self.coverage_mir_info),
}
}
}Clone, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for Body<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let Body {
basic_blocks: ref __binding_0,
phase: ref __binding_1,
pass_count: ref __binding_2,
source: ref __binding_3,
source_scopes: ref __binding_4,
coroutine: ref __binding_5,
local_decls: ref __binding_6,
user_type_annotations: ref __binding_7,
arg_count: ref __binding_8,
spread_arg: ref __binding_9,
var_debug_info: ref __binding_10,
span: ref __binding_11,
required_consts: ref __binding_12,
mentioned_items: ref __binding_13,
is_polymorphic: ref __binding_14,
injection_phase: ref __binding_15,
tainted_by_errors: ref __binding_16,
coverage_early_info: ref __binding_17,
coverage_mir_info: ref __binding_18 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_5,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_6,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_7,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_8,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_9,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_10,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_11,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_12,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_13,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_14,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_15,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_16,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_17,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_18,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for Body<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
Body {
basic_blocks: ::rustc_serialize::Decodable::decode(__decoder),
phase: ::rustc_serialize::Decodable::decode(__decoder),
pass_count: ::rustc_serialize::Decodable::decode(__decoder),
source: ::rustc_serialize::Decodable::decode(__decoder),
source_scopes: ::rustc_serialize::Decodable::decode(__decoder),
coroutine: ::rustc_serialize::Decodable::decode(__decoder),
local_decls: ::rustc_serialize::Decodable::decode(__decoder),
user_type_annotations: ::rustc_serialize::Decodable::decode(__decoder),
arg_count: ::rustc_serialize::Decodable::decode(__decoder),
spread_arg: ::rustc_serialize::Decodable::decode(__decoder),
var_debug_info: ::rustc_serialize::Decodable::decode(__decoder),
span: ::rustc_serialize::Decodable::decode(__decoder),
required_consts: ::rustc_serialize::Decodable::decode(__decoder),
mentioned_items: ::rustc_serialize::Decodable::decode(__decoder),
is_polymorphic: ::rustc_serialize::Decodable::decode(__decoder),
injection_phase: ::rustc_serialize::Decodable::decode(__decoder),
tainted_by_errors: ::rustc_serialize::Decodable::decode(__decoder),
coverage_early_info: ::rustc_serialize::Decodable::decode(__decoder),
coverage_mir_info: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for Body<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"Body basic_blocks phase pass_count source source_scopes coroutine local_decls user_type_annotations arg_count spread_arg var_debug_info span required_consts mentioned_items is_polymorphic injection_phase tainted_by_errors coverage_early_info coverage_mir_info",
&[&self.basic_blocks, &self.phase, &self.pass_count, &self.source,
&self.source_scopes, &self.coroutine, &self.local_decls,
&self.user_type_annotations, &self.arg_count,
&self.spread_arg, &self.var_debug_info, &self.span,
&self.required_consts, &self.mentioned_items,
&self.is_polymorphic, &self.injection_phase,
&self.tainted_by_errors, &self.coverage_early_info,
&&self.coverage_mir_info])
}
}Debug, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
Body<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
Body {
basic_blocks: ref __binding_0,
phase: ref __binding_1,
pass_count: ref __binding_2,
source: ref __binding_3,
source_scopes: ref __binding_4,
coroutine: ref __binding_5,
local_decls: ref __binding_6,
user_type_annotations: ref __binding_7,
arg_count: ref __binding_8,
spread_arg: ref __binding_9,
var_debug_info: ref __binding_10,
span: ref __binding_11,
required_consts: ref __binding_12,
mentioned_items: ref __binding_13,
is_polymorphic: ref __binding_14,
injection_phase: ref __binding_15,
tainted_by_errors: ref __binding_16,
coverage_early_info: ref __binding_17,
coverage_mir_info: ref __binding_18 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
{ __binding_5.stable_hash(__hcx, __hasher); }
{ __binding_6.stable_hash(__hcx, __hasher); }
{ __binding_7.stable_hash(__hcx, __hasher); }
{ __binding_8.stable_hash(__hcx, __hasher); }
{ __binding_9.stable_hash(__hcx, __hasher); }
{ __binding_10.stable_hash(__hcx, __hasher); }
{ __binding_11.stable_hash(__hcx, __hasher); }
{ __binding_12.stable_hash(__hcx, __hasher); }
{ __binding_13.stable_hash(__hcx, __hasher); }
{ __binding_14.stable_hash(__hcx, __hasher); }
{ __binding_15.stable_hash(__hcx, __hasher); }
{ __binding_16.stable_hash(__hcx, __hasher); }
{ __binding_17.stable_hash(__hcx, __hasher); }
{ __binding_18.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for Body<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
Body {
basic_blocks: __binding_0,
phase: __binding_1,
pass_count: __binding_2,
source: __binding_3,
source_scopes: __binding_4,
coroutine: __binding_5,
local_decls: __binding_6,
user_type_annotations: __binding_7,
arg_count: __binding_8,
spread_arg: __binding_9,
var_debug_info: __binding_10,
span: __binding_11,
required_consts: __binding_12,
mentioned_items: __binding_13,
is_polymorphic: __binding_14,
injection_phase: __binding_15,
tainted_by_errors: __binding_16,
coverage_early_info: __binding_17,
coverage_mir_info: __binding_18 } => {
Body {
basic_blocks: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
phase: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
pass_count: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
__folder)?,
source: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
__folder)?,
source_scopes: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
__folder)?,
coroutine: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_5,
__folder)?,
local_decls: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_6,
__folder)?,
user_type_annotations: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_7,
__folder)?,
arg_count: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_8,
__folder)?,
spread_arg: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_9,
__folder)?,
var_debug_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_10,
__folder)?,
span: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_11,
__folder)?,
required_consts: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_12,
__folder)?,
mentioned_items: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_13,
__folder)?,
is_polymorphic: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_14,
__folder)?,
injection_phase: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_15,
__folder)?,
tainted_by_errors: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_16,
__folder)?,
coverage_early_info: __binding_17,
coverage_mir_info: __binding_18,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
Body {
basic_blocks: __binding_0,
phase: __binding_1,
pass_count: __binding_2,
source: __binding_3,
source_scopes: __binding_4,
coroutine: __binding_5,
local_decls: __binding_6,
user_type_annotations: __binding_7,
arg_count: __binding_8,
spread_arg: __binding_9,
var_debug_info: __binding_10,
span: __binding_11,
required_consts: __binding_12,
mentioned_items: __binding_13,
is_polymorphic: __binding_14,
injection_phase: __binding_15,
tainted_by_errors: __binding_16,
coverage_early_info: __binding_17,
coverage_mir_info: __binding_18 } => {
Body {
basic_blocks: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
phase: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
pass_count: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
__folder),
source: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
__folder),
source_scopes: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
__folder),
coroutine: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_5,
__folder),
local_decls: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_6,
__folder),
user_type_annotations: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_7,
__folder),
arg_count: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_8,
__folder),
spread_arg: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_9,
__folder),
var_debug_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_10,
__folder),
span: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_11,
__folder),
required_consts: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_12,
__folder),
mentioned_items: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_13,
__folder),
is_polymorphic: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_14,
__folder),
injection_phase: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_15,
__folder),
tainted_by_errors: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_16,
__folder),
coverage_early_info: __binding_17,
coverage_mir_info: __binding_18,
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for Body<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
Body {
basic_blocks: ref __binding_0,
phase: ref __binding_1,
pass_count: ref __binding_2,
source: ref __binding_3,
source_scopes: ref __binding_4,
coroutine: ref __binding_5,
local_decls: ref __binding_6,
user_type_annotations: ref __binding_7,
arg_count: ref __binding_8,
spread_arg: ref __binding_9,
var_debug_info: ref __binding_10,
span: ref __binding_11,
required_consts: ref __binding_12,
mentioned_items: ref __binding_13,
is_polymorphic: ref __binding_14,
injection_phase: ref __binding_15,
tainted_by_errors: ref __binding_16, .. } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_5,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_6,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_7,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_8,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_9,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_10,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_11,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_12,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_13,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_14,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_15,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_16,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
205pub struct Body<'tcx> {
206 pub basic_blocks: BasicBlocks<'tcx>,
209
210 pub phase: MirPhase,
216
217 pub pass_count: usize,
219
220 pub source: MirSource<'tcx>,
221
222 pub source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
225
226 pub coroutine: Option<Box<CoroutineInfo<'tcx>>>,
233
234 pub local_decls: IndexVec<Local, LocalDecl<'tcx>>,
240
241 pub user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>,
243
244 pub arg_count: usize,
251
252 pub spread_arg: Option<Local>,
257
258 pub var_debug_info: Vec<VarDebugInfo<'tcx>>,
260
261 pub span: Span,
263
264 pub required_consts: Option<Vec<ConstOperand<'tcx>>>,
271
272 pub mentioned_items: Option<Vec<Spanned<MentionedItem<'tcx>>>>,
285
286 pub is_polymorphic: bool,
302
303 pub injection_phase: Option<MirPhase>,
309
310 pub tainted_by_errors: Option<ErrorGuaranteed>,
311
312 #[type_foldable(identity)]
318 #[type_visitable(ignore)]
319 pub coverage_early_info: Option<Box<coverage::CoverageEarlyInfo>>,
320
321 #[type_foldable(identity)]
328 #[type_visitable(ignore)]
329 pub coverage_mir_info: Option<Box<coverage::CoverageMirInfo>>,
330}
331
332impl<'tcx> Body<'tcx> {
333 pub fn new(
334 source: MirSource<'tcx>,
335 basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
336 source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
337 local_decls: IndexVec<Local, LocalDecl<'tcx>>,
338 user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>,
339 arg_count: usize,
340 var_debug_info: Vec<VarDebugInfo<'tcx>>,
341 span: Span,
342 coroutine: Option<Box<CoroutineInfo<'tcx>>>,
343 tainted_by_errors: Option<ErrorGuaranteed>,
344 ) -> Self {
345 if !(local_decls.len() > arg_count) {
{
::core::panicking::panic_fmt(format_args!("expected at least {0} locals, got {1}",
arg_count + 1, local_decls.len()));
}
};assert!(
347 local_decls.len() > arg_count,
348 "expected at least {} locals, got {}",
349 arg_count + 1,
350 local_decls.len()
351 );
352
353 let mut body = Body {
354 phase: MirPhase::Built,
355 pass_count: 0,
356 source,
357 basic_blocks: BasicBlocks::new(basic_blocks),
358 source_scopes,
359 coroutine,
360 local_decls,
361 user_type_annotations,
362 arg_count,
363 spread_arg: None,
364 var_debug_info,
365 span,
366 required_consts: None,
367 mentioned_items: None,
368 is_polymorphic: false,
369 injection_phase: None,
370 tainted_by_errors,
371 coverage_early_info: None,
372 coverage_mir_info: None,
373 };
374 body.is_polymorphic = body.has_non_region_param();
375 body
376 }
377
378 pub fn new_cfg_only(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>) -> Self {
384 let mut body = Body {
385 phase: MirPhase::Built,
386 pass_count: 0,
387 source: MirSource::item(CRATE_DEF_ID.to_def_id()),
388 basic_blocks: BasicBlocks::new(basic_blocks),
389 source_scopes: IndexVec::new(),
390 coroutine: None,
391 local_decls: IndexVec::new(),
392 user_type_annotations: IndexVec::new(),
393 arg_count: 0,
394 spread_arg: None,
395 span: DUMMY_SP,
396 required_consts: None,
397 mentioned_items: None,
398 var_debug_info: Vec::new(),
399 is_polymorphic: false,
400 injection_phase: None,
401 tainted_by_errors: None,
402 coverage_early_info: None,
403 coverage_mir_info: None,
404 };
405 body.is_polymorphic = body.has_non_region_param();
406 body
407 }
408
409 #[inline]
410 pub fn basic_blocks_mut(&mut self) -> &mut IndexVec<BasicBlock, BasicBlockData<'tcx>> {
411 self.basic_blocks.as_mut()
412 }
413
414 pub fn typing_env(&self, tcx: TyCtxt<'tcx>) -> TypingEnv<'tcx> {
415 if tcx.use_typing_mode_post_typeck_through_borrowck() {
416 match self.phase {
417 MirPhase::Built | MirPhase::Analysis(AnalysisPhase::Initial) => {
420 let local_def_id = self
421 .source
422 .def_id()
423 .as_local()
424 .expect("We only build MIR for local bodies");
425 TypingEnv::new(
426 tcx.param_env(self.source.def_id()),
427 ty::TypingMode::borrowck(tcx, local_def_id),
428 )
429 }
430 MirPhase::Analysis(AnalysisPhase::PostCleanup) | MirPhase::Runtime(_) => {
431 TypingEnv::post_analysis_no_rigid_aliases(tcx, self.source.def_id())
432 }
433 }
434 } else {
435 match self.phase {
436 MirPhase::Built | MirPhase::Analysis(AnalysisPhase::Initial) => TypingEnv::new(
437 tcx.param_env(self.source.def_id()),
438 ty::TypingMode::non_body_analysis(),
439 ),
440 MirPhase::Analysis(AnalysisPhase::PostCleanup) | MirPhase::Runtime(_) => {
441 TypingEnv::post_analysis_no_rigid_aliases(tcx, self.source.def_id())
442 }
443 }
444 }
445 }
446
447 #[inline]
448 pub fn local_kind(&self, local: Local) -> LocalKind {
449 let index = local.as_usize();
450 if index == 0 {
451 if true {
if !(self.local_decls[local].mutability == Mutability::Mut) {
{
::core::panicking::panic_fmt(format_args!("return place should be mutable"));
}
};
};debug_assert!(
452 self.local_decls[local].mutability == Mutability::Mut,
453 "return place should be mutable"
454 );
455
456 LocalKind::ReturnPointer
457 } else if index < self.arg_count + 1 {
458 LocalKind::Arg
459 } else {
460 LocalKind::Temp
461 }
462 }
463
464 #[inline]
466 pub fn mut_vars_iter(&self) -> impl Iterator<Item = Local> {
467 (self.arg_count + 1..self.local_decls.len()).filter_map(move |index| {
468 let local = Local::new(index);
469 let decl = &self.local_decls[local];
470 (decl.is_user_variable() && decl.mutability.is_mut()).then_some(local)
471 })
472 }
473
474 #[inline]
476 pub fn mut_vars_and_args_iter(&self) -> impl Iterator<Item = Local> {
477 (1..self.local_decls.len()).filter_map(move |index| {
478 let local = Local::new(index);
479 let decl = &self.local_decls[local];
480 if (decl.is_user_variable() || index < self.arg_count + 1)
481 && decl.mutability == Mutability::Mut
482 {
483 Some(local)
484 } else {
485 None
486 }
487 })
488 }
489
490 #[inline]
492 pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator + use<> {
493 (1..self.arg_count + 1).map(Local::new)
494 }
495
496 #[inline]
499 pub fn vars_and_temps_iter(
500 &self,
501 ) -> impl DoubleEndedIterator<Item = Local> + ExactSizeIterator {
502 (self.arg_count + 1..self.local_decls.len()).map(Local::new)
503 }
504
505 #[inline]
506 pub fn drain_vars_and_temps(&mut self) -> impl Iterator<Item = LocalDecl<'tcx>> {
507 self.local_decls.drain(self.arg_count + 1..)
508 }
509
510 pub fn source_info(&self, location: Location) -> &SourceInfo {
512 let block = &self[location.block];
513 let stmts = &block.statements;
514 let idx = location.statement_index;
515 if idx < stmts.len() {
516 &stmts[idx].source_info
517 } else {
518 {
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());
519 &block.terminator.source_info
520 }
521 }
522
523 #[inline]
525 pub fn return_ty(&self) -> Ty<'tcx> {
526 self.local_decls[RETURN_PLACE].ty
527 }
528
529 #[inline]
531 pub fn bound_return_ty(&self, tcx: TyCtxt<'tcx>) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
532 ty::EarlyBinder::bind(tcx, self.local_decls[RETURN_PLACE].ty)
533 }
534
535 #[inline]
537 pub fn terminator_loc(&self, bb: BasicBlock) -> Location {
538 Location { block: bb, statement_index: self[bb].statements.len() }
539 }
540
541 pub fn stmt_at(&self, location: Location) -> Either<&Statement<'tcx>, &Terminator<'tcx>> {
542 let Location { block, statement_index } = location;
543 let block_data = &self.basic_blocks[block];
544 block_data
545 .statements
546 .get(statement_index)
547 .map(Either::Left)
548 .unwrap_or_else(|| Either::Right(&block_data.terminator))
549 }
550
551 #[inline]
552 pub fn yield_ty(&self) -> Option<Ty<'tcx>> {
553 self.coroutine.as_ref().and_then(|coroutine| coroutine.yield_ty)
554 }
555
556 #[inline]
557 pub fn resume_ty(&self) -> Option<Ty<'tcx>> {
558 self.coroutine.as_ref().and_then(|coroutine| coroutine.resume_ty)
559 }
560
561 #[inline]
563 pub fn coroutine_layout_raw(&self) -> Option<&CoroutineLayout<'tcx>> {
564 self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_layout.as_ref())
565 }
566
567 #[inline]
568 pub fn coroutine_drop(&self) -> Option<&Body<'tcx>> {
569 self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_drop.as_ref())
570 }
571
572 #[inline]
573 pub fn coroutine_drop_async(&self) -> Option<&Body<'tcx>> {
574 self.coroutine.as_ref().and_then(|coroutine| coroutine.coroutine_drop_async.as_ref())
575 }
576
577 #[inline]
578 pub fn coroutine_requires_async_drop(&self) -> bool {
579 self.coroutine_drop_async().is_some()
580 }
581
582 #[inline]
583 pub fn future_drop_poll(&self) -> Option<&Body<'tcx>> {
584 self.coroutine.as_ref().and_then(|coroutine| {
585 coroutine
586 .coroutine_drop_async
587 .as_ref()
588 .or(coroutine.coroutine_drop_proxy_async.as_ref())
589 })
590 }
591
592 #[inline]
593 pub fn coroutine_kind(&self) -> Option<CoroutineKind> {
594 self.coroutine.as_ref().map(|coroutine| coroutine.coroutine_kind)
595 }
596
597 #[inline]
598 pub fn should_skip(&self) -> bool {
599 let Some(injection_phase) = self.injection_phase else {
600 return false;
601 };
602 injection_phase > self.phase
603 }
604
605 #[inline]
606 pub fn is_custom_mir(&self) -> bool {
607 self.injection_phase.is_some()
608 }
609
610 fn try_const_mono_switchint<'a>(
614 tcx: TyCtxt<'tcx>,
615 instance: Instance<'tcx>,
616 block: &'a BasicBlockData<'tcx>,
617 ) -> Option<(u128, &'a SwitchTargets)> {
618 let eval_mono_const = |constant: &ConstOperand<'tcx>| {
620 let typing_env = ty::TypingEnv::fully_monomorphized();
622 let mono_literal = instance.instantiate_mir_and_normalize_erasing_regions(
623 tcx,
624 typing_env,
625 crate::ty::EarlyBinder::bind(tcx, constant.const_),
626 );
627 mono_literal.try_eval_bits(tcx, typing_env)
628 };
629
630 let TerminatorKind::SwitchInt { discr, targets } = &block.terminator.kind else {
631 return None;
632 };
633
634 let discr = match discr {
636 Operand::Constant(constant) => {
637 let bits = eval_mono_const(constant)?;
638 return Some((bits, targets));
639 }
640 Operand::RuntimeChecks(check) => {
641 let bits = check.value(tcx.sess) as u128;
642 return Some((bits, targets));
643 }
644 Operand::Move(place) | Operand::Copy(place) => place,
645 };
646
647 let last_stmt = block.statements.iter().rev().find(|stmt| {
663 !#[allow(non_exhaustive_omitted_patterns)] match stmt.kind {
StatementKind::StorageDead(_) | StatementKind::StorageLive(_) => true,
_ => false,
}matches!(stmt.kind, StatementKind::StorageDead(_) | StatementKind::StorageLive(_))
664 })?;
665
666 let (place, rvalue) = last_stmt.kind.as_assign()?;
667
668 if discr != place {
669 return None;
670 }
671
672 match rvalue {
673 Rvalue::Use(Operand::Constant(constant), _) => {
674 let bits = eval_mono_const(constant)?;
675 Some((bits, targets))
676 }
677 _ => None,
678 }
679 }
680
681 pub fn caller_location_span<T>(
686 &self,
687 mut source_info: SourceInfo,
688 caller_location: Option<T>,
689 tcx: TyCtxt<'tcx>,
690 from_span: impl FnOnce(Span) -> T,
691 ) -> T {
692 loop {
693 let scope_data = &self.source_scopes[source_info.scope];
694
695 if let Some((callee, callsite_span)) = scope_data.inlined {
696 if !callee.def.requires_caller_location(tcx) {
699 return from_span(source_info.span);
700 }
701 source_info.span = callsite_span;
702 }
703
704 match scope_data.inlined_parent_scope {
706 Some(parent) => source_info.scope = parent,
707 None => break,
708 }
709 }
710
711 caller_location.unwrap_or_else(|| from_span(source_info.span))
713 }
714
715 #[track_caller]
716 pub fn set_required_consts(&mut self, required_consts: Vec<ConstOperand<'tcx>>) {
717 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!(
718 self.required_consts.is_none(),
719 "required_consts for {:?} have already been set",
720 self.source.def_id()
721 );
722 self.required_consts = Some(required_consts);
723 }
724 #[track_caller]
725 pub fn required_consts(&self) -> &[ConstOperand<'tcx>] {
726 match &self.required_consts {
727 Some(l) => l,
728 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()),
729 }
730 }
731
732 #[track_caller]
733 pub fn set_mentioned_items(&mut self, mentioned_items: Vec<Spanned<MentionedItem<'tcx>>>) {
734 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!(
735 self.mentioned_items.is_none(),
736 "mentioned_items for {:?} have already been set",
737 self.source.def_id()
738 );
739 self.mentioned_items = Some(mentioned_items);
740 }
741 #[track_caller]
742 pub fn mentioned_items(&self) -> &[Spanned<MentionedItem<'tcx>>] {
743 match &self.mentioned_items {
744 Some(l) => l,
745 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()),
746 }
747 }
748}
749
750impl<'tcx> Index<BasicBlock> for Body<'tcx> {
751 type Output = BasicBlockData<'tcx>;
752
753 #[inline]
754 fn index(&self, index: BasicBlock) -> &BasicBlockData<'tcx> {
755 &self.basic_blocks[index]
756 }
757}
758
759impl<'tcx> IndexMut<BasicBlock> for Body<'tcx> {
760 #[inline]
761 fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx> {
762 &mut self.basic_blocks.as_mut()[index]
763 }
764}
765
766#[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]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
match self {
Self::Clear => ClearCrossCrate::Clear,
Self::Set(__self_0) =>
ClearCrossCrate::Set(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, #[automatically_derived]impl<T: ::core::fmt::Debug> ::core::fmt::Debug for
ClearCrossCrate<T> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Clear => ::core::fmt::Formatter::write_str(f, "Clear"),
Self::Set(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Set",
&__self_0),
}
}
}Debug, const _: () =
{
impl<T> ::rustc_data_structures::stable_hash::StableHash for
ClearCrossCrate<T> where
T: ::rustc_data_structures::stable_hash::StableHash {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
ClearCrossCrate::Clear => 0u8.stable_hash(__hcx, __hasher),
ClearCrossCrate::Set(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
ClearCrossCrate::Clear => {}
ClearCrossCrate::Set(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx, T>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for ClearCrossCrate<T> where
T: ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
{
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
ClearCrossCrate::Clear => { ClearCrossCrate::Clear }
ClearCrossCrate::Set(__binding_0) => {
ClearCrossCrate::Set(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
ClearCrossCrate::Clear => { ClearCrossCrate::Clear }
ClearCrossCrate::Set(__binding_0) => {
ClearCrossCrate::Set(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx, T>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for ClearCrossCrate<T> where
T: ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
{
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
ClearCrossCrate::Clear => {}
ClearCrossCrate::Set(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
767pub enum ClearCrossCrate<T> {
768 Clear,
769 Set(T),
770}
771
772impl<T> ClearCrossCrate<T> {
773 pub fn as_ref(&self) -> ClearCrossCrate<&T> {
774 match self {
775 ClearCrossCrate::Clear => ClearCrossCrate::Clear,
776 ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
777 }
778 }
779
780 pub fn as_mut(&mut self) -> ClearCrossCrate<&mut T> {
781 match self {
782 ClearCrossCrate::Clear => ClearCrossCrate::Clear,
783 ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
784 }
785 }
786
787 pub fn unwrap_crate_local(self) -> T {
788 match self {
789 ClearCrossCrate::Clear => ::rustc_span::macros::bug_impl(None,
format_args!("unwrapping cross-crate data"), Location::caller())bug!("unwrapping cross-crate data"),
790 ClearCrossCrate::Set(v) => v,
791 }
792 }
793}
794
795const TAG_CLEAR_CROSS_CRATE_CLEAR: u8 = 0;
796const TAG_CLEAR_CROSS_CRATE_SET: u8 = 1;
797
798impl<'tcx, E: TyEncoder<'tcx>, T: Encodable<E>> Encodable<E> for ClearCrossCrate<T> {
799 #[inline]
800 fn encode(&self, e: &mut E) {
801 if E::CLEAR_CROSS_CRATE {
802 return;
803 }
804
805 match *self {
806 ClearCrossCrate::Clear => TAG_CLEAR_CROSS_CRATE_CLEAR.encode(e),
807 ClearCrossCrate::Set(ref val) => {
808 TAG_CLEAR_CROSS_CRATE_SET.encode(e);
809 val.encode(e);
810 }
811 }
812 }
813}
814impl<'tcx, D: TyDecoder<'tcx>, T: Decodable<D>> Decodable<D> for ClearCrossCrate<T> {
815 #[inline]
816 fn decode(d: &mut D) -> ClearCrossCrate<T> {
817 if D::CLEAR_CROSS_CRATE {
818 return ClearCrossCrate::Clear;
819 }
820
821 let discr = u8::decode(d);
822
823 match discr {
824 TAG_CLEAR_CROSS_CRATE_CLEAR => ClearCrossCrate::Clear,
825 TAG_CLEAR_CROSS_CRATE_SET => {
826 let val = T::decode(d);
827 ClearCrossCrate::Set(val)
828 }
829 tag => {
::core::panicking::panic_fmt(format_args!("Invalid tag for ClearCrossCrate: {0:?}",
tag));
}panic!("Invalid tag for ClearCrossCrate: {tag:?}"),
830 }
831 }
832}
833
834#[derive(#[automatically_derived]impl ::core::marker::Copy for SourceInfo { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for SourceInfo {
}
#[automatically_derived]impl ::core::clone::Clone for SourceInfo {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<SourceScope>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for SourceInfo {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"SourceInfo span scope", &self.span, &&self.scope)
}
}Debug, #[automatically_derived]impl ::core::cmp::Eq for SourceInfo {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<Span>;
let _: ::core::cmp::AssertParamIsEq<SourceScope>;
}
}Eq, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
SourceInfo {
}
#[automatically_derived]impl ::core::cmp::PartialEq for SourceInfo {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.span == other.span && self.scope == other.scope
}
}PartialEq, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for SourceInfo {
fn encode(&self, __encoder: &mut __E) {
let SourceInfo { span: ref __binding_0, scope: ref __binding_1
} = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for SourceInfo {
fn decode(__decoder: &mut __D) -> Self {
SourceInfo {
span: ::rustc_serialize::Decodable::decode(__decoder),
scope: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, #[automatically_derived]impl ::core::hash::Hash for SourceInfo {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.span, state);
::core::hash::Hash::hash(&self.scope, state)
}
}Hash, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for SourceInfo {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
SourceInfo { span: ref __binding_0, scope: ref __binding_1 }
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
840pub struct SourceInfo {
841 pub span: Span,
843
844 pub scope: SourceScope,
847}
848
849impl SourceInfo {
850 #[inline]
851 pub fn outermost(span: Span) -> Self {
852 SourceInfo { span, scope: OUTERMOST_SOURCE_SCOPE }
853 }
854}
855
856#[automatically_derived]impl ::core::marker::Copy for Local { }
pub const RETURN_PLACE: Local = Local::from_u32(0);
impl Local {
#[doc = r" Maximum value the index can take, as a `u32`."]
pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
#[doc = r" Maximum value the index can take."]
pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
#[doc = r" Zero value of the index."]
pub const ZERO: Self = Self::from_u32(0);
#[doc = r" Creates a new index from a given `usize`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_usize(value: usize) -> Self {
if !(value <= (0xFFFF_FF00 as usize)) {
::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
};
unsafe { Self::from_u32_unchecked(value as u32) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_u32(value: u32) -> Self {
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u16`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_u16(value: u16) -> Self {
let value = value as u32;
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Safety"]
#[doc = r""]
#[doc =
r" The provided value must be less than or equal to the maximum value for the newtype."]
#[doc =
r" Providing a value outside this range is undefined due to layout restrictions."]
#[doc = r""]
#[doc = r" Prefer using `from_u32`."]
#[inline]
pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
Self {
private_use_as_methods_instead: unsafe {
std::mem::transmute(value)
},
}
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub const fn index(self) -> usize { self.as_usize() }
#[doc = r" Extracts the value of this index as a `u32`."]
#[inline]
pub const fn as_u32(self) -> u32 {
unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for Local {
type Output = Self;
#[inline]
fn add(self, other: usize) -> Self {
Self::from_usize(self.index() + other)
}
}
impl std::ops::AddAssign<usize> for Local {
#[inline]
fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for Local {
#[inline]
fn new(value: usize) -> Self { Self::from_usize(value) }
#[inline]
fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for Local {
#[inline]
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
<usize as
::std::iter::Step>::steps_between(&Self::index(*start),
&Self::index(*end))
}
#[inline]
fn forward_checked(start: Self, u: usize) -> Option<Self> {
Self::index(start).checked_add(u).map(Self::from_usize)
}
#[inline]
fn backward_checked(start: Self, u: usize) -> Option<Self> {
Self::index(start).checked_sub(u).map(Self::from_usize)
}
#[inline]
fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
let (s, o) = Self::index(start).overflowing_add(u);
(Self::from_usize(s), o)
}
#[inline]
fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
let (s, o) = Self::index(start).overflowing_sub(u);
(Self::from_usize(s), o)
}
}
impl ::std::cmp::Ord for Local {
#[inline]
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.as_u32().cmp(&other.as_u32())
}
}
impl ::std::cmp::PartialOrd for Local {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl ::rustc_data_structures::stable_hash::StableHash for Local {
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
hcx: &mut __Hcx,
hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
self.as_u32().stable_hash(hcx, hasher)
}
}
impl From<Local> for u32 {
#[inline]
fn from(v: Local) -> u32 { v.as_u32() }
}
impl From<Local> for usize {
#[inline]
fn from(v: Local) -> usize { v.as_usize() }
}
impl From<usize> for Local {
#[inline]
fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for Local {
#[inline]
fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for Local {}
impl ::std::cmp::PartialEq for Local {
fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for Local {}
impl ::std::hash::Hash for Local {
fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
self.as_u32().hash(state)
}
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for Local
{
fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for Local
{
fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for Local {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
fmt.write_fmt(format_args!("_{0}", self.as_u32()))
}
}rustc_index::newtype_index! {
860 #[stable_hash]
861 #[encodable]
862 #[orderable]
863 #[debug_format = "_{}"]
864 pub struct Local {
865 const RETURN_PLACE = 0;
866 }
867}
868
869impl Local {
870 pub const fn arg(i: usize) -> Local {
875 Local::from_usize(i + 1)
876 }
877}
878
879impl Atom for Local {
880 fn index(self) -> usize {
881 Idx::index(self)
882 }
883}
884
885#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for LocalKind {
}
#[automatically_derived]impl ::core::clone::Clone for LocalKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::Copy for LocalKind { }Copy, #[automatically_derived]impl ::core::marker::StructuralPartialEq for LocalKind
{
}
#[automatically_derived]impl ::core::cmp::PartialEq for LocalKind {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for LocalKind { }Eq, #[automatically_derived]impl ::core::fmt::Debug for LocalKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
LocalKind::Temp => "Temp",
LocalKind::Arg => "Arg",
LocalKind::ReturnPointer => "ReturnPointer",
})
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for LocalKind {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
LocalKind::Temp => 0u8.stable_hash(__hcx, __hasher),
LocalKind::Arg => 1u8.stable_hash(__hcx, __hasher),
LocalKind::ReturnPointer =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
LocalKind::Temp => {}
LocalKind::Arg => {}
LocalKind::ReturnPointer => {}
}
}
}
};StableHash)]
887pub enum LocalKind {
888 Temp,
890 Arg,
892 ReturnPointer,
894}
895
896#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for
VarBindingForm<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
VarBindingForm {
binding_mode: ::core::clone::Clone::clone(&self.binding_mode),
opt_ty_info: ::core::clone::Clone::clone(&self.opt_ty_info),
opt_match_place: ::core::clone::Clone::clone(&self.opt_match_place),
pat_span: ::core::clone::Clone::clone(&self.pat_span),
introductions: ::core::clone::Clone::clone(&self.introductions),
}
}
}Clone, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for VarBindingForm<'tcx>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"VarBindingForm binding_mode opt_ty_info opt_match_place pat_span introductions",
&self.binding_mode, &self.opt_ty_info, &self.opt_match_place,
&self.pat_span, &&self.introductions)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for VarBindingForm<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let VarBindingForm {
binding_mode: ref __binding_0,
opt_ty_info: ref __binding_1,
opt_match_place: ref __binding_2,
pat_span: ref __binding_3,
introductions: ref __binding_4 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for VarBindingForm<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
VarBindingForm {
binding_mode: ::rustc_serialize::Decodable::decode(__decoder),
opt_ty_info: ::rustc_serialize::Decodable::decode(__decoder),
opt_match_place: ::rustc_serialize::Decodable::decode(__decoder),
pat_span: ::rustc_serialize::Decodable::decode(__decoder),
introductions: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
VarBindingForm<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
VarBindingForm {
binding_mode: ref __binding_0,
opt_ty_info: ref __binding_1,
opt_match_place: ref __binding_2,
pat_span: ref __binding_3,
introductions: ref __binding_4 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
897pub struct VarBindingForm<'tcx> {
898 pub binding_mode: BindingMode,
900 pub opt_ty_info: Option<Span>,
907 pub opt_match_place: Option<(Option<Place<'tcx>>, Span)>,
914 pub pat_span: Span,
916 pub introductions: Vec<VarBindingIntroduction>,
919}
920
921#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for BindingForm<'tcx>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
match self {
Self::Var(__self_0) =>
BindingForm::Var(::core::clone::Clone::clone(__self_0)),
Self::ImplicitSelf(__self_0) =>
BindingForm::ImplicitSelf(::core::clone::Clone::clone(__self_0)),
Self::RefForGuard(__self_0) =>
BindingForm::RefForGuard(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for BindingForm<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Var(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Var",
&__self_0),
Self::ImplicitSelf(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ImplicitSelf", &__self_0),
Self::RefForGuard(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"RefForGuard", &__self_0),
}
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for BindingForm<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
BindingForm::Var(ref __binding_0) => { 0usize }
BindingForm::ImplicitSelf(ref __binding_0) => { 1usize }
BindingForm::RefForGuard(ref __binding_0) => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
BindingForm::Var(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
BindingForm::ImplicitSelf(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
BindingForm::RefForGuard(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for BindingForm<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
BindingForm::Var(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
BindingForm::ImplicitSelf(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
BindingForm::RefForGuard(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `BindingForm`, expected 0..3, actual {0}",
n));
}
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
BindingForm<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
BindingForm::Var(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
BindingForm::ImplicitSelf(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
BindingForm::RefForGuard(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
BindingForm::Var(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
BindingForm::ImplicitSelf(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
BindingForm::RefForGuard(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
922pub enum BindingForm<'tcx> {
923 Var(VarBindingForm<'tcx>),
925 ImplicitSelf(ImplicitSelfKind),
927 RefForGuard(Local),
929}
930
931#[derive(#[automatically_derived]impl ::core::clone::Clone for VarBindingIntroduction {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
VarBindingIntroduction {
span: ::core::clone::Clone::clone(&self.span),
is_shorthand: ::core::clone::Clone::clone(&self.is_shorthand),
}
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for VarBindingIntroduction {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"VarBindingIntroduction span is_shorthand", &self.span,
&&self.is_shorthand)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for VarBindingIntroduction {
fn encode(&self, __encoder: &mut __E) {
let VarBindingIntroduction {
span: ref __binding_0, is_shorthand: ref __binding_1 } =
*self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for VarBindingIntroduction {
fn decode(__decoder: &mut __D) -> Self {
VarBindingIntroduction {
span: ::rustc_serialize::Decodable::decode(__decoder),
is_shorthand: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
VarBindingIntroduction {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
VarBindingIntroduction {
span: ref __binding_0, is_shorthand: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
932pub struct VarBindingIntroduction {
933 pub span: Span,
935 pub is_shorthand: bool,
937}
938
939#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for BlockTailInfo {
}
#[automatically_derived]impl ::core::clone::Clone for BlockTailInfo {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for BlockTailInfo { }Copy, #[automatically_derived]impl ::core::fmt::Debug for BlockTailInfo {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"BlockTailInfo tail_result_is_ignored span",
&self.tail_result_is_ignored, &&self.span)
}
}Debug, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
BlockTailInfo {
}
#[automatically_derived]impl ::core::cmp::PartialEq for BlockTailInfo {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.tail_result_is_ignored == other.tail_result_is_ignored &&
self.span == other.span
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for BlockTailInfo {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<bool>;
let _: ::core::cmp::AssertParamIsEq<Span>;
}
}Eq, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for BlockTailInfo {
fn encode(&self, __encoder: &mut __E) {
let BlockTailInfo {
tail_result_is_ignored: ref __binding_0,
span: ref __binding_1 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for BlockTailInfo {
fn decode(__decoder: &mut __D) -> Self {
BlockTailInfo {
tail_result_is_ignored: ::rustc_serialize::Decodable::decode(__decoder),
span: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
BlockTailInfo {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
BlockTailInfo {
tail_result_is_ignored: ref __binding_0,
span: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
948pub struct BlockTailInfo {
949 pub tail_result_is_ignored: bool,
955
956 pub span: Span,
958}
959
960#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for LocalDecl<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
LocalDecl {
mutability: ::core::clone::Clone::clone(&self.mutability),
local_info: ::core::clone::Clone::clone(&self.local_info),
ty: ::core::clone::Clone::clone(&self.ty),
user_ty: ::core::clone::Clone::clone(&self.user_ty),
source_info: ::core::clone::Clone::clone(&self.source_info),
}
}
}Clone, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for LocalDecl<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"LocalDecl mutability local_info ty user_ty source_info",
&self.mutability, &self.local_info, &self.ty, &self.user_ty,
&&self.source_info)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for LocalDecl<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let LocalDecl {
mutability: ref __binding_0,
local_info: ref __binding_1,
ty: ref __binding_2,
user_ty: ref __binding_3,
source_info: ref __binding_4 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for LocalDecl<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
LocalDecl {
mutability: ::rustc_serialize::Decodable::decode(__decoder),
local_info: ::rustc_serialize::Decodable::decode(__decoder),
ty: ::rustc_serialize::Decodable::decode(__decoder),
user_ty: ::rustc_serialize::Decodable::decode(__decoder),
source_info: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
LocalDecl<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
LocalDecl {
mutability: ref __binding_0,
local_info: ref __binding_1,
ty: ref __binding_2,
user_ty: ref __binding_3,
source_info: ref __binding_4 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for LocalDecl<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
LocalDecl {
mutability: __binding_0,
local_info: __binding_1,
ty: __binding_2,
user_ty: __binding_3,
source_info: __binding_4 } => {
LocalDecl {
mutability: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
local_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
__folder)?,
user_ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
__folder)?,
source_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
__folder)?,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
LocalDecl {
mutability: __binding_0,
local_info: __binding_1,
ty: __binding_2,
user_ty: __binding_3,
source_info: __binding_4 } => {
LocalDecl {
mutability: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
local_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
__folder),
user_ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
__folder),
source_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
__folder),
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for LocalDecl<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
LocalDecl {
mutability: ref __binding_0,
local_info: ref __binding_1,
ty: ref __binding_2,
user_ty: ref __binding_3,
source_info: ref __binding_4 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
965pub struct LocalDecl<'tcx> {
966 pub mutability: Mutability,
970
971 pub local_info: ClearCrossCrate<Box<LocalInfo<'tcx>>>,
972
973 pub ty: Ty<'tcx>,
975
976 pub user_ty: Option<Box<UserTypeProjections>>,
981
982 pub source_info: SourceInfo,
1063}
1064
1065#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for LocalInfo<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
match self {
Self::User(__self_0) =>
LocalInfo::User(::core::clone::Clone::clone(__self_0)),
Self::StaticRef { def_id: __self_0, is_thread_local: __self_1 } =>
LocalInfo::StaticRef {
def_id: ::core::clone::Clone::clone(__self_0),
is_thread_local: ::core::clone::Clone::clone(__self_1),
},
Self::ConstRef { def_id: __self_0 } =>
LocalInfo::ConstRef {
def_id: ::core::clone::Clone::clone(__self_0),
},
Self::AggregateTemp => LocalInfo::AggregateTemp,
Self::BlockTailTemp(__self_0) =>
LocalInfo::BlockTailTemp(::core::clone::Clone::clone(__self_0)),
Self::IfThenRescopeTemp { if_then: __self_0 } =>
LocalInfo::IfThenRescopeTemp {
if_then: ::core::clone::Clone::clone(__self_0),
},
Self::DerefTemp => LocalInfo::DerefTemp,
Self::FakeBorrow => LocalInfo::FakeBorrow,
Self::Boring => LocalInfo::Boring,
}
}
}Clone, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for LocalInfo<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::User(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "User",
&__self_0),
Self::StaticRef { def_id: __self_0, is_thread_local: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"StaticRef def_id is_thread_local", __self_0, &__self_1),
Self::ConstRef { def_id: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ConstRef def_id", &__self_0),
Self::AggregateTemp =>
::core::fmt::Formatter::write_str(f, "AggregateTemp"),
Self::BlockTailTemp(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"BlockTailTemp", &__self_0),
Self::IfThenRescopeTemp { if_then: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"IfThenRescopeTemp if_then", &__self_0),
Self::DerefTemp =>
::core::fmt::Formatter::write_str(f, "DerefTemp"),
Self::FakeBorrow =>
::core::fmt::Formatter::write_str(f, "FakeBorrow"),
Self::Boring => ::core::fmt::Formatter::write_str(f, "Boring"),
}
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for LocalInfo<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
LocalInfo::User(ref __binding_0) => { 0usize }
LocalInfo::StaticRef {
def_id: ref __binding_0, is_thread_local: ref __binding_1 }
=> {
1usize
}
LocalInfo::ConstRef { def_id: ref __binding_0 } => {
2usize
}
LocalInfo::AggregateTemp => { 3usize }
LocalInfo::BlockTailTemp(ref __binding_0) => { 4usize }
LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
{
5usize
}
LocalInfo::DerefTemp => { 6usize }
LocalInfo::FakeBorrow => { 7usize }
LocalInfo::Boring => { 8usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
LocalInfo::User(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
LocalInfo::StaticRef {
def_id: ref __binding_0, is_thread_local: ref __binding_1 }
=> {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
LocalInfo::ConstRef { def_id: ref __binding_0 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
LocalInfo::AggregateTemp => {}
LocalInfo::BlockTailTemp(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
{
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
LocalInfo::DerefTemp => {}
LocalInfo::FakeBorrow => {}
LocalInfo::Boring => {}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for LocalInfo<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
LocalInfo::User(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
LocalInfo::StaticRef {
def_id: ::rustc_serialize::Decodable::decode(__decoder),
is_thread_local: ::rustc_serialize::Decodable::decode(__decoder),
}
}
2usize => {
LocalInfo::ConstRef {
def_id: ::rustc_serialize::Decodable::decode(__decoder),
}
}
3usize => { LocalInfo::AggregateTemp }
4usize => {
LocalInfo::BlockTailTemp(::rustc_serialize::Decodable::decode(__decoder))
}
5usize => {
LocalInfo::IfThenRescopeTemp {
if_then: ::rustc_serialize::Decodable::decode(__decoder),
}
}
6usize => { LocalInfo::DerefTemp }
7usize => { LocalInfo::FakeBorrow }
8usize => { LocalInfo::Boring }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `LocalInfo`, expected 0..9, actual {0}",
n));
}
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
LocalInfo<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
LocalInfo::User(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
LocalInfo::StaticRef {
def_id: ref __binding_0, is_thread_local: ref __binding_1 }
=> 1u8.stable_hash(__hcx, __hasher),
LocalInfo::ConstRef { def_id: ref __binding_0 } =>
2u8.stable_hash(__hcx, __hasher),
LocalInfo::AggregateTemp =>
3u8.stable_hash(__hcx, __hasher),
LocalInfo::BlockTailTemp(ref __binding_0) =>
4u8.stable_hash(__hcx, __hasher),
LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
5u8.stable_hash(__hcx, __hasher),
LocalInfo::DerefTemp => 6u8.stable_hash(__hcx, __hasher),
LocalInfo::FakeBorrow => 7u8.stable_hash(__hcx, __hasher),
LocalInfo::Boring => 8u8.stable_hash(__hcx, __hasher),
}
match *self {
LocalInfo::User(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
LocalInfo::StaticRef {
def_id: ref __binding_0, is_thread_local: ref __binding_1 }
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
LocalInfo::ConstRef { def_id: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
LocalInfo::AggregateTemp => {}
LocalInfo::BlockTailTemp(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
}
LocalInfo::DerefTemp => {}
LocalInfo::FakeBorrow => {}
LocalInfo::Boring => {}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for LocalInfo<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
LocalInfo::User(__binding_0) => {
LocalInfo::User(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
LocalInfo::StaticRef {
def_id: __binding_0, is_thread_local: __binding_1 } => {
LocalInfo::StaticRef {
def_id: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
is_thread_local: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
}
}
LocalInfo::ConstRef { def_id: __binding_0 } => {
LocalInfo::ConstRef {
def_id: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
}
}
LocalInfo::AggregateTemp => { LocalInfo::AggregateTemp }
LocalInfo::BlockTailTemp(__binding_0) => {
LocalInfo::BlockTailTemp(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
LocalInfo::IfThenRescopeTemp { if_then: __binding_0 } => {
LocalInfo::IfThenRescopeTemp {
if_then: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
}
}
LocalInfo::DerefTemp => { LocalInfo::DerefTemp }
LocalInfo::FakeBorrow => { LocalInfo::FakeBorrow }
LocalInfo::Boring => { LocalInfo::Boring }
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
LocalInfo::User(__binding_0) => {
LocalInfo::User(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
LocalInfo::StaticRef {
def_id: __binding_0, is_thread_local: __binding_1 } => {
LocalInfo::StaticRef {
def_id: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
is_thread_local: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
}
}
LocalInfo::ConstRef { def_id: __binding_0 } => {
LocalInfo::ConstRef {
def_id: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
}
}
LocalInfo::AggregateTemp => { LocalInfo::AggregateTemp }
LocalInfo::BlockTailTemp(__binding_0) => {
LocalInfo::BlockTailTemp(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
LocalInfo::IfThenRescopeTemp { if_then: __binding_0 } => {
LocalInfo::IfThenRescopeTemp {
if_then: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
}
}
LocalInfo::DerefTemp => { LocalInfo::DerefTemp }
LocalInfo::FakeBorrow => { LocalInfo::FakeBorrow }
LocalInfo::Boring => { LocalInfo::Boring }
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for LocalInfo<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
LocalInfo::User(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
LocalInfo::StaticRef {
def_id: ref __binding_0, is_thread_local: ref __binding_1 }
=> {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
LocalInfo::ConstRef { def_id: ref __binding_0 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
LocalInfo::AggregateTemp => {}
LocalInfo::BlockTailTemp(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
LocalInfo::IfThenRescopeTemp { if_then: ref __binding_0 } =>
{
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
LocalInfo::DerefTemp => {}
LocalInfo::FakeBorrow => {}
LocalInfo::Boring => {}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
1072pub enum LocalInfo<'tcx> {
1073 User(BindingForm<'tcx>),
1079 StaticRef { def_id: DefId, is_thread_local: bool },
1081 ConstRef { def_id: DefId },
1083 AggregateTemp,
1086 BlockTailTemp(BlockTailInfo),
1089 IfThenRescopeTemp { if_then: HirId },
1092 DerefTemp,
1098 FakeBorrow,
1100 Boring,
1102}
1103
1104impl<'tcx> LocalDecl<'tcx> {
1105 pub fn local_info(&self) -> &LocalInfo<'tcx> {
1106 self.local_info.as_ref().unwrap_crate_local()
1107 }
1108
1109 pub fn can_be_made_mutable(&self) -> bool {
1116 #[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!(
1117 self.local_info(),
1118 LocalInfo::User(
1119 BindingForm::Var(VarBindingForm { binding_mode: BindingMode(ByRef::No, _), .. })
1120 | BindingForm::ImplicitSelf(ImplicitSelfKind::Imm),
1121 )
1122 )
1123 }
1124
1125 pub fn is_nonref_binding(&self) -> bool {
1129 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::User(BindingForm::Var(VarBindingForm {
binding_mode: BindingMode(ByRef::No, _), .. }) |
BindingForm::ImplicitSelf(_)) => true,
_ => false,
}matches!(
1130 self.local_info(),
1131 LocalInfo::User(
1132 BindingForm::Var(VarBindingForm { binding_mode: BindingMode(ByRef::No, _), .. })
1133 | BindingForm::ImplicitSelf(_),
1134 )
1135 )
1136 }
1137
1138 #[inline]
1141 pub fn is_user_variable(&self) -> bool {
1142 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::User(_) => true,
_ => false,
}matches!(self.local_info(), LocalInfo::User(_))
1143 }
1144
1145 pub fn is_ref_for_guard(&self) -> bool {
1149 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::User(BindingForm::RefForGuard(_)) => true,
_ => false,
}matches!(self.local_info(), LocalInfo::User(BindingForm::RefForGuard(_)))
1150 }
1151
1152 pub fn is_ref_to_static(&self) -> bool {
1155 #[allow(non_exhaustive_omitted_patterns)] match self.local_info() {
LocalInfo::StaticRef { .. } => true,
_ => false,
}matches!(self.local_info(), LocalInfo::StaticRef { .. })
1156 }
1157
1158 pub fn is_ref_to_thread_local(&self) -> bool {
1161 match self.local_info() {
1162 LocalInfo::StaticRef { is_thread_local, .. } => *is_thread_local,
1163 _ => false,
1164 }
1165 }
1166
1167 pub fn is_deref_temp(&self) -> bool {
1169 match self.local_info() {
1170 LocalInfo::DerefTemp => true,
1171 _ => false,
1172 }
1173 }
1174
1175 #[inline]
1178 pub fn from_compiler_desugaring(&self) -> bool {
1179 self.source_info.span.desugaring_kind().is_some()
1180 }
1181
1182 #[inline]
1184 pub fn new(ty: Ty<'tcx>, span: Span) -> Self {
1185 Self::with_source_info(ty, SourceInfo::outermost(span))
1186 }
1187
1188 #[inline]
1190 pub fn with_source_info(ty: Ty<'tcx>, source_info: SourceInfo) -> Self {
1191 LocalDecl {
1192 mutability: Mutability::Mut,
1193 local_info: ClearCrossCrate::Set(Box::new(LocalInfo::Boring)),
1194 ty,
1195 user_ty: None,
1196 source_info,
1197 }
1198 }
1199
1200 #[inline]
1202 pub fn immutable(mut self) -> Self {
1203 self.mutability = Mutability::Not;
1204 self
1205 }
1206}
1207
1208#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for
VarDebugInfoContents<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
match self {
Self::Place(__self_0) =>
VarDebugInfoContents::Place(::core::clone::Clone::clone(__self_0)),
Self::Const(__self_0) =>
VarDebugInfoContents::Const(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for VarDebugInfoContents<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
VarDebugInfoContents::Place(ref __binding_0) => { 0usize }
VarDebugInfoContents::Const(ref __binding_0) => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
VarDebugInfoContents::Place(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
VarDebugInfoContents::Const(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for VarDebugInfoContents<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
VarDebugInfoContents::Place(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
VarDebugInfoContents::Const(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `VarDebugInfoContents`, expected 0..2, actual {0}",
n));
}
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
VarDebugInfoContents<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
VarDebugInfoContents::Place(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
VarDebugInfoContents::Const(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
VarDebugInfoContents::Place(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
VarDebugInfoContents::Const(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for VarDebugInfoContents<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
VarDebugInfoContents::Place(__binding_0) => {
VarDebugInfoContents::Place(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
VarDebugInfoContents::Const(__binding_0) => {
VarDebugInfoContents::Const(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
VarDebugInfoContents::Place(__binding_0) => {
VarDebugInfoContents::Place(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
VarDebugInfoContents::Const(__binding_0) => {
VarDebugInfoContents::Const(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for VarDebugInfoContents<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
VarDebugInfoContents::Place(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
VarDebugInfoContents::Const(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
1209pub enum VarDebugInfoContents<'tcx> {
1210 Place(Place<'tcx>),
1212 Const(ConstOperand<'tcx>),
1213}
1214
1215impl<'tcx> Debug for VarDebugInfoContents<'tcx> {
1216 fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
1217 match self {
1218 VarDebugInfoContents::Const(c) => fmt.write_fmt(format_args!("{0}", c))write!(fmt, "{c}"),
1219 VarDebugInfoContents::Place(p) => fmt.write_fmt(format_args!("{0:?}", p))write!(fmt, "{p:?}"),
1220 }
1221 }
1222}
1223
1224#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for
VarDebugInfoFragment<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
VarDebugInfoFragment {
ty: ::core::clone::Clone::clone(&self.ty),
projection: ::core::clone::Clone::clone(&self.projection),
}
}
}Clone, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for
VarDebugInfoFragment<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"VarDebugInfoFragment ty projection", &self.ty, &&self.projection)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for VarDebugInfoFragment<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let VarDebugInfoFragment {
ty: ref __binding_0, projection: ref __binding_1 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for VarDebugInfoFragment<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
VarDebugInfoFragment {
ty: ::rustc_serialize::Decodable::decode(__decoder),
projection: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
VarDebugInfoFragment<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
VarDebugInfoFragment {
ty: ref __binding_0, projection: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for VarDebugInfoFragment<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
VarDebugInfoFragment {
ty: __binding_0, projection: __binding_1 } => {
VarDebugInfoFragment {
ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
projection: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
VarDebugInfoFragment {
ty: __binding_0, projection: __binding_1 } => {
VarDebugInfoFragment {
ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
projection: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for VarDebugInfoFragment<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
VarDebugInfoFragment {
ty: ref __binding_0, projection: ref __binding_1 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
1225pub struct VarDebugInfoFragment<'tcx> {
1226 pub ty: Ty<'tcx>,
1229
1230 pub projection: Vec<PlaceElem<'tcx>>,
1240}
1241
1242#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for VarDebugInfo<'tcx>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
VarDebugInfo {
name: ::core::clone::Clone::clone(&self.name),
source_info: ::core::clone::Clone::clone(&self.source_info),
composite: ::core::clone::Clone::clone(&self.composite),
value: ::core::clone::Clone::clone(&self.value),
argument_index: ::core::clone::Clone::clone(&self.argument_index),
}
}
}Clone, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for VarDebugInfo<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let VarDebugInfo {
name: ref __binding_0,
source_info: ref __binding_1,
composite: ref __binding_2,
value: ref __binding_3,
argument_index: ref __binding_4 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for VarDebugInfo<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
VarDebugInfo {
name: ::rustc_serialize::Decodable::decode(__decoder),
source_info: ::rustc_serialize::Decodable::decode(__decoder),
composite: ::rustc_serialize::Decodable::decode(__decoder),
value: ::rustc_serialize::Decodable::decode(__decoder),
argument_index: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
VarDebugInfo<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
VarDebugInfo {
name: ref __binding_0,
source_info: ref __binding_1,
composite: ref __binding_2,
value: ref __binding_3,
argument_index: ref __binding_4 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for VarDebugInfo<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
VarDebugInfo {
name: __binding_0,
source_info: __binding_1,
composite: __binding_2,
value: __binding_3,
argument_index: __binding_4 } => {
VarDebugInfo {
name: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
source_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
composite: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
__folder)?,
value: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
__folder)?,
argument_index: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
__folder)?,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
VarDebugInfo {
name: __binding_0,
source_info: __binding_1,
composite: __binding_2,
value: __binding_3,
argument_index: __binding_4 } => {
VarDebugInfo {
name: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
source_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
composite: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
__folder),
value: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
__folder),
argument_index: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
__folder),
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for VarDebugInfo<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
VarDebugInfo {
name: ref __binding_0,
source_info: ref __binding_1,
composite: ref __binding_2,
value: ref __binding_3,
argument_index: ref __binding_4 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
1244pub struct VarDebugInfo<'tcx> {
1245 pub name: Symbol,
1246
1247 pub source_info: SourceInfo,
1251
1252 pub composite: Option<Box<VarDebugInfoFragment<'tcx>>>,
1258
1259 pub value: VarDebugInfoContents<'tcx>,
1261
1262 pub argument_index: Option<u16>,
1266}
1267
1268#[automatically_derived]impl ::core::marker::Copy for BasicBlock { }
pub const START_BLOCK: BasicBlock = BasicBlock::from_u32(0);
impl BasicBlock {
#[doc = r" Maximum value the index can take, as a `u32`."]
pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
#[doc = r" Maximum value the index can take."]
pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
#[doc = r" Zero value of the index."]
pub const ZERO: Self = Self::from_u32(0);
#[doc = r" Creates a new index from a given `usize`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_usize(value: usize) -> Self {
if !(value <= (0xFFFF_FF00 as usize)) {
::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
};
unsafe { Self::from_u32_unchecked(value as u32) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_u32(value: u32) -> Self {
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u16`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_u16(value: u16) -> Self {
let value = value as u32;
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Safety"]
#[doc = r""]
#[doc =
r" The provided value must be less than or equal to the maximum value for the newtype."]
#[doc =
r" Providing a value outside this range is undefined due to layout restrictions."]
#[doc = r""]
#[doc = r" Prefer using `from_u32`."]
#[inline]
pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
Self {
private_use_as_methods_instead: unsafe {
std::mem::transmute(value)
},
}
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub const fn index(self) -> usize { self.as_usize() }
#[doc = r" Extracts the value of this index as a `u32`."]
#[inline]
pub const fn as_u32(self) -> u32 {
unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for BasicBlock {
type Output = Self;
#[inline]
fn add(self, other: usize) -> Self {
Self::from_usize(self.index() + other)
}
}
impl std::ops::AddAssign<usize> for BasicBlock {
#[inline]
fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for BasicBlock {
#[inline]
fn new(value: usize) -> Self { Self::from_usize(value) }
#[inline]
fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for BasicBlock {
#[inline]
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
<usize as
::std::iter::Step>::steps_between(&Self::index(*start),
&Self::index(*end))
}
#[inline]
fn forward_checked(start: Self, u: usize) -> Option<Self> {
Self::index(start).checked_add(u).map(Self::from_usize)
}
#[inline]
fn backward_checked(start: Self, u: usize) -> Option<Self> {
Self::index(start).checked_sub(u).map(Self::from_usize)
}
#[inline]
fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
let (s, o) = Self::index(start).overflowing_add(u);
(Self::from_usize(s), o)
}
#[inline]
fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
let (s, o) = Self::index(start).overflowing_sub(u);
(Self::from_usize(s), o)
}
}
impl ::std::cmp::Ord for BasicBlock {
#[inline]
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.as_u32().cmp(&other.as_u32())
}
}
impl ::std::cmp::PartialOrd for BasicBlock {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl ::rustc_data_structures::stable_hash::StableHash for BasicBlock {
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
hcx: &mut __Hcx,
hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
self.as_u32().stable_hash(hcx, hasher)
}
}
impl From<BasicBlock> for u32 {
#[inline]
fn from(v: BasicBlock) -> u32 { v.as_u32() }
}
impl From<BasicBlock> for usize {
#[inline]
fn from(v: BasicBlock) -> usize { v.as_usize() }
}
impl From<usize> for BasicBlock {
#[inline]
fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for BasicBlock {
#[inline]
fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for BasicBlock {}
impl ::std::cmp::PartialEq for BasicBlock {
fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for BasicBlock {}
impl ::std::hash::Hash for BasicBlock {
fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
self.as_u32().hash(state)
}
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
BasicBlock {
fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
BasicBlock {
fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for BasicBlock {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
fmt.write_fmt(format_args!("bb{0}", self.as_u32()))
}
}rustc_index::newtype_index! {
1272 #[stable_hash]
1295 #[encodable]
1296 #[orderable]
1297 #[debug_format = "bb{}"]
1298 pub struct BasicBlock {
1299 const START_BLOCK = 0;
1300 }
1301}
1302
1303impl BasicBlock {
1304 #[inline]
1305 pub fn start_location(self) -> Location {
1306 Location { block: self, statement_index: 0 }
1307 }
1308}
1309
1310#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for
BasicBlockData<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
BasicBlockData {
statements: ::core::clone::Clone::clone(&self.statements),
after_last_stmt_debuginfos: ::core::clone::Clone::clone(&self.after_last_stmt_debuginfos),
terminator: ::core::clone::Clone::clone(&self.terminator),
is_cleanup: ::core::clone::Clone::clone(&self.is_cleanup),
}
}
}Clone, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for BasicBlockData<'tcx>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"BasicBlockData statements after_last_stmt_debuginfos terminator is_cleanup",
&self.statements, &self.after_last_stmt_debuginfos,
&self.terminator, &&self.is_cleanup)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for BasicBlockData<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let BasicBlockData {
statements: ref __binding_0,
after_last_stmt_debuginfos: ref __binding_1,
terminator: ref __binding_2,
is_cleanup: ref __binding_3 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for BasicBlockData<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
BasicBlockData {
statements: ::rustc_serialize::Decodable::decode(__decoder),
after_last_stmt_debuginfos: ::rustc_serialize::Decodable::decode(__decoder),
terminator: ::rustc_serialize::Decodable::decode(__decoder),
is_cleanup: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
BasicBlockData<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
BasicBlockData {
statements: ref __binding_0,
after_last_stmt_debuginfos: ref __binding_1,
terminator: ref __binding_2,
is_cleanup: ref __binding_3 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for BasicBlockData<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
BasicBlockData {
statements: __binding_0,
after_last_stmt_debuginfos: __binding_1,
terminator: __binding_2,
is_cleanup: __binding_3 } => {
BasicBlockData {
statements: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
after_last_stmt_debuginfos: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
terminator: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
__folder)?,
is_cleanup: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
__folder)?,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
BasicBlockData {
statements: __binding_0,
after_last_stmt_debuginfos: __binding_1,
terminator: __binding_2,
is_cleanup: __binding_3 } => {
BasicBlockData {
statements: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
after_last_stmt_debuginfos: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
terminator: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
__folder),
is_cleanup: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
__folder),
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for BasicBlockData<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
BasicBlockData {
statements: ref __binding_0,
after_last_stmt_debuginfos: ref __binding_1,
terminator: ref __binding_2,
is_cleanup: ref __binding_3 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
1317#[non_exhaustive]
1318pub struct BasicBlockData<'tcx> {
1319 pub statements: Vec<Statement<'tcx>>,
1321
1322 pub after_last_stmt_debuginfos: StmtDebugInfos<'tcx>,
1325
1326 pub terminator: Terminator<'tcx>,
1328
1329 pub is_cleanup: bool,
1334}
1335
1336impl<'tcx> BasicBlockData<'tcx> {
1337 pub fn new(terminator: Terminator<'tcx>, is_cleanup: bool) -> BasicBlockData<'tcx> {
1338 BasicBlockData::new_stmts(Vec::new(), terminator, is_cleanup)
1339 }
1340
1341 pub fn new_stmts(
1342 statements: Vec<Statement<'tcx>>,
1343 terminator: Terminator<'tcx>,
1344 is_cleanup: bool,
1345 ) -> BasicBlockData<'tcx> {
1346 BasicBlockData {
1347 statements,
1348 after_last_stmt_debuginfos: StmtDebugInfos::default(),
1349 terminator,
1350 is_cleanup,
1351 }
1352 }
1353
1354 #[inline]
1356 pub fn is_empty_unreachable(&self) -> bool {
1357 self.statements.is_empty() && #[allow(non_exhaustive_omitted_patterns)] match self.terminator.kind {
TerminatorKind::Unreachable => true,
_ => false,
}matches!(self.terminator.kind, TerminatorKind::Unreachable)
1358 }
1359
1360 pub fn mono_successors(&self, tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> Successors<'_> {
1366 if let Some((bits, targets)) = Body::try_const_mono_switchint(tcx, instance, self) {
1367 targets.successors_for_value(bits)
1368 } else {
1369 self.terminator.successors()
1370 }
1371 }
1372
1373 pub fn retain_statements<F>(&mut self, mut f: F)
1374 where
1375 F: FnMut(&Statement<'tcx>) -> bool,
1376 {
1377 let mut debuginfos = StmtDebugInfos::default();
1380 self.statements.retain_mut(|stmt| {
1381 let retain = f(stmt);
1382 if retain {
1383 stmt.debuginfos.prepend(&mut debuginfos);
1384 } else {
1385 debuginfos.append(&mut stmt.debuginfos);
1386 }
1387 retain
1388 });
1389 self.after_last_stmt_debuginfos.prepend(&mut debuginfos);
1390 }
1391
1392 pub fn strip_nops(&mut self) {
1393 self.retain_statements(|stmt| !#[allow(non_exhaustive_omitted_patterns)] match stmt.kind {
StatementKind::Nop => true,
_ => false,
}matches!(stmt.kind, StatementKind::Nop))
1394 }
1395
1396 pub fn drop_debuginfo(&mut self) {
1397 self.after_last_stmt_debuginfos.drop_debuginfo();
1398 for stmt in self.statements.iter_mut() {
1399 stmt.debuginfos.drop_debuginfo();
1400 }
1401 }
1402}
1403
1404#[automatically_derived]impl ::core::marker::Copy for SourceScope { }
pub const OUTERMOST_SOURCE_SCOPE: SourceScope = SourceScope::from_u32(0);
impl SourceScope {
#[doc = r" Maximum value the index can take, as a `u32`."]
pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
#[doc = r" Maximum value the index can take."]
pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
#[doc = r" Zero value of the index."]
pub const ZERO: Self = Self::from_u32(0);
#[doc = r" Creates a new index from a given `usize`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_usize(value: usize) -> Self {
if !(value <= (0xFFFF_FF00 as usize)) {
::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
};
unsafe { Self::from_u32_unchecked(value as u32) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_u32(value: u32) -> Self {
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u16`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_u16(value: u16) -> Self {
let value = value as u32;
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Safety"]
#[doc = r""]
#[doc =
r" The provided value must be less than or equal to the maximum value for the newtype."]
#[doc =
r" Providing a value outside this range is undefined due to layout restrictions."]
#[doc = r""]
#[doc = r" Prefer using `from_u32`."]
#[inline]
pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
Self {
private_use_as_methods_instead: unsafe {
std::mem::transmute(value)
},
}
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub const fn index(self) -> usize { self.as_usize() }
#[doc = r" Extracts the value of this index as a `u32`."]
#[inline]
pub const fn as_u32(self) -> u32 {
unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for SourceScope {
type Output = Self;
#[inline]
fn add(self, other: usize) -> Self {
Self::from_usize(self.index() + other)
}
}
impl std::ops::AddAssign<usize> for SourceScope {
#[inline]
fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for SourceScope {
#[inline]
fn new(value: usize) -> Self { Self::from_usize(value) }
#[inline]
fn index(self) -> usize { self.as_usize() }
}
impl ::rustc_data_structures::stable_hash::StableHash for SourceScope {
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
hcx: &mut __Hcx,
hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
self.as_u32().stable_hash(hcx, hasher)
}
}
impl From<SourceScope> for u32 {
#[inline]
fn from(v: SourceScope) -> u32 { v.as_u32() }
}
impl From<SourceScope> for usize {
#[inline]
fn from(v: SourceScope) -> usize { v.as_usize() }
}
impl From<usize> for SourceScope {
#[inline]
fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for SourceScope {
#[inline]
fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for SourceScope {}
impl ::std::cmp::PartialEq for SourceScope {
fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for SourceScope {}
impl ::std::hash::Hash for SourceScope {
fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
self.as_u32().hash(state)
}
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
SourceScope {
fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
SourceScope {
fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for SourceScope {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
fmt.write_fmt(format_args!("scope[{0}]", self.as_u32()))
}
}rustc_index::newtype_index! {
1408 #[stable_hash]
1409 #[encodable]
1410 #[debug_format = "scope[{}]"]
1411 pub struct SourceScope {
1412 const OUTERMOST_SOURCE_SCOPE = 0;
1413 }
1414}
1415
1416impl SourceScope {
1417 pub fn lint_root(
1421 self,
1422 source_scopes: &IndexSlice<SourceScope, SourceScopeData<'_>>,
1423 ) -> Option<HirId> {
1424 let mut data = &source_scopes[self];
1425 while data.inlined.is_some() {
1428 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/2be539647feed020b47ddbf897b8533d2d8d4c46/compiler/rustc_middle/src/mir/mod.rs:1428",
"rustc_middle::mir", ::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/2be539647feed020b47ddbf897b8533d2d8d4c46/compiler/rustc_middle/src/mir/mod.rs"),
::tracing_core::__macro_support::Option::Some(1428u32),
::tracing_core::__macro_support::Option::Some("rustc_middle::mir"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("data")
}> =
::tracing::__macro_support::FieldName::new("data");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&data)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};trace!(?data);
1429 data = &source_scopes[data.parent_scope.unwrap()];
1430 }
1431 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/2be539647feed020b47ddbf897b8533d2d8d4c46/compiler/rustc_middle/src/mir/mod.rs:1431",
"rustc_middle::mir", ::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/2be539647feed020b47ddbf897b8533d2d8d4c46/compiler/rustc_middle/src/mir/mod.rs"),
::tracing_core::__macro_support::Option::Some(1431u32),
::tracing_core::__macro_support::Option::Some("rustc_middle::mir"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("data")
}> =
::tracing::__macro_support::FieldName::new("data");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&data)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};trace!(?data);
1432 match &data.local_data {
1433 ClearCrossCrate::Set(data) => Some(data.lint_root),
1434 ClearCrossCrate::Clear => None,
1435 }
1436 }
1437
1438 #[inline]
1440 pub fn inlined_instance<'tcx>(
1441 self,
1442 source_scopes: &IndexSlice<SourceScope, SourceScopeData<'tcx>>,
1443 ) -> Option<ty::Instance<'tcx>> {
1444 let scope_data = &source_scopes[self];
1445 if let Some((inlined_instance, _)) = scope_data.inlined {
1446 Some(inlined_instance)
1447 } else if let Some(inlined_scope) = scope_data.inlined_parent_scope {
1448 Some(source_scopes[inlined_scope].inlined.unwrap().0)
1449 } else {
1450 None
1451 }
1452 }
1453}
1454
1455#[derive(#[automatically_derived]impl<'tcx> ::core::clone::Clone for
SourceScopeData<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
SourceScopeData {
span: ::core::clone::Clone::clone(&self.span),
parent_scope: ::core::clone::Clone::clone(&self.parent_scope),
inlined: ::core::clone::Clone::clone(&self.inlined),
inlined_parent_scope: ::core::clone::Clone::clone(&self.inlined_parent_scope),
local_data: ::core::clone::Clone::clone(&self.local_data),
}
}
}Clone, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for
SourceScopeData<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"SourceScopeData span parent_scope inlined inlined_parent_scope local_data",
&self.span, &self.parent_scope, &self.inlined,
&self.inlined_parent_scope, &&self.local_data)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for SourceScopeData<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let SourceScopeData {
span: ref __binding_0,
parent_scope: ref __binding_1,
inlined: ref __binding_2,
inlined_parent_scope: ref __binding_3,
local_data: ref __binding_4 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for SourceScopeData<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
SourceScopeData {
span: ::rustc_serialize::Decodable::decode(__decoder),
parent_scope: ::rustc_serialize::Decodable::decode(__decoder),
inlined: ::rustc_serialize::Decodable::decode(__decoder),
inlined_parent_scope: ::rustc_serialize::Decodable::decode(__decoder),
local_data: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
SourceScopeData<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
SourceScopeData {
span: ref __binding_0,
parent_scope: ref __binding_1,
inlined: ref __binding_2,
inlined_parent_scope: ref __binding_3,
local_data: ref __binding_4 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for SourceScopeData<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
SourceScopeData {
span: __binding_0,
parent_scope: __binding_1,
inlined: __binding_2,
inlined_parent_scope: __binding_3,
local_data: __binding_4 } => {
SourceScopeData {
span: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
parent_scope: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
inlined: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
__folder)?,
inlined_parent_scope: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
__folder)?,
local_data: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_4,
__folder)?,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
SourceScopeData {
span: __binding_0,
parent_scope: __binding_1,
inlined: __binding_2,
inlined_parent_scope: __binding_3,
local_data: __binding_4 } => {
SourceScopeData {
span: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
parent_scope: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
inlined: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
__folder),
inlined_parent_scope: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
__folder),
local_data: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_4,
__folder),
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for SourceScopeData<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
SourceScopeData {
span: ref __binding_0,
parent_scope: ref __binding_1,
inlined: ref __binding_2,
inlined_parent_scope: ref __binding_3,
local_data: ref __binding_4 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_4,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
1456pub struct SourceScopeData<'tcx> {
1457 pub span: Span,
1458 pub parent_scope: Option<SourceScope>,
1459
1460 pub inlined: Option<(ty::Instance<'tcx>, Span)>,
1464
1465 pub inlined_parent_scope: Option<SourceScope>,
1469
1470 pub local_data: ClearCrossCrate<SourceScopeLocalData>,
1473}
1474
1475#[derive(#[automatically_derived]impl ::core::clone::Clone for SourceScopeLocalData {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
SourceScopeLocalData {
lint_root: ::core::clone::Clone::clone(&self.lint_root),
}
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for SourceScopeLocalData {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"SourceScopeLocalData lint_root", &&self.lint_root)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for SourceScopeLocalData {
fn encode(&self, __encoder: &mut __E) {
let SourceScopeLocalData { lint_root: ref __binding_0 } =
*self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for SourceScopeLocalData {
fn decode(__decoder: &mut __D) -> Self {
SourceScopeLocalData {
lint_root: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
SourceScopeLocalData {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
SourceScopeLocalData { lint_root: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1476pub struct SourceScopeLocalData {
1477 pub lint_root: HirId,
1479}
1480
1481#[derive(#[automatically_derived]impl ::core::clone::Clone for UserTypeProjections {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
UserTypeProjections {
contents: ::core::clone::Clone::clone(&self.contents),
}
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for UserTypeProjections {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"UserTypeProjections contents", &&self.contents)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for UserTypeProjections {
fn encode(&self, __encoder: &mut __E) {
let UserTypeProjections { contents: ref __binding_0 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for UserTypeProjections {
fn decode(__decoder: &mut __D) -> Self {
UserTypeProjections {
contents: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
UserTypeProjections {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
UserTypeProjections { contents: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for UserTypeProjections {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
UserTypeProjections { contents: __binding_0 } => {
UserTypeProjections {
contents: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
UserTypeProjections { contents: __binding_0 } => {
UserTypeProjections {
contents: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for UserTypeProjections {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
UserTypeProjections { contents: ref __binding_0 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
1514pub struct UserTypeProjections {
1515 pub contents: Vec<UserTypeProjection>,
1516}
1517
1518impl UserTypeProjections {
1519 pub fn projections(&self) -> impl Iterator<Item = &UserTypeProjection> + ExactSizeIterator {
1520 self.contents.iter()
1521 }
1522}
1523
1524#[derive(#[automatically_derived]impl ::core::clone::Clone for UserTypeProjection {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
UserTypeProjection {
base: ::core::clone::Clone::clone(&self.base),
projs: ::core::clone::Clone::clone(&self.projs),
}
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for UserTypeProjection {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"UserTypeProjection base projs", &self.base, &&self.projs)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for UserTypeProjection {
fn encode(&self, __encoder: &mut __E) {
let UserTypeProjection {
base: ref __binding_0, projs: ref __binding_1 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for UserTypeProjection {
fn decode(__decoder: &mut __D) -> Self {
UserTypeProjection {
base: ::rustc_serialize::Decodable::decode(__decoder),
projs: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
UserTypeProjection {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
UserTypeProjection {
base: ref __binding_0, projs: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
UserTypeProjection {
}
#[automatically_derived]impl ::core::cmp::PartialEq for UserTypeProjection {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.base == other.base && self.projs == other.projs
}
}PartialEq)]
1540#[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)]
1541pub struct UserTypeProjection {
1542 pub base: UserTypeAnnotationIndex,
1543 pub projs: Vec<ProjectionKind>,
1544}
1545
1546#[automatically_derived]impl ::core::marker::Copy for Promoted { }
impl Promoted {
#[doc = r" Maximum value the index can take, as a `u32`."]
pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
#[doc = r" Maximum value the index can take."]
pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
#[doc = r" Zero value of the index."]
pub const ZERO: Self = Self::from_u32(0);
#[doc = r" Creates a new index from a given `usize`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_usize(value: usize) -> Self {
if !(value <= (0xFFFF_FF00 as usize)) {
::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
};
unsafe { Self::from_u32_unchecked(value as u32) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_u32(value: u32) -> Self {
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u16`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub const fn from_u16(value: u16) -> Self {
let value = value as u32;
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Safety"]
#[doc = r""]
#[doc =
r" The provided value must be less than or equal to the maximum value for the newtype."]
#[doc =
r" Providing a value outside this range is undefined due to layout restrictions."]
#[doc = r""]
#[doc = r" Prefer using `from_u32`."]
#[inline]
pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
Self {
private_use_as_methods_instead: unsafe {
std::mem::transmute(value)
},
}
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub const fn index(self) -> usize { self.as_usize() }
#[doc = r" Extracts the value of this index as a `u32`."]
#[inline]
pub const fn as_u32(self) -> u32 {
unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for Promoted {
type Output = Self;
#[inline]
fn add(self, other: usize) -> Self {
Self::from_usize(self.index() + other)
}
}
impl std::ops::AddAssign<usize> for Promoted {
#[inline]
fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for Promoted {
#[inline]
fn new(value: usize) -> Self { Self::from_usize(value) }
#[inline]
fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for Promoted {
#[inline]
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
<usize as
::std::iter::Step>::steps_between(&Self::index(*start),
&Self::index(*end))
}
#[inline]
fn forward_checked(start: Self, u: usize) -> Option<Self> {
Self::index(start).checked_add(u).map(Self::from_usize)
}
#[inline]
fn backward_checked(start: Self, u: usize) -> Option<Self> {
Self::index(start).checked_sub(u).map(Self::from_usize)
}
#[inline]
fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
let (s, o) = Self::index(start).overflowing_add(u);
(Self::from_usize(s), o)
}
#[inline]
fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
let (s, o) = Self::index(start).overflowing_sub(u);
(Self::from_usize(s), o)
}
}
impl ::std::cmp::Ord for Promoted {
#[inline]
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.as_u32().cmp(&other.as_u32())
}
}
impl ::std::cmp::PartialOrd for Promoted {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl ::rustc_data_structures::stable_hash::StableHash for Promoted {
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
hcx: &mut __Hcx,
hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
self.as_u32().stable_hash(hcx, hasher)
}
}
impl From<Promoted> for u32 {
#[inline]
fn from(v: Promoted) -> u32 { v.as_u32() }
}
impl From<Promoted> for usize {
#[inline]
fn from(v: Promoted) -> usize { v.as_usize() }
}
impl From<usize> for Promoted {
#[inline]
fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for Promoted {
#[inline]
fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for Promoted {}
impl ::std::cmp::PartialEq for Promoted {
fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for Promoted {}
impl ::std::hash::Hash for Promoted {
fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
self.as_u32().hash(state)
}
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
Promoted {
fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
Promoted {
fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for Promoted {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
fmt.write_fmt(format_args!("promoted[{0}]", self.as_u32()))
}
}rustc_index::newtype_index! {
1547 #[stable_hash]
1548 #[encodable]
1549 #[orderable]
1550 #[debug_format = "promoted[{}]"]
1551 pub struct Promoted {}
1552}
1553
1554#[derive(#[automatically_derived]impl ::core::marker::Copy for Location { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for Location {
}
#[automatically_derived]impl ::core::clone::Clone for Location {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<BasicBlock>;
let _: ::core::clone::AssertParamIsClone<usize>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for Location
{
}
#[automatically_derived]impl ::core::cmp::PartialEq for Location {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.block == other.block &&
self.statement_index == other.statement_index
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for Location {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<BasicBlock>;
let _: ::core::cmp::AssertParamIsEq<usize>;
}
}Eq, #[automatically_derived]impl ::core::hash::Hash for Location {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.block, state);
::core::hash::Hash::hash(&self.statement_index, state)
}
}Hash, #[automatically_derived]impl ::core::cmp::Ord for Location {
#[inline]
fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
match ::core::cmp::Ord::cmp(&self.block, &other.block) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ord::cmp(&self.statement_index,
&other.statement_index),
cmp => cmp,
}
}
}Ord, #[automatically_derived]impl ::core::cmp::PartialOrd for Location {
#[inline]
fn partial_cmp(&self, other: &Self)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
}
}PartialOrd, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for Location {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
Location {
block: ref __binding_0, statement_index: ref __binding_1 }
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1558pub struct Location {
1559 pub block: BasicBlock,
1561
1562 pub statement_index: usize,
1563}
1564
1565impl fmt::Debug for Location {
1566 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
1567 fmt.write_fmt(format_args!("{0:?}[{1}]", self.block, self.statement_index))write!(fmt, "{:?}[{}]", self.block, self.statement_index)
1568 }
1569}
1570
1571impl Location {
1572 pub const START: Location = Location { block: START_BLOCK, statement_index: 0 };
1573
1574 #[inline]
1579 pub fn successor_within_block(&self) -> Location {
1580 Location { block: self.block, statement_index: self.statement_index + 1 }
1581 }
1582
1583 pub fn is_predecessor_of<'tcx>(&self, other: Location, body: &Body<'tcx>) -> bool {
1585 if self.block == other.block && self.statement_index < other.statement_index {
1588 return true;
1589 }
1590
1591 let predecessors = body.basic_blocks.predecessors();
1592
1593 let mut queue: Vec<BasicBlock> = predecessors[other.block].to_vec();
1595 let mut visited = FxHashSet::default();
1596
1597 while let Some(block) = queue.pop() {
1598 if visited.insert(block) {
1600 queue.extend(predecessors[block].iter().cloned());
1601 } else {
1602 continue;
1603 }
1604
1605 if self.block == block {
1608 return true;
1609 }
1610 }
1611
1612 false
1613 }
1614
1615 #[inline]
1616 pub fn dominates(&self, other: Location, dominators: &Dominators<BasicBlock>) -> bool {
1617 if self.block == other.block {
1618 self.statement_index <= other.statement_index
1619 } else {
1620 dominators.dominates(self.block, other.block)
1621 }
1622 }
1623
1624 #[inline]
1625 pub fn strictly_dominates(&self, other: Location, dominators: &Dominators<BasicBlock>) -> bool {
1626 self.block != other.block && dominators.strictly_dominates(self.block, other.block)
1627 }
1628}
1629
1630#[derive(#[automatically_derived]impl ::core::marker::Copy for DefLocation { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for DefLocation {
}
#[automatically_derived]impl ::core::clone::Clone for DefLocation {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Location>;
let _: ::core::clone::AssertParamIsClone<BasicBlock>;
let _: ::core::clone::AssertParamIsClone<Option<BasicBlock>>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for DefLocation {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Argument =>
::core::fmt::Formatter::write_str(f, "Argument"),
Self::Assignment(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Assignment", &__self_0),
Self::CallReturn { call: __self_0, target: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"CallReturn call target", __self_0, &__self_1),
}
}
}Debug, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
DefLocation {
}
#[automatically_derived]impl ::core::cmp::PartialEq for DefLocation {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Assignment(__self_0), Self::Assignment(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::CallReturn { call: __self_0, target: __self_1 },
Self::CallReturn { call: __arg1_0, target: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for DefLocation {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<Location>;
let _: ::core::cmp::AssertParamIsEq<BasicBlock>;
let _: ::core::cmp::AssertParamIsEq<Option<BasicBlock>>;
}
}Eq)]
1633pub enum DefLocation {
1634 Argument,
1635 Assignment(Location),
1636 CallReturn { call: BasicBlock, target: Option<BasicBlock> },
1637}
1638
1639impl DefLocation {
1640 #[inline]
1641 pub fn dominates(self, location: Location, dominators: &Dominators<BasicBlock>) -> bool {
1642 match self {
1643 DefLocation::Argument => true,
1644 DefLocation::Assignment(def) => {
1645 def.successor_within_block().dominates(location, dominators)
1646 }
1647 DefLocation::CallReturn { target: None, .. } => false,
1648 DefLocation::CallReturn { call, target: Some(target) } => {
1649 call != target
1656 && dominators.dominates(call, target)
1657 && dominators.dominates(target, location.block)
1658 }
1659 }
1660 }
1661}
1662
1663pub fn find_self_call<'tcx>(
1667 tcx: TyCtxt<'tcx>,
1668 body: &Body<'tcx>,
1669 local: Local,
1670 block: BasicBlock,
1671) -> Option<(DefId, GenericArgs<'tcx>)> {
1672 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/2be539647feed020b47ddbf897b8533d2d8d4c46/compiler/rustc_middle/src/mir/mod.rs:1672",
"rustc_middle::mir", ::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/2be539647feed020b47ddbf897b8533d2d8d4c46/compiler/rustc_middle/src/mir/mod.rs"),
::tracing_core::__macro_support::Option::Some(1672u32),
::tracing_core::__macro_support::Option::Some("rustc_middle::mir"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("find_self_call(local={0:?}): terminator={1:?}",
local, body[block].terminator) as
&dyn ::tracing::field::Value))])
});
} else { ; }
};debug!("find_self_call(local={:?}): terminator={:?}", local, body[block].terminator);
1673 if let Terminator { kind: TerminatorKind::Call { func, args, .. }, .. } =
1674 &body[block].terminator
1675 && let Operand::Constant(ConstOperand { const_, .. }) = func
1676 && let ty::FnDef(def_id, fn_args) = *const_.ty().kind()
1677 && let Some(item) = tcx.opt_associated_item(def_id)
1678 && item.is_method()
1679 && let [Spanned { node: Operand::Move(self_place) | Operand::Copy(self_place), .. }, ..] =
1680 **args
1681 {
1682 let fn_args = fn_args.no_bound_vars().unwrap();
1683
1684 if self_place.as_local() == Some(local) {
1685 return Some((def_id, fn_args));
1686 }
1687
1688 for stmt in &body[block].statements {
1691 if let StatementKind::Assign((place, rvalue)) = &stmt.kind
1692 && let Some(reborrow_local) = place.as_local()
1693 && self_place.as_local() == Some(reborrow_local)
1694 && let Rvalue::Ref(_, _, deref_place) = rvalue
1695 && let PlaceRef { local: deref_local, projection: [ProjectionElem::Deref] } =
1696 deref_place.as_ref()
1697 && deref_local == local
1698 {
1699 return Some((def_id, fn_args));
1700 }
1701 }
1702 }
1703 None
1704}
1705
1706#[cfg(target_pointer_width = "64")]
1708mod size_asserts {
1709 use rustc_data_structures::static_assert_size;
1710
1711 use super::*;
1712 const _: [(); 136] = [(); ::std::mem::size_of::<BasicBlockData<'_>>()];static_assert_size!(BasicBlockData<'_>, 136);
1714 const _: [(); 40] = [(); ::std::mem::size_of::<LocalDecl<'_>>()];static_assert_size!(LocalDecl<'_>, 40);
1715 const _: [(); 64] = [(); ::std::mem::size_of::<SourceScopeData<'_>>()];static_assert_size!(SourceScopeData<'_>, 64);
1716 const _: [(); 40] = [(); ::std::mem::size_of::<Statement<'_>>()];static_assert_size!(Statement<'_>, 40);
1717 const _: [(); 96] = [(); ::std::mem::size_of::<Terminator<'_>>()];static_assert_size!(Terminator<'_>, 96);
1718 const _: [(); 88] = [(); ::std::mem::size_of::<VarDebugInfo<'_>>()];static_assert_size!(VarDebugInfo<'_>, 88);
1719 }