1use std::borrow::Cow;
3use std::fmt;
4use std::ops::Not;
5
6use rustc_abi::ExternAbi;
7use rustc_ast::util::parser::ExprPrecedence;
8use rustc_ast::{
9 self as ast, FloatTy, InlineAsmOptions, InlineAsmTemplatePiece, IntTy, Label, LitIntType,
10 LitKind, TraitObjectSyntax, UintTy, UnsafeBinderCastKind,
11};
12pub use rustc_ast::{
13 AssignOp, AssignOpKind, AttrId, AttrStyle, BinOp, BinOpKind, BindingMode, BorrowKind,
14 BoundConstness, BoundPolarity, ByRef, CaptureBy, DelimArgs, ImplPolarity, IsAuto,
15 MetaItemInner, MetaItemLit, Movability, Mutability, Pinnedness, UnOp,
16};
17use rustc_attr_ir::Attribute;
18use rustc_data_structures::fingerprint::Fingerprint;
19use rustc_data_structures::fx::FxIndexSet;
20use rustc_data_structures::sorted_map::SortedMap;
21use rustc_data_structures::steal::Steal;
22use rustc_data_structures::tagged_ptr::TaggedRef;
23use rustc_data_structures::unord::UnordMap;
24use rustc_error_messages::{DiagArgValue, IntoDiagArg};
25use rustc_hir_id::{HirId, ItemLocalId, ItemLocalMap, OwnerId};
26use rustc_index::IndexVec;
27use rustc_macros::{Decodable, Encodable, StableHash};
28use rustc_span::def_id::LocalDefId;
29use rustc_span::{
30 BytePos, DUMMY_SP, DesugaringKind, ErrorGuaranteed, Ident, LocalExpnId, Span, Spanned, Symbol,
31 kw, sym,
32};
33use rustc_target::asm;
34use tracing::debug;
35
36use crate::def::{CtorKind, DefKind, MacroKinds, PerNS, Res};
37use crate::def_id::{DefId, LocalDefIdMap};
38use crate::intravisit::FnKind;
39use crate::lints::DelayedLints;
40
41#[derive(#[automatically_derived]impl ::core::fmt::Debug for AngleBrackets {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
AngleBrackets::Missing => "Missing",
AngleBrackets::Empty => "Empty",
AngleBrackets::Full => "Full",
})
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for AngleBrackets { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for AngleBrackets {
}
#[automatically_derived]impl ::core::clone::Clone for AngleBrackets {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
AngleBrackets {
}
#[automatically_derived]impl ::core::cmp::PartialEq for AngleBrackets {
#[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 AngleBrackets { }Eq, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
AngleBrackets {
#[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 {
AngleBrackets::Missing => 0u8.stable_hash(__hcx, __hasher),
AngleBrackets::Empty => 1u8.stable_hash(__hcx, __hasher),
AngleBrackets::Full => 2u8.stable_hash(__hcx, __hasher),
}
match *self {
AngleBrackets::Missing => {}
AngleBrackets::Empty => {}
AngleBrackets::Full => {}
}
}
}
};StableHash)]
42pub enum AngleBrackets {
43 Missing,
45 Empty,
47 Full,
49}
50
51#[derive(#[automatically_derived]impl ::core::fmt::Debug for LifetimeSource {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Reference =>
::core::fmt::Formatter::write_str(f, "Reference"),
Self::Path { angle_brackets: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Path angle_brackets", &__self_0),
Self::OutlivesBound =>
::core::fmt::Formatter::write_str(f, "OutlivesBound"),
Self::PreciseCapturing =>
::core::fmt::Formatter::write_str(f, "PreciseCapturing"),
Self::Other => ::core::fmt::Formatter::write_str(f, "Other"),
}
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for LifetimeSource { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for LifetimeSource {
}
#[automatically_derived]impl ::core::clone::Clone for LifetimeSource {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<AngleBrackets>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
LifetimeSource {
}
#[automatically_derived]impl ::core::cmp::PartialEq for LifetimeSource {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Path { angle_brackets: __self_0 }, Self::Path {
angle_brackets: __arg1_0 }) => __self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for LifetimeSource {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<AngleBrackets>;
}
}Eq, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
LifetimeSource {
#[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 {
LifetimeSource::Reference =>
0u8.stable_hash(__hcx, __hasher),
LifetimeSource::Path { angle_brackets: ref __binding_0 } =>
1u8.stable_hash(__hcx, __hasher),
LifetimeSource::OutlivesBound =>
2u8.stable_hash(__hcx, __hasher),
LifetimeSource::PreciseCapturing =>
3u8.stable_hash(__hcx, __hasher),
LifetimeSource::Other => 4u8.stable_hash(__hcx, __hasher),
}
match *self {
LifetimeSource::Reference => {}
LifetimeSource::Path { angle_brackets: ref __binding_0 } =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
}
LifetimeSource::OutlivesBound => {}
LifetimeSource::PreciseCapturing => {}
LifetimeSource::Other => {}
}
}
}
};StableHash)]
52pub enum LifetimeSource {
53 Reference,
55
56 Path { angle_brackets: AngleBrackets },
59
60 OutlivesBound,
62
63 PreciseCapturing,
65
66 Other,
73}
74
75#[derive(#[automatically_derived]impl ::core::fmt::Debug for LifetimeSyntax {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
LifetimeSyntax::Implicit => "Implicit",
LifetimeSyntax::ExplicitAnonymous => "ExplicitAnonymous",
LifetimeSyntax::ExplicitBound => "ExplicitBound",
})
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for LifetimeSyntax { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for LifetimeSyntax {
}
#[automatically_derived]impl ::core::clone::Clone for LifetimeSyntax {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
LifetimeSyntax {
}
#[automatically_derived]impl ::core::cmp::PartialEq for LifetimeSyntax {
#[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 LifetimeSyntax { }Eq, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
LifetimeSyntax {
#[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 {
LifetimeSyntax::Implicit =>
0u8.stable_hash(__hcx, __hasher),
LifetimeSyntax::ExplicitAnonymous =>
1u8.stable_hash(__hcx, __hasher),
LifetimeSyntax::ExplicitBound =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
LifetimeSyntax::Implicit => {}
LifetimeSyntax::ExplicitAnonymous => {}
LifetimeSyntax::ExplicitBound => {}
}
}
}
};StableHash)]
76pub enum LifetimeSyntax {
77 Implicit,
79
80 ExplicitAnonymous,
82
83 ExplicitBound,
85}
86
87impl From<Ident> for LifetimeSyntax {
88 fn from(ident: Ident) -> Self {
89 let name = ident.name;
90
91 if name == sym::empty {
92 {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("A lifetime name should never be empty")));
};unreachable!("A lifetime name should never be empty");
93 } else if name == kw::UnderscoreLifetime {
94 LifetimeSyntax::ExplicitAnonymous
95 } else {
96 if true {
if !name.as_str().starts_with('\'') {
::core::panicking::panic("assertion failed: name.as_str().starts_with(\'\\\'\')")
};
};debug_assert!(name.as_str().starts_with('\''));
97 LifetimeSyntax::ExplicitBound
98 }
99 }
100}
101
102#[derive(#[automatically_derived]impl ::core::fmt::Debug for Lifetime {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"Lifetime hir_id ident kind source syntax", &self.hir_id,
&self.ident, &self.kind, &self.source, &&self.syntax)
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for Lifetime { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for Lifetime {
}
#[automatically_derived]impl ::core::clone::Clone for Lifetime {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<LifetimeKind>;
let _: ::core::clone::AssertParamIsClone<LifetimeSource>;
let _: ::core::clone::AssertParamIsClone<LifetimeSyntax>;
*self
}
}Clone, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for Lifetime {
#[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 {
Lifetime {
hir_id: ref __binding_0,
ident: ref __binding_1,
kind: ref __binding_2,
source: ref __binding_3,
syntax: ref __binding_4 } => {
{}
{ __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)]
153#[repr(align(4))]
161pub struct Lifetime {
162 #[stable_hash(ignore)]
163 pub hir_id: HirId,
164
165 pub ident: Ident,
169
170 pub kind: LifetimeKind,
172
173 pub source: LifetimeSource,
176
177 pub syntax: LifetimeSyntax,
180}
181
182#[derive(#[automatically_derived]impl ::core::fmt::Debug for ParamName {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Plain(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Plain",
&__self_0),
Self::Error(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Error",
&__self_0),
Self::Fresh => ::core::fmt::Formatter::write_str(f, "Fresh"),
}
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for ParamName { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ParamName {
}
#[automatically_derived]impl ::core::clone::Clone for ParamName {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Ident>;
*self
}
}Clone, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for ParamName {
#[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 {
ParamName::Plain(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
ParamName::Error(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
ParamName::Fresh => 2u8.stable_hash(__hcx, __hasher),
}
match *self {
ParamName::Plain(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ParamName::Error(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ParamName::Fresh => {}
}
}
}
};StableHash)]
183pub enum ParamName {
184 Plain(Ident),
186
187 Error(Ident),
193
194 Fresh,
209}
210
211impl ParamName {
212 pub fn ident(&self) -> Ident {
213 match *self {
214 ParamName::Plain(ident) | ParamName::Error(ident) => ident,
215 ParamName::Fresh => Ident::with_dummy_span(kw::UnderscoreLifetime),
216 }
217 }
218}
219
220#[derive(#[automatically_derived]impl ::core::fmt::Debug for LifetimeKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Param(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Param",
&__self_0),
Self::ImplicitObjectLifetimeDefault =>
::core::fmt::Formatter::write_str(f,
"ImplicitObjectLifetimeDefault"),
Self::Error(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Error",
&__self_0),
Self::Infer => ::core::fmt::Formatter::write_str(f, "Infer"),
Self::Static => ::core::fmt::Formatter::write_str(f, "Static"),
}
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for LifetimeKind { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for LifetimeKind {
}
#[automatically_derived]impl ::core::clone::Clone for LifetimeKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
let _: ::core::clone::AssertParamIsClone<ErrorGuaranteed>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
LifetimeKind {
}
#[automatically_derived]impl ::core::cmp::PartialEq for LifetimeKind {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Param(__self_0), Self::Param(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::Error(__self_0), Self::Error(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for LifetimeKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<LocalDefId>;
let _: ::core::cmp::AssertParamIsEq<ErrorGuaranteed>;
}
}Eq, #[automatically_derived]impl ::core::hash::Hash for LifetimeKind {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
match self {
Self::Param(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
Self::Error(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
_ => {}
}
}
}Hash, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for LifetimeKind
{
#[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 {
LifetimeKind::Param(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
LifetimeKind::ImplicitObjectLifetimeDefault =>
1u8.stable_hash(__hcx, __hasher),
LifetimeKind::Error(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
LifetimeKind::Infer => 3u8.stable_hash(__hcx, __hasher),
LifetimeKind::Static => 4u8.stable_hash(__hcx, __hasher),
}
match *self {
LifetimeKind::Param(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
LifetimeKind::ImplicitObjectLifetimeDefault => {}
LifetimeKind::Error(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
LifetimeKind::Infer => {}
LifetimeKind::Static => {}
}
}
}
};StableHash)]
221pub enum LifetimeKind {
222 Param(LocalDefId),
224
225 ImplicitObjectLifetimeDefault,
237
238 Error(ErrorGuaranteed),
241
242 Infer,
246
247 Static,
249}
250
251impl LifetimeKind {
252 fn is_elided(&self) -> bool {
253 match self {
254 LifetimeKind::ImplicitObjectLifetimeDefault | LifetimeKind::Infer => true,
255
256 LifetimeKind::Error(..) | LifetimeKind::Param(..) | LifetimeKind::Static => false,
261 }
262 }
263}
264
265impl fmt::Display for Lifetime {
266 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
267 self.ident.name.fmt(f)
268 }
269}
270
271impl Lifetime {
272 pub fn new(
273 hir_id: HirId,
274 ident: Ident,
275 kind: LifetimeKind,
276 source: LifetimeSource,
277 syntax: LifetimeSyntax,
278 ) -> Lifetime {
279 let lifetime = Lifetime { hir_id, ident, kind, source, syntax };
280
281 #[cfg(debug_assertions)]
283 match (lifetime.is_elided(), lifetime.is_anonymous()) {
284 (false, false) => {} (false, true) => {} (true, true) => {} (true, false) => { ::core::panicking::panic_fmt(format_args!("bad Lifetime")); }panic!("bad Lifetime"),
288 }
289
290 lifetime
291 }
292
293 pub fn is_elided(&self) -> bool {
294 self.kind.is_elided()
295 }
296
297 pub fn is_anonymous(&self) -> bool {
298 self.ident.name == kw::UnderscoreLifetime
299 }
300
301 pub fn is_implicit(&self) -> bool {
302 #[allow(non_exhaustive_omitted_patterns)] match self.syntax {
LifetimeSyntax::Implicit => true,
_ => false,
}matches!(self.syntax, LifetimeSyntax::Implicit)
303 }
304
305 pub fn is_static(&self) -> bool {
306 self.kind == LifetimeKind::Static
307 }
308
309 pub fn suggestion(&self, new_lifetime: &str) -> (Span, String) {
310 use LifetimeSource::*;
311 use LifetimeSyntax::*;
312
313 if true {
if !new_lifetime.starts_with('\'') {
::core::panicking::panic("assertion failed: new_lifetime.starts_with(\'\\\'\')")
};
};debug_assert!(new_lifetime.starts_with('\''));
314
315 match (self.syntax, self.source) {
316 (ExplicitBound | ExplicitAnonymous, _) => (self.ident.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", new_lifetime))
})format!("{new_lifetime}")),
318
319 (Implicit, Path { angle_brackets: AngleBrackets::Full }) => {
321 (self.ident.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}, ", new_lifetime))
})format!("{new_lifetime}, "))
322 }
323
324 (Implicit, Path { angle_brackets: AngleBrackets::Empty }) => {
326 (self.ident.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", new_lifetime))
})format!("{new_lifetime}"))
327 }
328
329 (Implicit, Path { angle_brackets: AngleBrackets::Missing }) => {
331 (self.ident.span.shrink_to_hi(), ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("<{0}>", new_lifetime))
})format!("<{new_lifetime}>"))
332 }
333
334 (Implicit, Reference) => (self.ident.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0} ", new_lifetime))
})format!("{new_lifetime} ")),
336
337 (Implicit, source) => {
338 {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("can\'t suggest for a implicit lifetime of {0:?}",
source)));
}unreachable!("can't suggest for a implicit lifetime of {source:?}")
339 }
340 }
341 }
342}
343
344#[derive(#[automatically_derived]impl<'hir, R: ::core::fmt::Debug> ::core::fmt::Debug
for Path<'hir, R> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Path span res segments", &self.span, &self.res, &&self.segments)
}
}Debug, #[automatically_derived]impl<'hir, R: ::core::clone::Clone>
::core::clone::Clone for Path<'hir, R> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
Path {
span: ::core::clone::Clone::clone(&self.span),
res: ::core::clone::Clone::clone(&self.res),
segments: ::core::clone::Clone::clone(&self.segments),
}
}
}Clone, #[automatically_derived]impl<'hir, R: ::core::marker::Copy>
::core::marker::Copy for Path<'hir, R> {
}Copy, const _: () =
{
impl<'hir, R> ::rustc_data_structures::stable_hash::StableHash for
Path<'hir, R> where
R: ::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 {
Path {
span: ref __binding_0,
res: ref __binding_1,
segments: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
348pub struct Path<'hir, R = Res> {
349 pub span: Span,
350 pub res: R,
352 pub segments: &'hir [PathSegment<'hir>],
354}
355
356pub type UsePath<'hir> = Path<'hir, PerNS<Option<Res>>>;
358
359impl Path<'_> {
360 pub fn is_global(&self) -> bool {
361 self.segments.first().is_some_and(|segment| segment.ident.name == kw::PathRoot)
362 }
363}
364
365#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for PathSegment<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"PathSegment ident hir_id res args infer_args delegation_child_segment",
&[&self.ident, &self.hir_id, &self.res, &self.args,
&self.infer_args, &&self.delegation_child_segment])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for PathSegment<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for PathSegment<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Res>;
let _:
::core::clone::AssertParamIsClone<Option<&'hir GenericArgs<'hir>>>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for PathSegment<'hir>
{
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
PathSegment<'hir> {
#[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 {
PathSegment {
ident: ref __binding_0,
hir_id: ref __binding_1,
res: ref __binding_2,
args: ref __binding_3,
infer_args: ref __binding_4,
delegation_child_segment: ref __binding_5 } => {
{ __binding_0.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); }
}
}
}
}
};StableHash)]
368pub struct PathSegment<'hir> {
369 pub ident: Ident,
371 #[stable_hash(ignore)]
372 pub hir_id: HirId,
373 pub res: Res,
374
375 pub args: Option<&'hir GenericArgs<'hir>>,
381
382 pub infer_args: bool,
387
388 pub delegation_child_segment: bool,
392}
393
394impl<'hir> PathSegment<'hir> {
395 pub fn new(ident: Ident, hir_id: HirId, res: Res) -> PathSegment<'hir> {
397 PathSegment {
398 ident,
399 hir_id,
400 res,
401 infer_args: true,
402 args: None,
403 delegation_child_segment: false,
404 }
405 }
406
407 pub fn invalid() -> Self {
408 Self::new(Ident::dummy(), HirId::INVALID, Res::Err)
409 }
410
411 pub fn args(&self) -> &GenericArgs<'hir> {
412 if let Some(ref args) = self.args { args } else { GenericArgs::NONE }
413 }
414}
415
416#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ConstItemRhs<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for ConstItemRhs<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<BodyId>;
let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for ConstItemRhs<'hir>
{
}Copy, #[automatically_derived]impl<'hir> ::core::fmt::Debug for ConstItemRhs<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Body(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Body",
&__self_0),
Self::Direct(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Direct", &__self_0),
}
}
}Debug, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ConstItemRhs<'hir> {
#[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 {
ConstItemRhs::Body(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
ConstItemRhs::Direct(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
ConstItemRhs::Body(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstItemRhs::Direct(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
417pub enum ConstItemRhs<'hir> {
418 Body(BodyId),
419 Direct(&'hir ConstArg<'hir>),
420}
421
422impl<'hir> ConstItemRhs<'hir> {
423 pub fn hir_id(&self) -> HirId {
424 match self {
425 ConstItemRhs::Body(body_id) => body_id.hir_id,
426 ConstItemRhs::Direct(ct_arg) => ct_arg.hir_id,
427 }
428 }
429
430 pub fn span<'tcx>(&self, tcx: impl crate::intravisit::HirTyCtxt<'tcx>) -> Span {
431 match self {
432 ConstItemRhs::Body(body_id) => tcx.hir_body(*body_id).value.span,
433 ConstItemRhs::Direct(ct_arg) => ct_arg.span,
434 }
435 }
436}
437
438#[derive(#[automatically_derived]impl<'hir, Unambig: ::core::clone::Clone>
::core::clone::Clone for ConstArg<'hir, Unambig> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
ConstArg {
hir_id: ::core::clone::Clone::clone(&self.hir_id),
kind: ::core::clone::Clone::clone(&self.kind),
span: ::core::clone::Clone::clone(&self.span),
}
}
}Clone, #[automatically_derived]impl<'hir, Unambig: ::core::marker::Copy>
::core::marker::Copy for ConstArg<'hir, Unambig> {
}Copy, #[automatically_derived]impl<'hir, Unambig: ::core::fmt::Debug>
::core::fmt::Debug for ConstArg<'hir, Unambig> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"ConstArg hir_id kind span", &self.hir_id, &self.kind,
&&self.span)
}
}Debug, const _: () =
{
impl<'hir, Unambig> ::rustc_data_structures::stable_hash::StableHash
for ConstArg<'hir, Unambig> where
Unambig: ::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 {
ConstArg {
hir_id: ref __binding_0,
kind: ref __binding_1,
span: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
452#[repr(C)]
453pub struct ConstArg<'hir, Unambig = ()> {
454 #[stable_hash(ignore)]
455 pub hir_id: HirId,
456 pub kind: ConstArgKind<'hir, Unambig>,
457 pub span: Span,
458}
459
460impl<'hir> ConstArg<'hir, AmbigArg> {
461 pub fn as_unambig_ct(&self) -> &ConstArg<'hir> {
472 let ptr = self as *const ConstArg<'hir, AmbigArg> as *const ConstArg<'hir, ()>;
475 unsafe { &*ptr }
476 }
477}
478
479impl<'hir> ConstArg<'hir> {
480 pub fn try_as_ambig_ct(&self) -> Option<&ConstArg<'hir, AmbigArg>> {
486 if let ConstArgKind::Infer(()) = self.kind {
487 return None;
488 }
489
490 let ptr = self as *const ConstArg<'hir> as *const ConstArg<'hir, AmbigArg>;
494 Some(unsafe { &*ptr })
495 }
496}
497
498impl<'hir, Unambig> ConstArg<'hir, Unambig> {
499 pub fn anon_const_hir_id(&self) -> Option<HirId> {
500 match self.kind {
501 ConstArgKind::Anon(ac) => Some(ac.hir_id),
502 _ => None,
503 }
504 }
505}
506
507#[derive(#[automatically_derived]impl<'hir, Unambig: ::core::clone::Clone>
::core::clone::Clone for ConstArgKind<'hir, Unambig> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
match self {
Self::Tup(__self_0) =>
ConstArgKind::Tup(::core::clone::Clone::clone(__self_0)),
Self::Path(__self_0) =>
ConstArgKind::Path(::core::clone::Clone::clone(__self_0)),
Self::Anon(__self_0) =>
ConstArgKind::Anon(::core::clone::Clone::clone(__self_0)),
Self::Struct(__self_0, __self_1) =>
ConstArgKind::Struct(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
Self::TupleCall(__self_0, __self_1) =>
ConstArgKind::TupleCall(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
Self::Array(__self_0) =>
ConstArgKind::Array(::core::clone::Clone::clone(__self_0)),
Self::Error(__self_0) =>
ConstArgKind::Error(::core::clone::Clone::clone(__self_0)),
Self::Infer(__self_0) =>
ConstArgKind::Infer(::core::clone::Clone::clone(__self_0)),
Self::Literal { lit: __self_0, negated: __self_1 } =>
ConstArgKind::Literal {
lit: ::core::clone::Clone::clone(__self_0),
negated: ::core::clone::Clone::clone(__self_1),
},
}
}
}Clone, #[automatically_derived]impl<'hir, Unambig: ::core::marker::Copy>
::core::marker::Copy for ConstArgKind<'hir, Unambig> {
}Copy, #[automatically_derived]impl<'hir, Unambig: ::core::fmt::Debug>
::core::fmt::Debug for ConstArgKind<'hir, Unambig> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Tup(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Tup",
&__self_0),
Self::Path(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Path",
&__self_0),
Self::Anon(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Anon",
&__self_0),
Self::Struct(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Struct", __self_0, &__self_1),
Self::TupleCall(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TupleCall", __self_0, &__self_1),
Self::Array(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Array",
&__self_0),
Self::Error(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Error",
&__self_0),
Self::Infer(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Infer",
&__self_0),
Self::Literal { lit: __self_0, negated: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Literal lit negated", __self_0, &__self_1),
}
}
}Debug, const _: () =
{
impl<'hir, Unambig> ::rustc_data_structures::stable_hash::StableHash
for ConstArgKind<'hir, Unambig> where
Unambig: ::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 {
ConstArgKind::Tup(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
ConstArgKind::Path(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
ConstArgKind::Anon(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
ConstArgKind::Struct(ref __binding_0, ref __binding_1) =>
3u8.stable_hash(__hcx, __hasher),
ConstArgKind::TupleCall(ref __binding_0, ref __binding_1) =>
4u8.stable_hash(__hcx, __hasher),
ConstArgKind::Array(ref __binding_0) =>
5u8.stable_hash(__hcx, __hasher),
ConstArgKind::Error(ref __binding_0) =>
6u8.stable_hash(__hcx, __hasher),
ConstArgKind::Infer(ref __binding_0) =>
7u8.stable_hash(__hcx, __hasher),
ConstArgKind::Literal {
lit: ref __binding_0, negated: ref __binding_1 } =>
8u8.stable_hash(__hcx, __hasher),
}
match *self {
ConstArgKind::Tup(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstArgKind::Path(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstArgKind::Anon(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstArgKind::Struct(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ConstArgKind::TupleCall(ref __binding_0, ref __binding_1) =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ConstArgKind::Array(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstArgKind::Error(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstArgKind::Infer(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstArgKind::Literal {
lit: ref __binding_0, negated: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
509#[repr(u8, C)]
510pub enum ConstArgKind<'hir, Unambig = ()> {
511 Tup(&'hir [ConstArg<'hir>]),
512 Path(QPath<'hir>),
518 Anon(&'hir AnonConst),
519 Struct(QPath<'hir>, &'hir [ConstArgExprField<'hir>]),
521 TupleCall(QPath<'hir>, &'hir [ConstArg<'hir>]),
523 Array(&'hir ConstArgArrayExpr<'hir>),
525 Error(ErrorGuaranteed),
527 Infer(Unambig),
530 Literal {
531 lit: LitKind,
532 negated: bool,
533 },
534}
535
536#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ConstArgExprField<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
ConstArgExprField<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
ConstArgExprField<'hir> {
}Copy, #[automatically_derived]impl<'hir> ::core::fmt::Debug for
ConstArgExprField<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"ConstArgExprField hir_id span field expr", &self.hir_id,
&self.span, &self.field, &&self.expr)
}
}Debug, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ConstArgExprField<'hir> {
#[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 {
ConstArgExprField {
hir_id: ref __binding_0,
span: ref __binding_1,
field: ref __binding_2,
expr: 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)]
537pub struct ConstArgExprField<'hir> {
538 pub hir_id: HirId,
539 pub span: Span,
540 pub field: Ident,
541 pub expr: &'hir ConstArg<'hir>,
542}
543
544#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ConstArgArrayExpr<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
ConstArgArrayExpr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir [ConstArg<'hir>]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
ConstArgArrayExpr<'hir> {
}Copy, #[automatically_derived]impl<'hir> ::core::fmt::Debug for
ConstArgArrayExpr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"ConstArgArrayExpr span elems", &self.span, &&self.elems)
}
}Debug, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ConstArgArrayExpr<'hir> {
#[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 {
ConstArgArrayExpr {
span: ref __binding_0, elems: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
545pub struct ConstArgArrayExpr<'hir> {
546 pub span: Span,
547 pub elems: &'hir [ConstArg<'hir>],
548}
549
550#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for InferArgKind {
}
#[automatically_derived]impl ::core::clone::Clone for InferArgKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::Copy for InferArgKind { }Copy, #[automatically_derived]impl ::core::fmt::Debug for InferArgKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
InferArgKind::TypeOrConst => "TypeOrConst",
InferArgKind::Const => "Const",
})
}
}Debug, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
InferArgKind {
}
#[automatically_derived]impl ::core::cmp::PartialEq for InferArgKind {
#[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 InferArgKind { }Eq, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for InferArgKind
{
#[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 {
InferArgKind::TypeOrConst =>
0u8.stable_hash(__hcx, __hasher),
InferArgKind::Const => 1u8.stable_hash(__hcx, __hasher),
}
match *self {
InferArgKind::TypeOrConst => {}
InferArgKind::Const => {}
}
}
}
};StableHash)]
552pub enum InferArgKind {
553 TypeOrConst,
556 Const,
559}
560
561#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for InferArg {
}
#[automatically_derived]impl ::core::clone::Clone for InferArg {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<InferArgKind>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for InferArg { }Copy, #[automatically_derived]impl ::core::fmt::Debug for InferArg {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"InferArg hir_id span kind", &self.hir_id, &self.span,
&&self.kind)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for InferArg {
#[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 {
InferArg {
hir_id: ref __binding_0,
span: ref __binding_1,
kind: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
562pub struct InferArg {
563 #[stable_hash(ignore)]
564 pub hir_id: HirId,
565 pub span: Span,
566 pub kind: InferArgKind,
567}
568
569impl InferArg {
570 pub fn to_ty(&self) -> Ty<'static> {
571 Ty { kind: TyKind::Infer(()), span: self.span, hir_id: self.hir_id }
572 }
573}
574
575#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for GenericArg<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Lifetime(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Lifetime", &__self_0),
Self::Type(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Type",
&__self_0),
Self::Const(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
&__self_0),
Self::Infer(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Infer",
&__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for GenericArg<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for GenericArg<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir, AmbigArg>>;
let _:
::core::clone::AssertParamIsClone<&'hir ConstArg<'hir,
AmbigArg>>;
let _: ::core::clone::AssertParamIsClone<&'hir InferArg>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for GenericArg<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
GenericArg<'hir> {
#[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 {
GenericArg::Lifetime(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
GenericArg::Type(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
GenericArg::Const(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
GenericArg::Infer(ref __binding_0) =>
3u8.stable_hash(__hcx, __hasher),
}
match *self {
GenericArg::Lifetime(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
GenericArg::Type(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
GenericArg::Const(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
GenericArg::Infer(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
576pub enum GenericArg<'hir> {
577 Lifetime(&'hir Lifetime),
578 Type(&'hir Ty<'hir, AmbigArg>),
579 Const(&'hir ConstArg<'hir, AmbigArg>),
580 Infer(&'hir InferArg),
590}
591
592impl GenericArg<'_> {
593 pub fn span(&self) -> Span {
594 match self {
595 GenericArg::Lifetime(l) => l.ident.span,
596 GenericArg::Type(t) => t.span,
597 GenericArg::Const(c) => c.span,
598 GenericArg::Infer(i) => i.span,
599 }
600 }
601
602 pub fn hir_id(&self) -> HirId {
603 match self {
604 GenericArg::Lifetime(l) => l.hir_id,
605 GenericArg::Type(t) => t.hir_id,
606 GenericArg::Const(c) => c.hir_id,
607 GenericArg::Infer(i) => i.hir_id,
608 }
609 }
610
611 pub fn descr(&self) -> &'static str {
612 match self {
613 GenericArg::Lifetime(_) => "lifetime",
614 GenericArg::Type(_) => "type",
615 GenericArg::Const(_) => "constant",
616 GenericArg::Infer(InferArg { kind: InferArgKind::TypeOrConst, .. }) => "placeholder",
617 GenericArg::Infer(InferArg { kind: InferArgKind::Const, .. }) => "constant",
618 }
619 }
620
621 pub fn to_ord(&self) -> ast::ParamKindOrd {
622 match self {
623 GenericArg::Lifetime(_) => ast::ParamKindOrd::Lifetime,
624 GenericArg::Type(_) | GenericArg::Const(_) | GenericArg::Infer(_) => {
625 ast::ParamKindOrd::TypeOrConst
626 }
627 }
628 }
629
630 pub fn is_ty_or_const(&self) -> bool {
631 match self {
632 GenericArg::Lifetime(_) => false,
633 GenericArg::Type(_) | GenericArg::Const(_) | GenericArg::Infer(_) => true,
634 }
635 }
636}
637
638#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for GenericArgs<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"GenericArgs args constraints parenthesized span_ext", &self.args,
&self.constraints, &self.parenthesized, &&self.span_ext)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for GenericArgs<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for GenericArgs<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [GenericArg<'hir>]>;
let _:
::core::clone::AssertParamIsClone<&'hir [AssocItemConstraint<'hir>]>;
let _: ::core::clone::AssertParamIsClone<GenericArgsParentheses>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for GenericArgs<'hir>
{
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
GenericArgs<'hir> {
#[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 {
GenericArgs {
args: ref __binding_0,
constraints: ref __binding_1,
parenthesized: ref __binding_2,
span_ext: 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)]
640pub struct GenericArgs<'hir> {
641 pub args: &'hir [GenericArg<'hir>],
643 pub constraints: &'hir [AssocItemConstraint<'hir>],
645 pub parenthesized: GenericArgsParentheses,
650 pub span_ext: Span,
663}
664
665impl<'hir> GenericArgs<'hir> {
666 pub const NONE: &'hir GenericArgs<'hir> = &GenericArgs {
667 args: &[],
668 constraints: &[],
669 parenthesized: GenericArgsParentheses::No,
670 span_ext: DUMMY_SP,
671 };
672
673 pub fn paren_sugar_inputs_output(&self) -> Option<(&[Ty<'hir>], &Ty<'hir>)> {
678 if self.parenthesized != GenericArgsParentheses::ParenSugar {
679 return None;
680 }
681
682 let inputs = self
683 .args
684 .iter()
685 .find_map(|arg| {
686 let GenericArg::Type(ty) = arg else { return None };
687 let TyKind::Tup(tys) = &ty.kind else { return None };
688 Some(tys)
689 })
690 .unwrap();
691
692 Some((inputs, self.paren_sugar_output_inner()))
693 }
694
695 pub fn paren_sugar_output(&self) -> Option<&Ty<'hir>> {
700 (self.parenthesized == GenericArgsParentheses::ParenSugar)
701 .then(|| self.paren_sugar_output_inner())
702 }
703
704 fn paren_sugar_output_inner(&self) -> &Ty<'hir> {
705 let [constraint] = self.constraints.try_into().unwrap();
706 if true {
{
match (&constraint.ident.name, &sym::Output) {
(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);
}
}
}
};
};debug_assert_eq!(constraint.ident.name, sym::Output);
707 constraint.ty().unwrap()
708 }
709
710 pub fn has_err(&self) -> Option<ErrorGuaranteed> {
711 self.args
712 .iter()
713 .find_map(|arg| {
714 let GenericArg::Type(ty) = arg else { return None };
715 let TyKind::Err(guar) = ty.kind else { return None };
716 Some(guar)
717 })
718 .or_else(|| {
719 self.constraints.iter().find_map(|constraint| {
720 let TyKind::Err(guar) = constraint.ty()?.kind else { return None };
721 Some(guar)
722 })
723 })
724 }
725
726 #[inline]
727 pub fn num_lifetime_args(&self) -> usize {
728 self.args.iter().filter(|arg| #[allow(non_exhaustive_omitted_patterns)] match arg {
GenericArg::Lifetime(_) => true,
_ => false,
}matches!(arg, GenericArg::Lifetime(_))).count()
729 }
730
731 #[inline]
732 pub fn has_lifetime_args(&self) -> bool {
733 self.args.iter().any(|arg| #[allow(non_exhaustive_omitted_patterns)] match arg {
GenericArg::Lifetime(_) => true,
_ => false,
}matches!(arg, GenericArg::Lifetime(_)))
734 }
735
736 #[inline]
737 pub fn num_generic_params(&self) -> usize {
740 self.args.iter().filter(|arg| !#[allow(non_exhaustive_omitted_patterns)] match arg {
GenericArg::Lifetime(_) => true,
_ => false,
}matches!(arg, GenericArg::Lifetime(_))).count()
741 }
742
743 pub fn span(&self) -> Option<Span> {
749 let span_ext = self.span_ext()?;
750 Some(span_ext.with_lo(span_ext.lo() + BytePos(1)).with_hi(span_ext.hi() - BytePos(1)))
751 }
752
753 pub fn span_ext(&self) -> Option<Span> {
755 Some(self.span_ext).filter(|span| !span.is_empty())
756 }
757
758 pub fn is_empty(&self) -> bool {
759 self.args.is_empty()
760 }
761}
762
763#[derive(#[automatically_derived]impl ::core::marker::Copy for GenericArgsParentheses {
}Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for GenericArgsParentheses {
}
#[automatically_derived]impl ::core::clone::Clone for GenericArgsParentheses {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
GenericArgsParentheses {
}
#[automatically_derived]impl ::core::cmp::PartialEq for GenericArgsParentheses
{
#[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 GenericArgsParentheses { }Eq, #[automatically_derived]impl ::core::fmt::Debug for GenericArgsParentheses {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
GenericArgsParentheses::No => "No",
GenericArgsParentheses::ReturnTypeNotation =>
"ReturnTypeNotation",
GenericArgsParentheses::ParenSugar => "ParenSugar",
})
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
GenericArgsParentheses {
#[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 {
GenericArgsParentheses::No =>
0u8.stable_hash(__hcx, __hasher),
GenericArgsParentheses::ReturnTypeNotation =>
1u8.stable_hash(__hcx, __hasher),
GenericArgsParentheses::ParenSugar =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
GenericArgsParentheses::No => {}
GenericArgsParentheses::ReturnTypeNotation => {}
GenericArgsParentheses::ParenSugar => {}
}
}
}
};StableHash)]
764pub enum GenericArgsParentheses {
765 No,
766 ReturnTypeNotation,
769 ParenSugar,
771}
772
773#[derive(#[automatically_derived]impl ::core::marker::Copy for TraitBoundModifiers { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for TraitBoundModifiers {
}
#[automatically_derived]impl ::core::clone::Clone for TraitBoundModifiers {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<BoundConstness>;
let _: ::core::clone::AssertParamIsClone<BoundPolarity>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
TraitBoundModifiers {
}
#[automatically_derived]impl ::core::cmp::PartialEq for TraitBoundModifiers {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.constness == other.constness && self.polarity == other.polarity
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for TraitBoundModifiers {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<BoundConstness>;
let _: ::core::cmp::AssertParamIsEq<BoundPolarity>;
}
}Eq, #[automatically_derived]impl ::core::hash::Hash for TraitBoundModifiers {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.constness, state);
::core::hash::Hash::hash(&self.polarity, state)
}
}Hash, #[automatically_derived]impl ::core::fmt::Debug for TraitBoundModifiers {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TraitBoundModifiers constness polarity", &self.constness,
&&self.polarity)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
TraitBoundModifiers {
#[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 {
TraitBoundModifiers {
constness: ref __binding_0, polarity: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
775pub struct TraitBoundModifiers {
776 pub constness: BoundConstness,
777 pub polarity: BoundPolarity,
778}
779
780impl TraitBoundModifiers {
781 pub const NONE: Self =
782 TraitBoundModifiers { constness: BoundConstness::Never, polarity: BoundPolarity::Positive };
783}
784
785#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for GenericBound<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for GenericBound<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<PolyTraitRef<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
let _:
::core::clone::AssertParamIsClone<&'hir [PreciseCapturingArg<'hir>]>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for GenericBound<'hir>
{
}Copy, #[automatically_derived]impl<'hir> ::core::fmt::Debug for GenericBound<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Trait(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Trait",
&__self_0),
Self::Outlives(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Outlives", &__self_0),
Self::Use(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Use",
__self_0, &__self_1),
}
}
}Debug, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
GenericBound<'hir> {
#[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 {
GenericBound::Trait(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
GenericBound::Outlives(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
GenericBound::Use(ref __binding_0, ref __binding_1) =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
GenericBound::Trait(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
GenericBound::Outlives(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
GenericBound::Use(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
786pub enum GenericBound<'hir> {
787 Trait(PolyTraitRef<'hir>),
788 Outlives(&'hir Lifetime),
789 Use(&'hir [PreciseCapturingArg<'hir>], Span),
790}
791
792impl GenericBound<'_> {
793 pub fn trait_ref(&self) -> Option<&TraitRef<'_>> {
794 match self {
795 GenericBound::Trait(data) => Some(&data.trait_ref),
796 _ => None,
797 }
798 }
799
800 pub fn span(&self) -> Span {
801 match self {
802 GenericBound::Trait(t, ..) => t.span,
803 GenericBound::Outlives(l) => l.ident.span,
804 GenericBound::Use(_, span) => *span,
805 }
806 }
807}
808
809pub type GenericBounds<'hir> = &'hir [GenericBound<'hir>];
810
811#[derive(#[automatically_derived]impl ::core::marker::Copy for MissingLifetimeKind { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for MissingLifetimeKind {
}
#[automatically_derived]impl ::core::clone::Clone for MissingLifetimeKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
MissingLifetimeKind {
}
#[automatically_derived]impl ::core::cmp::PartialEq for MissingLifetimeKind {
#[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 MissingLifetimeKind { }Eq, #[automatically_derived]impl ::core::cmp::PartialOrd for MissingLifetimeKind {
#[inline]
fn partial_cmp(&self, other: &Self)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
}
}PartialOrd, #[automatically_derived]impl ::core::cmp::Ord for MissingLifetimeKind {
#[inline]
fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
::core::cmp::Ord::cmp(&::core::intrinsics::discriminant_value(self),
&::core::intrinsics::discriminant_value(other))
}
}Ord, #[automatically_derived]impl ::core::hash::Hash for MissingLifetimeKind {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state)
}
}Hash, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
MissingLifetimeKind {
#[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 {
MissingLifetimeKind::Underscore =>
0u8.stable_hash(__hcx, __hasher),
MissingLifetimeKind::Ampersand =>
1u8.stable_hash(__hcx, __hasher),
MissingLifetimeKind::Comma =>
2u8.stable_hash(__hcx, __hasher),
MissingLifetimeKind::Brackets =>
3u8.stable_hash(__hcx, __hasher),
}
match *self {
MissingLifetimeKind::Underscore => {}
MissingLifetimeKind::Ampersand => {}
MissingLifetimeKind::Comma => {}
MissingLifetimeKind::Brackets => {}
}
}
}
};StableHash, #[automatically_derived]impl ::core::fmt::Debug for MissingLifetimeKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
MissingLifetimeKind::Underscore => "Underscore",
MissingLifetimeKind::Ampersand => "Ampersand",
MissingLifetimeKind::Comma => "Comma",
MissingLifetimeKind::Brackets => "Brackets",
})
}
}Debug)]
812pub enum MissingLifetimeKind {
813 Underscore,
815 Ampersand,
817 Comma,
819 Brackets,
821}
822
823#[derive(#[automatically_derived]impl ::core::marker::Copy for LifetimeParamKind { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for LifetimeParamKind {
}
#[automatically_derived]impl ::core::clone::Clone for LifetimeParamKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<MissingLifetimeKind>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for LifetimeParamKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Explicit =>
::core::fmt::Formatter::write_str(f, "Explicit"),
Self::Elided(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Elided", &__self_0),
Self::Error => ::core::fmt::Formatter::write_str(f, "Error"),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
LifetimeParamKind {
#[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 {
LifetimeParamKind::Explicit =>
0u8.stable_hash(__hcx, __hasher),
LifetimeParamKind::Elided(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
LifetimeParamKind::Error =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
LifetimeParamKind::Explicit => {}
LifetimeParamKind::Elided(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
LifetimeParamKind::Error => {}
}
}
}
};StableHash)]
824pub enum LifetimeParamKind {
825 Explicit,
828
829 Elided(MissingLifetimeKind),
832
833 Error,
835}
836
837#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
GenericParamKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Lifetime { kind: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Lifetime kind", &__self_0),
Self::Type { default: __self_0, synthetic: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Type default synthetic", __self_0, &__self_1),
Self::Const { ty: __self_0, default: __self_1, arg_pos: __self_2 }
=>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Const ty default arg_pos", __self_0, __self_1, &__self_2),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for GenericParamKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
GenericParamKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<LifetimeParamKind>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _:
::core::clone::AssertParamIsClone<Option<&'hir ConstArg<'hir>>>;
let _: ::core::clone::AssertParamIsClone<Option<u16>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
GenericParamKind<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
GenericParamKind<'hir> {
#[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 {
GenericParamKind::Lifetime { kind: ref __binding_0 } =>
0u8.stable_hash(__hcx, __hasher),
GenericParamKind::Type {
default: ref __binding_0, synthetic: ref __binding_1 } =>
1u8.stable_hash(__hcx, __hasher),
GenericParamKind::Const {
ty: ref __binding_0,
default: ref __binding_1,
arg_pos: ref __binding_2 } =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
GenericParamKind::Lifetime { kind: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
GenericParamKind::Type {
default: ref __binding_0, synthetic: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
GenericParamKind::Const {
ty: ref __binding_0,
default: ref __binding_1,
arg_pos: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
838pub enum GenericParamKind<'hir> {
839 Lifetime {
841 kind: LifetimeParamKind,
842 },
843 Type {
844 default: Option<&'hir Ty<'hir>>,
845 synthetic: bool,
846 },
847 Const {
848 ty: &'hir Ty<'hir>,
849 default: Option<&'hir ConstArg<'hir>>,
851 arg_pos: Option<u16>,
854 },
855}
856
857#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for GenericParam<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"GenericParam hir_id def_id name span pure_wrt_drop kind colon_span source",
&[&self.hir_id, &self.def_id, &self.name, &self.span,
&self.pure_wrt_drop, &self.kind, &self.colon_span,
&&self.source])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for GenericParam<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for GenericParam<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
let _: ::core::clone::AssertParamIsClone<ParamName>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<GenericParamKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<Span>>;
let _: ::core::clone::AssertParamIsClone<GenericParamSource>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for GenericParam<'hir>
{
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
GenericParam<'hir> {
#[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 {
GenericParam {
hir_id: ref __binding_0,
def_id: ref __binding_1,
name: ref __binding_2,
span: ref __binding_3,
pure_wrt_drop: ref __binding_4,
kind: ref __binding_5,
colon_span: ref __binding_6,
source: ref __binding_7 } => {
{}
{ __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); }
}
}
}
}
};StableHash)]
858pub struct GenericParam<'hir> {
859 #[stable_hash(ignore)]
860 pub hir_id: HirId,
861 pub def_id: LocalDefId,
862 pub name: ParamName,
863 pub span: Span,
864 pub pure_wrt_drop: bool,
865 pub kind: GenericParamKind<'hir>,
866 pub colon_span: Option<Span>,
867 pub source: GenericParamSource,
868}
869
870impl<'hir> GenericParam<'hir> {
871 pub fn is_impl_trait(&self) -> bool {
875 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
GenericParamKind::Type { synthetic: true, .. } => true,
_ => false,
}matches!(self.kind, GenericParamKind::Type { synthetic: true, .. })
876 }
877
878 pub fn is_elided_lifetime(&self) -> bool {
882 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
GenericParamKind::Lifetime { kind: LifetimeParamKind::Elided(_) } => true,
_ => false,
}matches!(self.kind, GenericParamKind::Lifetime { kind: LifetimeParamKind::Elided(_) })
883 }
884
885 pub fn is_lifetime(&self) -> bool {
886 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
GenericParamKind::Lifetime { .. } => true,
_ => false,
}matches!(self.kind, GenericParamKind::Lifetime { .. })
887 }
888}
889
890#[derive(#[automatically_derived]impl ::core::fmt::Debug for GenericParamSource {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
GenericParamSource::Generics => "Generics",
GenericParamSource::Binder => "Binder",
})
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for GenericParamSource {
}
#[automatically_derived]impl ::core::clone::Clone for GenericParamSource {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::Copy for GenericParamSource { }Copy, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
GenericParamSource {
#[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 {
GenericParamSource::Generics =>
0u8.stable_hash(__hcx, __hasher),
GenericParamSource::Binder =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
GenericParamSource::Generics => {}
GenericParamSource::Binder => {}
}
}
}
};StableHash)]
897pub enum GenericParamSource {
898 Generics,
900 Binder,
902}
903
904#[derive(#[automatically_derived]impl ::core::default::Default for GenericParamCount {
#[inline]
fn default() -> Self {
GenericParamCount {
lifetimes: ::core::default::Default::default(),
types: ::core::default::Default::default(),
consts: ::core::default::Default::default(),
infer: ::core::default::Default::default(),
}
}
}Default)]
905pub struct GenericParamCount {
906 pub lifetimes: usize,
907 pub types: usize,
908 pub consts: usize,
909 pub infer: usize,
910}
911
912#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Generics<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"Generics params predicates has_where_clause_predicates where_clause_span span",
&self.params, &self.predicates, &self.has_where_clause_predicates,
&self.where_clause_span, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Generics<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Generics<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
let _:
::core::clone::AssertParamIsClone<&'hir [WherePredicate<'hir>]>;
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Generics<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Generics<'hir> {
#[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 {
Generics {
params: ref __binding_0,
predicates: ref __binding_1,
has_where_clause_predicates: ref __binding_2,
where_clause_span: ref __binding_3,
span: 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)]
915pub struct Generics<'hir> {
916 pub params: &'hir [GenericParam<'hir>],
917 pub predicates: &'hir [WherePredicate<'hir>],
918 pub has_where_clause_predicates: bool,
919 pub where_clause_span: Span,
920 pub span: Span,
921}
922
923impl<'hir> Generics<'hir> {
924 pub const fn empty() -> &'hir Generics<'hir> {
925 const NOPE: Generics<'_> = Generics {
926 params: &[],
927 predicates: &[],
928 has_where_clause_predicates: false,
929 where_clause_span: DUMMY_SP,
930 span: DUMMY_SP,
931 };
932 &NOPE
933 }
934
935 pub fn get_named(&self, name: Symbol) -> Option<&GenericParam<'hir>> {
936 self.params.iter().find(|¶m| name == param.name.ident().name)
937 }
938
939 pub fn span_for_lifetime_suggestion(&self) -> Option<Span> {
941 if let Some(first) = self.params.first()
942 && self.span.contains(first.span)
943 {
944 Some(first.span.shrink_to_lo())
947 } else {
948 None
949 }
950 }
951
952 pub fn span_for_param_suggestion(&self) -> Option<Span> {
954 self.params.iter().any(|p| self.span.contains(p.span)).then(|| {
955 self.span.with_lo(self.span.hi() - BytePos(1)).shrink_to_lo()
958 })
959 }
960
961 pub fn tail_span_for_predicate_suggestion(&self) -> Span {
964 let end = self.where_clause_span.shrink_to_hi();
965 if self.has_where_clause_predicates {
966 self.predicates
967 .iter()
968 .rfind(|&p| p.kind.in_where_clause())
969 .map_or(end, |p| p.span)
970 .shrink_to_hi()
971 .to(end)
972 } else {
973 end
974 }
975 }
976
977 pub fn add_where_or_trailing_comma(&self) -> &'static str {
978 if self.has_where_clause_predicates {
979 ","
980 } else if self.where_clause_span.is_empty() {
981 " where"
982 } else {
983 ""
985 }
986 }
987
988 pub fn bounds_for_param(
989 &self,
990 param_def_id: LocalDefId,
991 ) -> impl Iterator<Item = &WhereBoundPredicate<'hir>> {
992 self.predicates.iter().filter_map(move |pred| match pred.kind {
993 WherePredicateKind::BoundPredicate(bp)
994 if bp.is_param_bound(param_def_id.to_def_id()) =>
995 {
996 Some(bp)
997 }
998 _ => None,
999 })
1000 }
1001
1002 pub fn outlives_for_param(
1003 &self,
1004 param_def_id: LocalDefId,
1005 ) -> impl Iterator<Item = &WhereRegionPredicate<'_>> {
1006 self.predicates.iter().filter_map(move |pred| match pred.kind {
1007 WherePredicateKind::RegionPredicate(rp) if rp.is_param_bound(param_def_id) => Some(rp),
1008 _ => None,
1009 })
1010 }
1011
1012 pub fn bounds_span_for_suggestions(
1023 &self,
1024 param_def_id: LocalDefId,
1025 ) -> Option<(Span, Option<Span>)> {
1026 self.bounds_for_param(param_def_id).flat_map(|bp| bp.bounds.iter().rev()).find_map(
1027 |bound| {
1028 let span_for_parentheses = if let Some(trait_ref) = bound.trait_ref()
1029 && let [.., segment] = trait_ref.path.segments
1030 && let Some(ret_ty) = segment.args().paren_sugar_output()
1031 && let ret_ty = ret_ty.peel_refs()
1032 && let TyKind::TraitObject(_, tagged_ptr) = ret_ty.kind
1033 && let TraitObjectSyntax::Dyn = tagged_ptr.tag()
1034 && ret_ty.span.can_be_used_for_suggestions()
1035 {
1036 Some(ret_ty.span)
1037 } else {
1038 None
1039 };
1040
1041 span_for_parentheses.map_or_else(
1042 || {
1043 let bs = bound.span();
1046 bs.from_expansion().not().then(|| (bs.shrink_to_hi(), None))
1051 },
1052 |span| Some((span.shrink_to_hi(), Some(span.shrink_to_lo()))),
1053 )
1054 },
1055 )
1056 }
1057
1058 pub fn span_for_predicate_removal(&self, pos: usize) -> Span {
1059 let predicate = &self.predicates[pos];
1060 let span = predicate.span;
1061
1062 if !predicate.kind.in_where_clause() {
1063 return span;
1066 }
1067
1068 if pos < self.predicates.len() - 1 {
1070 let next_pred = &self.predicates[pos + 1];
1071 if next_pred.kind.in_where_clause() {
1072 return span.until(next_pred.span);
1075 }
1076 }
1077
1078 if pos > 0 {
1079 let prev_pred = &self.predicates[pos - 1];
1080 if prev_pred.kind.in_where_clause() {
1081 return prev_pred.span.shrink_to_hi().to(span);
1084 }
1085 }
1086
1087 self.where_clause_span
1091 }
1092
1093 pub fn span_for_bound_removal(&self, predicate_pos: usize, bound_pos: usize) -> Span {
1094 let predicate = &self.predicates[predicate_pos];
1095 let bounds = predicate.kind.bounds();
1096
1097 if bounds.len() == 1 {
1098 return self.span_for_predicate_removal(predicate_pos);
1099 }
1100
1101 let bound_span = bounds[bound_pos].span();
1102 if bound_pos < bounds.len() - 1 {
1103 bound_span.to(bounds[bound_pos + 1].span().shrink_to_lo())
1109 } else {
1110 bound_span.with_lo(bounds[bound_pos - 1].span().hi())
1116 }
1117 }
1118
1119 pub fn span_for_param_removal(&self, param_index: usize) -> Span {
1142 if param_index >= self.params.len() {
1143 return self.span.shrink_to_hi();
1144 }
1145
1146 let is_param_explicit = |par: &&GenericParam<'_>| match par.kind {
1147 GenericParamKind::Type { .. }
1148 | GenericParamKind::Const { .. }
1149 | GenericParamKind::Lifetime { kind: LifetimeParamKind::Explicit } => true,
1150 _ => false,
1151 };
1152
1153 if let Some(next) = self.params[param_index + 1..].iter().find(is_param_explicit) {
1155 self.params[param_index].span.until(next.span)
1156 } else if let Some(prev) = self.params[..param_index].iter().rfind(is_param_explicit) {
1157 let mut prev_span = prev.span;
1158 if let Some(prev_bounds_span) = self.span_for_param_bounds(prev) {
1160 prev_span = prev_span.to(prev_bounds_span);
1161 }
1162
1163 prev_span.shrink_to_hi().to(
1165 if let Some(cur_bounds_span) = self.span_for_param_bounds(&self.params[param_index])
1166 {
1167 cur_bounds_span
1168 } else {
1169 self.params[param_index].span
1170 },
1171 )
1172 } else {
1173 self.span
1175 }
1176 }
1177
1178 fn span_for_param_bounds(&self, param: &GenericParam<'hir>) -> Option<Span> {
1189 self.predicates
1190 .iter()
1191 .find(|pred| {
1192 if let WherePredicateKind::BoundPredicate(WhereBoundPredicate {
1193 origin: PredicateOrigin::GenericParam,
1194 bounded_ty,
1195 ..
1196 }) = pred.kind
1197 {
1198 bounded_ty.span == param.span
1199 } else {
1200 false
1201 }
1202 })
1203 .map(|pred| pred.span)
1204 }
1205}
1206
1207#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for WherePredicate<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"WherePredicate hir_id span kind", &self.hir_id, &self.span,
&&self.kind)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for WherePredicate<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
WherePredicate<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _:
::core::clone::AssertParamIsClone<&'hir WherePredicateKind<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
WherePredicate<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
WherePredicate<'hir> {
#[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 {
WherePredicate {
hir_id: ref __binding_0,
span: ref __binding_1,
kind: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1209pub struct WherePredicate<'hir> {
1210 #[stable_hash(ignore)]
1211 pub hir_id: HirId,
1212 pub span: Span,
1213 pub kind: &'hir WherePredicateKind<'hir>,
1214}
1215
1216#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
WherePredicateKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::BoundPredicate(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"BoundPredicate", &__self_0),
Self::RegionPredicate(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"RegionPredicate", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for WherePredicateKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
WherePredicateKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<WhereBoundPredicate<'hir>>;
let _: ::core::clone::AssertParamIsClone<WhereRegionPredicate<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
WherePredicateKind<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
WherePredicateKind<'hir> {
#[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 {
WherePredicateKind::BoundPredicate(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
WherePredicateKind::RegionPredicate(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
WherePredicateKind::BoundPredicate(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
WherePredicateKind::RegionPredicate(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1218pub enum WherePredicateKind<'hir> {
1219 BoundPredicate(WhereBoundPredicate<'hir>),
1221 RegionPredicate(WhereRegionPredicate<'hir>),
1223}
1224
1225impl<'hir> WherePredicateKind<'hir> {
1226 pub fn in_where_clause(&self) -> bool {
1227 match self {
1228 WherePredicateKind::BoundPredicate(p) => p.origin == PredicateOrigin::WhereClause,
1229 WherePredicateKind::RegionPredicate(p) => p.in_where_clause,
1230 }
1231 }
1232
1233 pub fn bounds(&self) -> GenericBounds<'hir> {
1234 match self {
1235 WherePredicateKind::BoundPredicate(p) => p.bounds,
1236 WherePredicateKind::RegionPredicate(p) => p.bounds,
1237 }
1238 }
1239}
1240
1241#[derive(#[automatically_derived]impl ::core::marker::Copy for PredicateOrigin { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for PredicateOrigin {
}
#[automatically_derived]impl ::core::clone::Clone for PredicateOrigin {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::fmt::Debug for PredicateOrigin {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
PredicateOrigin::WhereClause => "WhereClause",
PredicateOrigin::GenericParam => "GenericParam",
PredicateOrigin::ImplTrait => "ImplTrait",
})
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
PredicateOrigin {
#[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 {
PredicateOrigin::WhereClause =>
0u8.stable_hash(__hcx, __hasher),
PredicateOrigin::GenericParam =>
1u8.stable_hash(__hcx, __hasher),
PredicateOrigin::ImplTrait =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
PredicateOrigin::WhereClause => {}
PredicateOrigin::GenericParam => {}
PredicateOrigin::ImplTrait => {}
}
}
}
};StableHash, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
PredicateOrigin {
}
#[automatically_derived]impl ::core::cmp::PartialEq for PredicateOrigin {
#[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 PredicateOrigin { }Eq)]
1242pub enum PredicateOrigin {
1243 WhereClause,
1244 GenericParam,
1245 ImplTrait,
1246}
1247
1248#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
WhereBoundPredicate<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"WhereBoundPredicate origin bound_generic_params bounded_ty bounds",
&self.origin, &self.bound_generic_params, &self.bounded_ty,
&&self.bounds)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for WhereBoundPredicate<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
WhereBoundPredicate<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<PredicateOrigin>;
let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
WhereBoundPredicate<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
WhereBoundPredicate<'hir> {
#[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 {
WhereBoundPredicate {
origin: ref __binding_0,
bound_generic_params: ref __binding_1,
bounded_ty: ref __binding_2,
bounds: 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)]
1250pub struct WhereBoundPredicate<'hir> {
1251 pub origin: PredicateOrigin,
1253 pub bound_generic_params: &'hir [GenericParam<'hir>],
1255 pub bounded_ty: &'hir Ty<'hir>,
1257 pub bounds: GenericBounds<'hir>,
1259}
1260
1261impl<'hir> WhereBoundPredicate<'hir> {
1262 pub fn is_param_bound(&self, param_def_id: DefId) -> bool {
1264 self.bounded_ty.as_generic_param().is_some_and(|(def_id, _)| def_id == param_def_id)
1265 }
1266}
1267
1268#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
WhereRegionPredicate<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"WhereRegionPredicate in_where_clause lifetime bounds",
&self.in_where_clause, &self.lifetime, &&self.bounds)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for WhereRegionPredicate<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
WhereRegionPredicate<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
WhereRegionPredicate<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
WhereRegionPredicate<'hir> {
#[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 {
WhereRegionPredicate {
in_where_clause: ref __binding_0,
lifetime: ref __binding_1,
bounds: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1270pub struct WhereRegionPredicate<'hir> {
1271 pub in_where_clause: bool,
1272 pub lifetime: &'hir Lifetime,
1273 pub bounds: GenericBounds<'hir>,
1274}
1275
1276impl<'hir> WhereRegionPredicate<'hir> {
1277 fn is_param_bound(&self, param_def_id: LocalDefId) -> bool {
1279 self.lifetime.kind == LifetimeKind::Param(param_def_id)
1280 }
1281}
1282
1283#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl<'tcx>
::core::clone::TrivialClone for ParentedNode<'tcx> {
}
#[automatically_derived]impl<'tcx> ::core::clone::Clone for ParentedNode<'tcx>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<ItemLocalId>;
let _: ::core::clone::AssertParamIsClone<Node<'tcx>>;
*self
}
}Clone, #[automatically_derived]impl<'tcx> ::core::marker::Copy for ParentedNode<'tcx>
{
}Copy, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for ParentedNode<'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,
"ParentedNode parent node", &self.parent, &&self.node)
}
}Debug)]
1287pub struct ParentedNode<'tcx> {
1288 pub parent: ItemLocalId,
1289 pub node: Node<'tcx>,
1290}
1291
1292#[derive(#[automatically_derived]impl<'tcx> ::core::fmt::Debug for AttributeMap<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"AttributeMap map define_opaque opt_hash", &self.map,
&self.define_opaque, &&self.opt_hash)
}
}Debug)]
1294pub struct AttributeMap<'tcx> {
1295 pub map: SortedMap<ItemLocalId, &'tcx [Attribute]>,
1296 pub define_opaque: Option<&'tcx [(Span, LocalDefId)]>,
1298 pub opt_hash: Option<Fingerprint>,
1300}
1301
1302impl<'tcx> AttributeMap<'tcx> {
1303 pub const EMPTY: &'static AttributeMap<'static> = &AttributeMap {
1304 map: SortedMap::new(),
1305 opt_hash: Some(Fingerprint::ZERO),
1306 define_opaque: None,
1307 };
1308
1309 #[inline]
1310 pub fn get(&self, id: ItemLocalId) -> &'tcx [Attribute] {
1311 self.map.get(&id).copied().unwrap_or(&[])
1312 }
1313}
1314
1315pub struct OwnerNodes<'tcx> {
1319 pub opt_hash: Option<Fingerprint>,
1322 pub nodes: IndexVec<ItemLocalId, ParentedNode<'tcx>>,
1327 pub bodies: SortedMap<ItemLocalId, &'tcx Body<'tcx>>,
1329}
1330
1331impl<'tcx> OwnerNodes<'tcx> {
1332 pub fn node(&self) -> OwnerNode<'tcx> {
1333 self.nodes[ItemLocalId::ZERO].node.as_owner().unwrap()
1335 }
1336
1337 pub fn synthetic() -> OwnerNodes<'tcx> {
1339 OwnerNodes {
1340 opt_hash: Some(Fingerprint::ZERO),
1343 nodes: IndexVec::from_elem_n(
1344 ParentedNode { parent: ItemLocalId::INVALID, node: OwnerNode::Synthetic.into() },
1345 1,
1346 ),
1347 bodies: SortedMap::new(),
1348 }
1349 }
1350}
1351
1352impl fmt::Debug for OwnerNodes<'_> {
1353 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1354 f.debug_struct("OwnerNodes")
1355 .field("node", &self.nodes[ItemLocalId::ZERO])
1357 .field(
1358 "parents",
1359 &fmt::from_fn(|f| {
1360 f.debug_list()
1361 .entries(self.nodes.iter_enumerated().map(|(id, parented_node)| {
1362 fmt::from_fn(move |f| f.write_fmt(format_args!("({1:?}, {0:?})", parented_node.parent, id))write!(f, "({id:?}, {:?})", parented_node.parent))
1363 }))
1364 .finish()
1365 }),
1366 )
1367 .field("bodies", &self.bodies)
1368 .field("opt_hash", &self.opt_hash)
1369 .finish()
1370 }
1371}
1372
1373#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for OwnerInfo<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"OwnerInfo nodes parenting attrs trait_map children delayed_lints opt_hash",
&[&self.nodes, &self.parenting, &self.attrs, &self.trait_map,
&self.children, &self.delayed_lints, &&self.opt_hash])
}
}Debug)]
1375pub struct OwnerInfo<'hir> {
1376 pub nodes: OwnerNodes<'hir>,
1378 pub parenting: LocalDefIdMap<ItemLocalId>,
1380 pub attrs: AttributeMap<'hir>,
1382 pub trait_map: ItemLocalMap<&'hir [TraitCandidate<'hir>]>,
1385 pub children: UnordMap<LocalDefId, MaybeOwner<'hir>>,
1387
1388 pub delayed_lints: Steal<DelayedLints>,
1394
1395 pub opt_hash: Option<Fingerprint>,
1397}
1398
1399impl<'tcx> OwnerInfo<'tcx> {
1400 #[inline]
1401 pub fn node(&self) -> OwnerNode<'tcx> {
1402 self.nodes.node()
1403 }
1404
1405 #[inline]
1409 pub fn fingerprint(&self) -> Fingerprint {
1410 let body = self.nodes.opt_hash.expect("HIR hash requested without needs_hir_hash");
1411 let attrs = self.attrs.opt_hash.expect("HIR hash requested without needs_hir_hash");
1412 body.combine(attrs)
1413 }
1414}
1415
1416#[derive(#[automatically_derived]impl<'tcx> ::core::marker::Copy for MaybeOwner<'tcx> {
}Copy, #[automatically_derived]#[doc(hidden)]unsafe impl<'tcx>
::core::clone::TrivialClone for MaybeOwner<'tcx> {
}
#[automatically_derived]impl<'tcx> ::core::clone::Clone for MaybeOwner<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'tcx OwnerInfo<'tcx>>;
let _: ::core::clone::AssertParamIsClone<HirId>;
*self
}
}Clone, #[automatically_derived]impl<'tcx> ::core::fmt::Debug for MaybeOwner<'tcx> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Owner(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Owner",
&__self_0),
Self::NonOwner(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"NonOwner", &__self_0),
}
}
}Debug, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
MaybeOwner<'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 {
MaybeOwner::Owner(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
MaybeOwner::NonOwner(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
MaybeOwner::Owner(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
MaybeOwner::NonOwner(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1417pub enum MaybeOwner<'tcx> {
1418 Owner(&'tcx OwnerInfo<'tcx>),
1419 NonOwner(HirId),
1420}
1421
1422impl<'tcx> MaybeOwner<'tcx> {
1423 #[inline]
1424 pub fn as_owner(self) -> Option<&'tcx OwnerInfo<'tcx>> {
1425 match self {
1426 MaybeOwner::Owner(i) => Some(i),
1427 MaybeOwner::NonOwner(_) => None,
1428 }
1429 }
1430
1431 #[inline]
1432 pub fn unwrap(self) -> &'tcx OwnerInfo<'tcx> {
1433 self.as_owner().unwrap_or_else(|| { ::core::panicking::panic_fmt(format_args!("Not a HIR owner")); }panic!("Not a HIR owner"))
1434 }
1435}
1436
1437#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Closure<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"Closure def_id binder constness capture_clause bound_generic_params fn_decl body fn_decl_span fn_arg_span kind explicit_captures",
&[&self.def_id, &self.binder, &self.constness,
&self.capture_clause, &self.bound_generic_params,
&self.fn_decl, &self.body, &self.fn_decl_span,
&self.fn_arg_span, &self.kind, &&self.explicit_captures])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Closure<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Closure<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
let _: ::core::clone::AssertParamIsClone<ClosureBinder>;
let _: ::core::clone::AssertParamIsClone<Constness>;
let _: ::core::clone::AssertParamIsClone<CaptureBy>;
let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir FnDecl<'hir>>;
let _: ::core::clone::AssertParamIsClone<BodyId>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<Option<Span>>;
let _: ::core::clone::AssertParamIsClone<ClosureKind>;
let _: ::core::clone::AssertParamIsClone<&'hir [ExplicitCapture]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Closure<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Closure<'hir> {
#[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 {
Closure {
def_id: ref __binding_0,
binder: ref __binding_1,
constness: ref __binding_2,
capture_clause: ref __binding_3,
bound_generic_params: ref __binding_4,
fn_decl: ref __binding_5,
body: ref __binding_6,
fn_decl_span: ref __binding_7,
fn_arg_span: ref __binding_8,
kind: ref __binding_9,
explicit_captures: ref __binding_10 } => {
{ __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); }
}
}
}
}
};StableHash)]
1438pub struct Closure<'hir> {
1439 pub def_id: LocalDefId,
1440 pub binder: ClosureBinder,
1441 pub constness: Constness,
1442 pub capture_clause: CaptureBy,
1443 pub bound_generic_params: &'hir [GenericParam<'hir>],
1444 pub fn_decl: &'hir FnDecl<'hir>,
1445 pub body: BodyId,
1446 pub fn_decl_span: Span,
1448 pub fn_arg_span: Option<Span>,
1450 pub kind: ClosureKind,
1451 pub explicit_captures: &'hir [ExplicitCapture],
1452}
1453
1454#[derive(#[automatically_derived]impl ::core::fmt::Debug for ExplicitCapture {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ExplicitCapture var_hir_id", &&self.var_hir_id)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ExplicitCapture {
}
#[automatically_derived]impl ::core::clone::Clone for ExplicitCapture {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for ExplicitCapture { }Copy, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
ExplicitCapture {
#[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 {
ExplicitCapture { var_hir_id: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1457pub struct ExplicitCapture {
1458 pub var_hir_id: HirId,
1459}
1460
1461#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ClosureKind {
}
#[automatically_derived]impl ::core::clone::Clone for ClosureKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<CoroutineKind>;
let _: ::core::clone::AssertParamIsClone<CoroutineDesugaring>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
ClosureKind {
}
#[automatically_derived]impl ::core::cmp::PartialEq for ClosureKind {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Coroutine(__self_0), Self::Coroutine(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::CoroutineClosure(__self_0),
Self::CoroutineClosure(__arg1_0)) => __self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for ClosureKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<CoroutineKind>;
let _: ::core::cmp::AssertParamIsEq<CoroutineDesugaring>;
}
}Eq, #[automatically_derived]impl ::core::fmt::Debug for ClosureKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Closure => ::core::fmt::Formatter::write_str(f, "Closure"),
Self::Coroutine(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Coroutine", &__self_0),
Self::CoroutineClosure(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"CoroutineClosure", &__self_0),
}
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for ClosureKind { }Copy, #[automatically_derived]impl ::core::hash::Hash for ClosureKind {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
match self {
Self::Coroutine(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
Self::CoroutineClosure(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
_ => {}
}
}
}Hash, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for ClosureKind
{
#[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 {
ClosureKind::Closure => 0u8.stable_hash(__hcx, __hasher),
ClosureKind::Coroutine(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
ClosureKind::CoroutineClosure(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
ClosureKind::Closure => {}
ClosureKind::Coroutine(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ClosureKind::CoroutineClosure(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for ClosureKind {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
ClosureKind::Closure => { 0usize }
ClosureKind::Coroutine(ref __binding_0) => { 1usize }
ClosureKind::CoroutineClosure(ref __binding_0) => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
ClosureKind::Closure => {}
ClosureKind::Coroutine(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ClosureKind::CoroutineClosure(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for ClosureKind {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { ClosureKind::Closure }
1usize => {
ClosureKind::Coroutine(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
ClosureKind::CoroutineClosure(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ClosureKind`, expected 0..3, actual {0}",
n));
}
}
}
}
};Decodable)]
1462pub enum ClosureKind {
1463 Closure,
1465 Coroutine(CoroutineKind),
1470 CoroutineClosure(CoroutineDesugaring),
1475}
1476
1477#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Block<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"Block stmts expr hir_id rules span targeted_by_break",
&[&self.stmts, &self.expr, &self.hir_id, &self.rules, &self.span,
&&self.targeted_by_break])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Block<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Block<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [Stmt<'hir>]>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<BlockCheckMode>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Block<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Block<'hir> {
#[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 {
Block {
stmts: ref __binding_0,
expr: ref __binding_1,
hir_id: ref __binding_2,
rules: ref __binding_3,
span: ref __binding_4,
targeted_by_break: ref __binding_5 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{}
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
{ __binding_5.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1481pub struct Block<'hir> {
1482 pub stmts: &'hir [Stmt<'hir>],
1484 pub expr: Option<&'hir Expr<'hir>>,
1487 #[stable_hash(ignore)]
1488 pub hir_id: HirId,
1489 pub rules: BlockCheckMode,
1491 pub span: Span,
1493 pub targeted_by_break: bool,
1497}
1498
1499impl<'hir> Block<'hir> {
1500 pub fn innermost_block(&self) -> &Block<'hir> {
1501 let mut block = self;
1502 while let Some(Expr { kind: ExprKind::Block(inner_block, _), .. }) = block.expr {
1503 block = inner_block;
1504 }
1505 block
1506 }
1507}
1508
1509#[derive(#[automatically_derived]impl ::core::fmt::Debug for TyFieldPath {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TyFieldPath variant field", &self.variant, &&self.field)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for TyFieldPath {
}
#[automatically_derived]impl ::core::clone::Clone for TyFieldPath {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Option<Ident>>;
let _: ::core::clone::AssertParamIsClone<Ident>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for TyFieldPath { }Copy, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for TyFieldPath
{
#[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 {
TyFieldPath {
variant: ref __binding_0, field: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1510pub struct TyFieldPath {
1511 pub variant: Option<Ident>,
1512 pub field: Ident,
1513}
1514
1515#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for TyPat<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"TyPat hir_id kind span", &self.hir_id, &self.kind, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TyPat<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for TyPat<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<TyPatKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for TyPat<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TyPat<'hir> {
#[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 {
TyPat {
hir_id: ref __binding_0,
kind: ref __binding_1,
span: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1516pub struct TyPat<'hir> {
1517 #[stable_hash(ignore)]
1518 pub hir_id: HirId,
1519 pub kind: TyPatKind<'hir>,
1520 pub span: Span,
1521}
1522
1523#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Pat<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"Pat hir_id kind span default_binding_modes", &self.hir_id,
&self.kind, &self.span, &&self.default_binding_modes)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Pat<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Pat<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<PatKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Pat<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Pat<'hir> {
#[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 {
Pat {
hir_id: ref __binding_0,
kind: ref __binding_1,
span: ref __binding_2,
default_binding_modes: ref __binding_3 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1524pub struct Pat<'hir> {
1525 #[stable_hash(ignore)]
1526 pub hir_id: HirId,
1527 pub kind: PatKind<'hir>,
1528 pub span: Span,
1529 pub default_binding_modes: bool,
1532}
1533
1534impl<'hir> Pat<'hir> {
1535 fn walk_short_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool) -> bool {
1536 if !it(self) {
1537 return false;
1538 }
1539
1540 use PatKind::*;
1541 match self.kind {
1542 Missing => ::core::panicking::unreachable_default_msg()unreachable!(),
1543 Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Err(_) => true,
1544 Deref(s) | Ref(s, _, _) | Binding(.., Some(s)) | Guard(s, _) => s.walk_short_(it),
1545 Struct(_, fields, _) => fields.iter().all(|field| field.pat.walk_short_(it)),
1546 TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().all(|p| p.walk_short_(it)),
1547 Slice(before, slice, after) => {
1548 before.iter().chain(slice).chain(after.iter()).all(|p| p.walk_short_(it))
1549 }
1550 }
1551 }
1552
1553 pub fn walk_short(&self, mut it: impl FnMut(&Pat<'hir>) -> bool) -> bool {
1560 self.walk_short_(&mut it)
1561 }
1562
1563 fn walk_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool) {
1564 if !it(self) {
1565 return;
1566 }
1567
1568 use PatKind::*;
1569 match self.kind {
1570 Missing | Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Err(_) => {}
1571 Deref(s) | Ref(s, _, _) | Binding(.., Some(s)) | Guard(s, _) => s.walk_(it),
1572 Struct(_, fields, _) => fields.iter().for_each(|field| field.pat.walk_(it)),
1573 TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().for_each(|p| p.walk_(it)),
1574 Slice(before, slice, after) => {
1575 before.iter().chain(slice).chain(after.iter()).for_each(|p| p.walk_(it))
1576 }
1577 }
1578 }
1579
1580 pub fn walk(&self, mut it: impl FnMut(&Pat<'hir>) -> bool) {
1584 self.walk_(&mut it)
1585 }
1586
1587 pub fn walk_always(&self, mut it: impl FnMut(&Pat<'_>)) {
1591 self.walk(|p| {
1592 it(p);
1593 true
1594 })
1595 }
1596
1597 pub fn is_never_pattern(&self) -> bool {
1599 let mut is_never_pattern = false;
1600 self.walk(|pat| match &pat.kind {
1601 PatKind::Never => {
1602 is_never_pattern = true;
1603 false
1604 }
1605 PatKind::Or(s) => {
1606 is_never_pattern = s.iter().all(|p| p.is_never_pattern());
1607 false
1608 }
1609 _ => true,
1610 });
1611 is_never_pattern
1612 }
1613
1614 pub fn is_guaranteed_to_constitute_read_for_never(&self) -> bool {
1623 match self.kind {
1624 PatKind::Wild => false,
1626
1627 PatKind::Guard(pat, _) => pat.is_guaranteed_to_constitute_read_for_never(),
1630
1631 PatKind::Or(subpats) => {
1640 subpats.iter().all(|pat| pat.is_guaranteed_to_constitute_read_for_never())
1641 }
1642
1643 PatKind::Never => true,
1645
1646 PatKind::Missing
1649 | PatKind::Binding(_, _, _, _)
1650 | PatKind::Struct(_, _, _)
1651 | PatKind::TupleStruct(_, _, _)
1652 | PatKind::Tuple(_, _)
1653 | PatKind::Ref(_, _, _)
1654 | PatKind::Deref(_)
1655 | PatKind::Expr(_)
1656 | PatKind::Range(_, _, _)
1657 | PatKind::Slice(_, _, _)
1658 | PatKind::Err(_) => true,
1659 }
1660 }
1661}
1662
1663#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for PatField<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"PatField hir_id ident pat is_shorthand span", &self.hir_id,
&self.ident, &self.pat, &self.is_shorthand, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for PatField<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for PatField<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for PatField<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
PatField<'hir> {
#[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 {
PatField {
hir_id: ref __binding_0,
ident: ref __binding_1,
pat: ref __binding_2,
is_shorthand: ref __binding_3,
span: ref __binding_4 } => {
{}
{ __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)]
1669pub struct PatField<'hir> {
1670 #[stable_hash(ignore)]
1671 pub hir_id: HirId,
1672 pub ident: Ident,
1674 pub pat: &'hir Pat<'hir>,
1676 pub is_shorthand: bool,
1677 pub span: Span,
1678}
1679
1680#[derive(#[automatically_derived]impl ::core::marker::Copy for RangeEnd { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for RangeEnd {
}
#[automatically_derived]impl ::core::clone::Clone for RangeEnd {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for RangeEnd
{
}
#[automatically_derived]impl ::core::cmp::PartialEq for RangeEnd {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]impl ::core::fmt::Debug for RangeEnd {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
RangeEnd::Included => "Included",
RangeEnd::Excluded => "Excluded",
})
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for RangeEnd {
#[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 {
RangeEnd::Included => 0u8.stable_hash(__hcx, __hasher),
RangeEnd::Excluded => 1u8.stable_hash(__hcx, __hasher),
}
match *self {
RangeEnd::Included => {}
RangeEnd::Excluded => {}
}
}
}
};StableHash, #[automatically_derived]impl ::core::hash::Hash for RangeEnd {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state)
}
}Hash, #[automatically_derived]impl ::core::cmp::Eq for RangeEnd { }Eq, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for RangeEnd {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
RangeEnd::Included => { 0usize }
RangeEnd::Excluded => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for RangeEnd {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { RangeEnd::Included }
1usize => { RangeEnd::Excluded }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `RangeEnd`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable)]
1681pub enum RangeEnd {
1682 Included,
1683 Excluded,
1684}
1685
1686impl fmt::Display for RangeEnd {
1687 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1688 f.write_str(match self {
1689 RangeEnd::Included => "..=",
1690 RangeEnd::Excluded => "..",
1691 })
1692 }
1693}
1694
1695#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for DotDotPos {
}
#[automatically_derived]impl ::core::clone::Clone for DotDotPos {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for DotDotPos { }Copy, #[automatically_derived]impl ::core::marker::StructuralPartialEq for DotDotPos
{
}
#[automatically_derived]impl ::core::cmp::PartialEq for DotDotPos {
#[inline]
fn eq(&self, other: &Self) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for DotDotPos {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
}Eq, #[automatically_derived]impl ::core::hash::Hash for DotDotPos {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.0, state)
}
}Hash, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for DotDotPos {
#[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 {
DotDotPos(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1699pub struct DotDotPos(u32);
1700
1701impl DotDotPos {
1702 pub fn new(n: Option<usize>) -> Self {
1704 match n {
1705 Some(n) => {
1706 if !(n < u32::MAX as usize) {
::core::panicking::panic("assertion failed: n < u32::MAX as usize")
};assert!(n < u32::MAX as usize);
1707 Self(n as u32)
1708 }
1709 None => Self(u32::MAX),
1710 }
1711 }
1712
1713 pub fn as_opt_usize(&self) -> Option<usize> {
1714 if self.0 == u32::MAX { None } else { Some(self.0 as usize) }
1715 }
1716}
1717
1718impl fmt::Debug for DotDotPos {
1719 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1720 self.as_opt_usize().fmt(f)
1721 }
1722}
1723
1724#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for PatExpr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"PatExpr hir_id span kind", &self.hir_id, &self.span, &&self.kind)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for PatExpr<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for PatExpr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<PatExprKind<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for PatExpr<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
PatExpr<'hir> {
#[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 {
PatExpr {
hir_id: ref __binding_0,
span: ref __binding_1,
kind: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1725pub struct PatExpr<'hir> {
1726 #[stable_hash(ignore)]
1727 pub hir_id: HirId,
1728 pub span: Span,
1729 pub kind: PatExprKind<'hir>,
1730}
1731
1732#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for PatExprKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Lit { lit: __self_0, negated: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Lit lit negated", __self_0, &__self_1),
Self::Path(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Path",
&__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for PatExprKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for PatExprKind<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Lit>;
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for PatExprKind<'hir>
{
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
PatExprKind<'hir> {
#[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 {
PatExprKind::Lit {
lit: ref __binding_0, negated: ref __binding_1 } =>
0u8.stable_hash(__hcx, __hasher),
PatExprKind::Path(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
PatExprKind::Lit {
lit: ref __binding_0, negated: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
PatExprKind::Path(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1733pub enum PatExprKind<'hir> {
1734 Lit {
1735 lit: Lit,
1736 negated: bool,
1737 },
1738 Path(QPath<'hir>),
1740}
1741
1742#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for TyPatKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Range(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Range",
__self_0, &__self_1),
Self::NotNull => ::core::fmt::Formatter::write_str(f, "NotNull"),
Self::Or(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Or",
&__self_0),
Self::Err(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Err",
&__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TyPatKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for TyPatKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [TyPat<'hir>]>;
let _: ::core::clone::AssertParamIsClone<ErrorGuaranteed>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for TyPatKind<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TyPatKind<'hir> {
#[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 {
TyPatKind::Range(ref __binding_0, ref __binding_1) =>
0u8.stable_hash(__hcx, __hasher),
TyPatKind::NotNull => 1u8.stable_hash(__hcx, __hasher),
TyPatKind::Or(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
TyPatKind::Err(ref __binding_0) =>
3u8.stable_hash(__hcx, __hasher),
}
match *self {
TyPatKind::Range(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TyPatKind::NotNull => {}
TyPatKind::Or(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyPatKind::Err(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1743pub enum TyPatKind<'hir> {
1744 Range(&'hir ConstArg<'hir>, &'hir ConstArg<'hir>),
1746
1747 NotNull,
1749
1750 Or(&'hir [TyPat<'hir>]),
1752
1753 Err(ErrorGuaranteed),
1755}
1756
1757#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for PatKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Missing => ::core::fmt::Formatter::write_str(f, "Missing"),
Self::Wild => ::core::fmt::Formatter::write_str(f, "Wild"),
Self::Binding(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_struct_field4_finish(f,
"Binding", __self_0, __self_1, __self_2, &__self_3),
Self::Struct(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Struct", __self_0, __self_1, &__self_2),
Self::TupleStruct(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"TupleStruct", __self_0, __self_1, &__self_2),
Self::Or(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Or",
&__self_0),
Self::Never => ::core::fmt::Formatter::write_str(f, "Never"),
Self::Tuple(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Tuple",
__self_0, &__self_1),
Self::Deref(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Deref",
&__self_0),
Self::Ref(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Ref",
__self_0, __self_1, &__self_2),
Self::Expr(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Expr",
&__self_0),
Self::Guard(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Guard",
__self_0, &__self_1),
Self::Range(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Range",
__self_0, __self_1, &__self_2),
Self::Slice(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Slice",
__self_0, __self_1, &__self_2),
Self::Err(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Err",
&__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for PatKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for PatKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<BindingMode>;
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Pat<'hir>>>;
let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [PatField<'hir>]>;
let _: ::core::clone::AssertParamIsClone<Option<Span>>;
let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
let _: ::core::clone::AssertParamIsClone<DotDotPos>;
let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
let _: ::core::clone::AssertParamIsClone<Pinnedness>;
let _: ::core::clone::AssertParamIsClone<Mutability>;
let _: ::core::clone::AssertParamIsClone<&'hir PatExpr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir PatExpr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir PatExpr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<RangeEnd>;
let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Pat<'hir>>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
let _: ::core::clone::AssertParamIsClone<ErrorGuaranteed>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for PatKind<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
PatKind<'hir> {
#[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 {
PatKind::Missing => 0u8.stable_hash(__hcx, __hasher),
PatKind::Wild => 1u8.stable_hash(__hcx, __hasher),
PatKind::Binding(ref __binding_0, ref __binding_1,
ref __binding_2, ref __binding_3) =>
2u8.stable_hash(__hcx, __hasher),
PatKind::Struct(ref __binding_0, ref __binding_1,
ref __binding_2) => 3u8.stable_hash(__hcx, __hasher),
PatKind::TupleStruct(ref __binding_0, ref __binding_1,
ref __binding_2) => 4u8.stable_hash(__hcx, __hasher),
PatKind::Or(ref __binding_0) =>
5u8.stable_hash(__hcx, __hasher),
PatKind::Never => 6u8.stable_hash(__hcx, __hasher),
PatKind::Tuple(ref __binding_0, ref __binding_1) =>
7u8.stable_hash(__hcx, __hasher),
PatKind::Deref(ref __binding_0) =>
8u8.stable_hash(__hcx, __hasher),
PatKind::Ref(ref __binding_0, ref __binding_1,
ref __binding_2) => 9u8.stable_hash(__hcx, __hasher),
PatKind::Expr(ref __binding_0) =>
10u8.stable_hash(__hcx, __hasher),
PatKind::Guard(ref __binding_0, ref __binding_1) =>
11u8.stable_hash(__hcx, __hasher),
PatKind::Range(ref __binding_0, ref __binding_1,
ref __binding_2) => 12u8.stable_hash(__hcx, __hasher),
PatKind::Slice(ref __binding_0, ref __binding_1,
ref __binding_2) => 13u8.stable_hash(__hcx, __hasher),
PatKind::Err(ref __binding_0) =>
14u8.stable_hash(__hcx, __hasher),
}
match *self {
PatKind::Missing => {}
PatKind::Wild => {}
PatKind::Binding(ref __binding_0, ref __binding_1,
ref __binding_2, 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); }
}
PatKind::Struct(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
PatKind::TupleStruct(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
PatKind::Or(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
PatKind::Never => {}
PatKind::Tuple(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
PatKind::Deref(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
PatKind::Ref(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
PatKind::Expr(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
PatKind::Guard(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
PatKind::Range(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
PatKind::Slice(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
PatKind::Err(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1758pub enum PatKind<'hir> {
1759 Missing,
1761
1762 Wild,
1764
1765 Binding(BindingMode, HirId, Ident, Option<&'hir Pat<'hir>>),
1776
1777 Struct(QPath<'hir>, &'hir [PatField<'hir>], Option<Span>),
1780
1781 TupleStruct(QPath<'hir>, &'hir [Pat<'hir>], DotDotPos),
1785
1786 Or(&'hir [Pat<'hir>]),
1789
1790 Never,
1792
1793 Tuple(&'hir [Pat<'hir>], DotDotPos),
1797
1798 Deref(&'hir Pat<'hir>),
1800
1801 Ref(&'hir Pat<'hir>, Pinnedness, Mutability),
1803
1804 Expr(&'hir PatExpr<'hir>),
1806
1807 Guard(&'hir Pat<'hir>, &'hir Expr<'hir>),
1809
1810 Range(Option<&'hir PatExpr<'hir>>, Option<&'hir PatExpr<'hir>>, RangeEnd),
1812
1813 Slice(&'hir [Pat<'hir>], Option<&'hir Pat<'hir>>, &'hir [Pat<'hir>]),
1823
1824 Err(ErrorGuaranteed),
1826}
1827
1828#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Stmt<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Stmt hir_id kind span", &self.hir_id, &self.kind, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Stmt<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Stmt<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<StmtKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Stmt<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Stmt<'hir> {
#[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 {
Stmt {
hir_id: ref __binding_0,
kind: ref __binding_1,
span: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1830pub struct Stmt<'hir> {
1831 #[stable_hash(ignore)]
1832 pub hir_id: HirId,
1833 pub kind: StmtKind<'hir>,
1834 pub span: Span,
1835}
1836
1837#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for StmtKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Let(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Let",
&__self_0),
Self::Item(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Item",
&__self_0),
Self::Expr(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Expr",
&__self_0),
Self::Semi(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Semi",
&__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for StmtKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for StmtKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir LetStmt<'hir>>;
let _: ::core::clone::AssertParamIsClone<ItemId>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for StmtKind<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
StmtKind<'hir> {
#[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 {
StmtKind::Let(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
StmtKind::Item(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
StmtKind::Expr(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
StmtKind::Semi(ref __binding_0) =>
3u8.stable_hash(__hcx, __hasher),
}
match *self {
StmtKind::Let(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
StmtKind::Item(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
StmtKind::Expr(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
StmtKind::Semi(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1839pub enum StmtKind<'hir> {
1840 Let(&'hir LetStmt<'hir>),
1842
1843 Item(ItemId),
1845
1846 Expr(&'hir Expr<'hir>),
1848
1849 Semi(&'hir Expr<'hir>),
1851}
1852
1853#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for LetStmt<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"LetStmt super_ pat ty init els hir_id span source",
&[&self.super_, &self.pat, &self.ty, &self.init, &self.els,
&self.hir_id, &self.span, &&self.source])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for LetStmt<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for LetStmt<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Option<Span>>;
let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Block<'hir>>>;
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<LocalSource>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for LetStmt<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
LetStmt<'hir> {
#[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 {
LetStmt {
super_: ref __binding_0,
pat: ref __binding_1,
ty: ref __binding_2,
init: ref __binding_3,
els: ref __binding_4,
hir_id: ref __binding_5,
span: ref __binding_6,
source: ref __binding_7 } => {
{ __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_6.stable_hash(__hcx, __hasher); }
{ __binding_7.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1855pub struct LetStmt<'hir> {
1856 pub super_: Option<Span>,
1858 pub pat: &'hir Pat<'hir>,
1859 pub ty: Option<&'hir Ty<'hir>>,
1861 pub init: Option<&'hir Expr<'hir>>,
1863 pub els: Option<&'hir Block<'hir>>,
1865 #[stable_hash(ignore)]
1866 pub hir_id: HirId,
1867 pub span: Span,
1868 pub source: LocalSource,
1872}
1873
1874#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Arm<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"Arm hir_id span pat guard body", &self.hir_id, &self.span,
&self.pat, &self.guard, &&self.body)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Arm<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Arm<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Arm<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Arm<'hir> {
#[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 {
Arm {
hir_id: ref __binding_0,
span: ref __binding_1,
pat: ref __binding_2,
guard: ref __binding_3,
body: ref __binding_4 } => {
{}
{ __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)]
1877pub struct Arm<'hir> {
1878 #[stable_hash(ignore)]
1879 pub hir_id: HirId,
1880 pub span: Span,
1881 pub pat: &'hir Pat<'hir>,
1883 pub guard: Option<&'hir Expr<'hir>>,
1885 pub body: &'hir Expr<'hir>,
1887}
1888
1889#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for LetExpr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"LetExpr span pat ty init recovered", &self.span, &self.pat,
&self.ty, &self.init, &&self.recovered)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for LetExpr<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for LetExpr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<ast::Recovered>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for LetExpr<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
LetExpr<'hir> {
#[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 {
LetExpr {
span: ref __binding_0,
pat: ref __binding_1,
ty: ref __binding_2,
init: ref __binding_3,
recovered: 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)]
1895pub struct LetExpr<'hir> {
1896 pub span: Span,
1897 pub pat: &'hir Pat<'hir>,
1898 pub ty: Option<&'hir Ty<'hir>>,
1899 pub init: &'hir Expr<'hir>,
1900 pub recovered: ast::Recovered,
1903}
1904
1905#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for ExprField<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"ExprField hir_id ident expr span is_shorthand", &self.hir_id,
&self.ident, &self.expr, &self.span, &&self.is_shorthand)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ExprField<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for ExprField<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for ExprField<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ExprField<'hir> {
#[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 {
ExprField {
hir_id: ref __binding_0,
ident: ref __binding_1,
expr: ref __binding_2,
span: ref __binding_3,
is_shorthand: ref __binding_4 } => {
{}
{ __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)]
1906pub struct ExprField<'hir> {
1907 #[stable_hash(ignore)]
1908 pub hir_id: HirId,
1909 pub ident: Ident,
1910 pub expr: &'hir Expr<'hir>,
1911 pub span: Span,
1912 pub is_shorthand: bool,
1913}
1914
1915#[derive(#[automatically_derived]impl ::core::marker::Copy for BlockCheckMode { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for BlockCheckMode {
}
#[automatically_derived]impl ::core::clone::Clone for BlockCheckMode {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<UnsafeSource>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
BlockCheckMode {
}
#[automatically_derived]impl ::core::cmp::PartialEq for BlockCheckMode {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::UnsafeBlock(__self_0), Self::UnsafeBlock(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::fmt::Debug for BlockCheckMode {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::DefaultBlock =>
::core::fmt::Formatter::write_str(f, "DefaultBlock"),
Self::UnsafeBlock(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"UnsafeBlock", &__self_0),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
BlockCheckMode {
#[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 {
BlockCheckMode::DefaultBlock =>
0u8.stable_hash(__hcx, __hasher),
BlockCheckMode::UnsafeBlock(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
BlockCheckMode::DefaultBlock => {}
BlockCheckMode::UnsafeBlock(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1916pub enum BlockCheckMode {
1917 DefaultBlock,
1918 UnsafeBlock(UnsafeSource),
1919}
1920
1921#[derive(#[automatically_derived]impl ::core::marker::Copy for UnsafeSource { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for UnsafeSource {
}
#[automatically_derived]impl ::core::clone::Clone for UnsafeSource {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
UnsafeSource {
}
#[automatically_derived]impl ::core::cmp::PartialEq for UnsafeSource {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]impl ::core::fmt::Debug for UnsafeSource {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
UnsafeSource::CompilerGenerated => "CompilerGenerated",
UnsafeSource::UserProvided => "UserProvided",
})
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for UnsafeSource
{
#[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 {
UnsafeSource::CompilerGenerated =>
0u8.stable_hash(__hcx, __hasher),
UnsafeSource::UserProvided =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
UnsafeSource::CompilerGenerated => {}
UnsafeSource::UserProvided => {}
}
}
}
};StableHash)]
1922pub enum UnsafeSource {
1923 CompilerGenerated,
1924 UserProvided,
1925}
1926
1927#[derive(#[automatically_derived]impl ::core::marker::Copy for BodyId { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for BodyId {
}
#[automatically_derived]impl ::core::clone::Clone for BodyId {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for BodyId {
}
#[automatically_derived]impl ::core::cmp::PartialEq for BodyId {
#[inline]
fn eq(&self, other: &Self) -> bool { self.hir_id == other.hir_id }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for BodyId {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<HirId>;
}
}Eq, #[automatically_derived]impl ::core::hash::Hash for BodyId {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.hir_id, state)
}
}Hash, #[automatically_derived]impl ::core::fmt::Debug for BodyId {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "BodyId hir_id",
&&self.hir_id)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for BodyId {
#[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 {
BodyId { hir_id: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1928pub struct BodyId {
1929 pub hir_id: HirId,
1930}
1931
1932#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Body<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Body params value", &self.params, &&self.value)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Body<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Body<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [Param<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Body<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Body<'hir> {
#[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 { params: ref __binding_0, value: ref __binding_1 } =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1954pub struct Body<'hir> {
1955 pub params: &'hir [Param<'hir>],
1956 pub value: &'hir Expr<'hir>,
1957}
1958
1959impl<'hir> Body<'hir> {
1960 pub fn id(&self) -> BodyId {
1961 BodyId { hir_id: self.value.hir_id }
1962 }
1963}
1964
1965#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for CoroutineKind {
}
#[automatically_derived]impl ::core::clone::Clone for CoroutineKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<CoroutineDesugaring>;
let _: ::core::clone::AssertParamIsClone<CoroutineSource>;
let _: ::core::clone::AssertParamIsClone<Movability>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
CoroutineKind {
}
#[automatically_derived]impl ::core::cmp::PartialEq for CoroutineKind {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Desugared(__self_0, __self_1),
Self::Desugared(__arg1_0, __arg1_1)) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(Self::Coroutine(__self_0), Self::Coroutine(__arg1_0)) =>
__self_0 == __arg1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for CoroutineKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<CoroutineDesugaring>;
let _: ::core::cmp::AssertParamIsEq<CoroutineSource>;
let _: ::core::cmp::AssertParamIsEq<Movability>;
}
}Eq, #[automatically_derived]impl ::core::fmt::Debug for CoroutineKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Desugared(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Desugared", __self_0, &__self_1),
Self::Coroutine(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Coroutine", &__self_0),
}
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for CoroutineKind { }Copy, #[automatically_derived]impl ::core::hash::Hash for CoroutineKind {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
match self {
Self::Desugared(__self_0, __self_1) => {
::core::hash::Hash::hash(__self_0, state);
::core::hash::Hash::hash(__self_1, state)
}
Self::Coroutine(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
}
}
}Hash, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
CoroutineKind {
#[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 {
CoroutineKind::Desugared(ref __binding_0, ref __binding_1)
=> 0u8.stable_hash(__hcx, __hasher),
CoroutineKind::Coroutine(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
CoroutineKind::Desugared(ref __binding_0, ref __binding_1)
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
CoroutineKind::Coroutine(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for CoroutineKind {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
CoroutineKind::Desugared(ref __binding_0, ref __binding_1)
=> {
0usize
}
CoroutineKind::Coroutine(ref __binding_0) => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
CoroutineKind::Desugared(ref __binding_0, ref __binding_1)
=> {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
CoroutineKind::Coroutine(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for CoroutineKind {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
CoroutineKind::Desugared(::rustc_serialize::Decodable::decode(__decoder),
::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
CoroutineKind::Coroutine(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `CoroutineKind`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable)]
1967pub enum CoroutineKind {
1968 Desugared(CoroutineDesugaring, CoroutineSource),
1970
1971 Coroutine(Movability),
1973}
1974
1975impl CoroutineKind {
1976 pub fn movability(self) -> Movability {
1977 match self {
1978 CoroutineKind::Desugared(CoroutineDesugaring::Async, _)
1979 | CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, _) => Movability::Static,
1980 CoroutineKind::Desugared(CoroutineDesugaring::Gen, _) => Movability::Movable,
1981 CoroutineKind::Coroutine(mov) => mov,
1982 }
1983 }
1984
1985 pub fn is_fn_like(self) -> bool {
1986 #[allow(non_exhaustive_omitted_patterns)] match self {
CoroutineKind::Desugared(_, CoroutineSource::Fn) => true,
_ => false,
}matches!(self, CoroutineKind::Desugared(_, CoroutineSource::Fn))
1987 }
1988
1989 pub fn is_async_desugaring(self) -> bool {
1990 #[allow(non_exhaustive_omitted_patterns)] match self {
CoroutineKind::Desugared(CoroutineDesugaring::Async |
CoroutineDesugaring::AsyncGen, _) => true,
_ => false,
}matches!(
1991 self,
1992 CoroutineKind::Desugared(CoroutineDesugaring::Async | CoroutineDesugaring::AsyncGen, _)
1993 )
1994 }
1995
1996 pub fn to_plural_string(&self) -> String {
1997 match self {
1998 CoroutineKind::Desugared(d, CoroutineSource::Fn) => ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0:#}fn bodies", d))
})format!("{d:#}fn bodies"),
1999 CoroutineKind::Desugared(d, CoroutineSource::Block) => ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0:#}blocks", d))
})format!("{d:#}blocks"),
2000 CoroutineKind::Desugared(d, CoroutineSource::Closure) => ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0:#}closure bodies", d))
})format!("{d:#}closure bodies"),
2001 CoroutineKind::Coroutine(_) => "coroutines".to_string(),
2002 }
2003 }
2004}
2005
2006impl fmt::Display for CoroutineKind {
2007 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2008 match self {
2009 CoroutineKind::Desugared(d, k) => {
2010 d.fmt(f)?;
2011 k.fmt(f)
2012 }
2013 CoroutineKind::Coroutine(_) => f.write_str("coroutine"),
2014 }
2015 }
2016}
2017
2018#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for CoroutineSource {
}
#[automatically_derived]impl ::core::clone::Clone for CoroutineSource {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
CoroutineSource {
}
#[automatically_derived]impl ::core::cmp::PartialEq for CoroutineSource {
#[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 CoroutineSource { }Eq, #[automatically_derived]impl ::core::hash::Hash for CoroutineSource {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state)
}
}Hash, #[automatically_derived]impl ::core::fmt::Debug for CoroutineSource {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
CoroutineSource::Block => "Block",
CoroutineSource::Closure => "Closure",
CoroutineSource::Fn => "Fn",
})
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for CoroutineSource { }Copy, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
CoroutineSource {
#[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 {
CoroutineSource::Block => 0u8.stable_hash(__hcx, __hasher),
CoroutineSource::Closure =>
1u8.stable_hash(__hcx, __hasher),
CoroutineSource::Fn => 2u8.stable_hash(__hcx, __hasher),
}
match *self {
CoroutineSource::Block => {}
CoroutineSource::Closure => {}
CoroutineSource::Fn => {}
}
}
}
};StableHash, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for CoroutineSource {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
CoroutineSource::Block => { 0usize }
CoroutineSource::Closure => { 1usize }
CoroutineSource::Fn => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for CoroutineSource {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { CoroutineSource::Block }
1usize => { CoroutineSource::Closure }
2usize => { CoroutineSource::Fn }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `CoroutineSource`, expected 0..3, actual {0}",
n));
}
}
}
}
};Decodable)]
2024pub enum CoroutineSource {
2025 Block,
2027
2028 Closure,
2030
2031 Fn,
2033}
2034
2035impl fmt::Display for CoroutineSource {
2036 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2037 match self {
2038 CoroutineSource::Block => "block",
2039 CoroutineSource::Closure => "closure body",
2040 CoroutineSource::Fn => "fn body",
2041 }
2042 .fmt(f)
2043 }
2044}
2045
2046#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for CoroutineDesugaring {
}
#[automatically_derived]impl ::core::clone::Clone for CoroutineDesugaring {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
CoroutineDesugaring {
}
#[automatically_derived]impl ::core::cmp::PartialEq for CoroutineDesugaring {
#[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 CoroutineDesugaring { }Eq, #[automatically_derived]impl ::core::fmt::Debug for CoroutineDesugaring {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
CoroutineDesugaring::Async => "Async",
CoroutineDesugaring::Gen => "Gen",
CoroutineDesugaring::AsyncGen => "AsyncGen",
})
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for CoroutineDesugaring { }Copy, #[automatically_derived]impl ::core::hash::Hash for CoroutineDesugaring {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state)
}
}Hash, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
CoroutineDesugaring {
#[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 {
CoroutineDesugaring::Async =>
0u8.stable_hash(__hcx, __hasher),
CoroutineDesugaring::Gen =>
1u8.stable_hash(__hcx, __hasher),
CoroutineDesugaring::AsyncGen =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
CoroutineDesugaring::Async => {}
CoroutineDesugaring::Gen => {}
CoroutineDesugaring::AsyncGen => {}
}
}
}
};StableHash, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for CoroutineDesugaring {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
CoroutineDesugaring::Async => { 0usize }
CoroutineDesugaring::Gen => { 1usize }
CoroutineDesugaring::AsyncGen => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for CoroutineDesugaring {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { CoroutineDesugaring::Async }
1usize => { CoroutineDesugaring::Gen }
2usize => { CoroutineDesugaring::AsyncGen }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `CoroutineDesugaring`, expected 0..3, actual {0}",
n));
}
}
}
}
};Decodable)]
2047pub enum CoroutineDesugaring {
2048 Async,
2050
2051 Gen,
2053
2054 AsyncGen,
2057}
2058
2059impl fmt::Display for CoroutineDesugaring {
2060 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2061 match self {
2062 CoroutineDesugaring::Async => {
2063 if f.alternate() {
2064 f.write_str("`async` ")?;
2065 } else {
2066 f.write_str("async ")?
2067 }
2068 }
2069 CoroutineDesugaring::Gen => {
2070 if f.alternate() {
2071 f.write_str("`gen` ")?;
2072 } else {
2073 f.write_str("gen ")?
2074 }
2075 }
2076 CoroutineDesugaring::AsyncGen => {
2077 if f.alternate() {
2078 f.write_str("`async gen` ")?;
2079 } else {
2080 f.write_str("async gen ")?
2081 }
2082 }
2083 }
2084
2085 Ok(())
2086 }
2087}
2088
2089#[derive(#[automatically_derived]impl ::core::marker::Copy for BodyOwnerKind { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for BodyOwnerKind {
}
#[automatically_derived]impl ::core::clone::Clone for BodyOwnerKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Mutability>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for BodyOwnerKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Fn => ::core::fmt::Formatter::write_str(f, "Fn"),
Self::Closure => ::core::fmt::Formatter::write_str(f, "Closure"),
Self::Const { inline: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Const inline", &__self_0),
Self::Static(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Static", &__self_0),
Self::GlobalAsm =>
::core::fmt::Formatter::write_str(f, "GlobalAsm"),
}
}
}Debug)]
2090pub enum BodyOwnerKind {
2091 Fn,
2093
2094 Closure,
2096
2097 Const { inline: bool },
2099
2100 Static(Mutability),
2102
2103 GlobalAsm,
2105}
2106
2107impl BodyOwnerKind {
2108 pub fn is_fn_or_closure(self) -> bool {
2109 match self {
2110 BodyOwnerKind::Fn | BodyOwnerKind::Closure => true,
2111 BodyOwnerKind::Const { .. } | BodyOwnerKind::Static(_) | BodyOwnerKind::GlobalAsm => {
2112 false
2113 }
2114 }
2115 }
2116}
2117
2118#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ConstContext {
}
#[automatically_derived]impl ::core::clone::Clone for ConstContext {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Mutability>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for ConstContext { }Copy, #[automatically_derived]impl ::core::fmt::Debug for ConstContext {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::ConstFn => ::core::fmt::Formatter::write_str(f, "ConstFn"),
Self::Static(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Static", &__self_0),
Self::Const { allow_const_fn_promotion: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Const allow_const_fn_promotion", &__self_0),
}
}
}Debug, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
ConstContext {
}
#[automatically_derived]impl ::core::cmp::PartialEq for ConstContext {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Static(__self_0), Self::Static(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::Const { allow_const_fn_promotion: __self_0 },
Self::Const { allow_const_fn_promotion: __arg1_0 }) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for ConstContext {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<Mutability>;
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq)]
2120pub enum ConstContext {
2121 ConstFn,
2123
2124 Static(Mutability),
2126
2127 Const {
2134 allow_const_fn_promotion: bool,
2138 },
2139}
2140
2141impl ConstContext {
2142 pub fn keyword_name(self) -> &'static str {
2146 match self {
2147 Self::Const { .. } => "const",
2148 Self::Static(Mutability::Not) => "static",
2149 Self::Static(Mutability::Mut) => "static mut",
2150 Self::ConstFn => "const fn",
2151 }
2152 }
2153}
2154
2155impl fmt::Display for ConstContext {
2158 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2159 match *self {
2160 Self::Const { .. } => f.write_fmt(format_args!("constant"))write!(f, "constant"),
2161 Self::Static(_) => f.write_fmt(format_args!("static"))write!(f, "static"),
2162 Self::ConstFn => f.write_fmt(format_args!("constant function"))write!(f, "constant function"),
2163 }
2164 }
2165}
2166
2167impl IntoDiagArg for ConstContext {
2168 fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
2169 DiagArgValue::Str(Cow::Borrowed(match self {
2170 ConstContext::ConstFn => "constant function",
2171 ConstContext::Static(_) => "static",
2172 ConstContext::Const { .. } => "constant",
2173 }))
2174 }
2175}
2176
2177pub type Lit = Spanned<LitKind>;
2179
2180#[derive(#[automatically_derived]impl ::core::marker::Copy for AnonConst { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for AnonConst {
}
#[automatically_derived]impl ::core::clone::Clone for AnonConst {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
let _: ::core::clone::AssertParamIsClone<BodyId>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for AnonConst {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"AnonConst hir_id def_id body span", &self.hir_id, &self.def_id,
&self.body, &&self.span)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for AnonConst {
#[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 {
AnonConst {
hir_id: ref __binding_0,
def_id: ref __binding_1,
body: ref __binding_2,
span: ref __binding_3 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2189pub struct AnonConst {
2190 #[stable_hash(ignore)]
2191 pub hir_id: HirId,
2192 pub def_id: LocalDefId,
2193 pub body: BodyId,
2194 pub span: Span,
2195}
2196
2197#[derive(#[automatically_derived]impl ::core::marker::Copy for ConstBlock { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ConstBlock {
}
#[automatically_derived]impl ::core::clone::Clone for ConstBlock {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
let _: ::core::clone::AssertParamIsClone<BodyId>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for ConstBlock {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"ConstBlock hir_id def_id body", &self.hir_id, &self.def_id,
&&self.body)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for ConstBlock {
#[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 {
ConstBlock {
hir_id: ref __binding_0,
def_id: ref __binding_1,
body: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2199pub struct ConstBlock {
2200 #[stable_hash(ignore)]
2201 pub hir_id: HirId,
2202 pub def_id: LocalDefId,
2203 pub body: BodyId,
2204}
2205
2206#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Expr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Expr hir_id kind span", &self.hir_id, &self.kind, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Expr<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Expr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<ExprKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Expr<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Expr<'hir> {
#[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 {
Expr {
hir_id: ref __binding_0,
kind: ref __binding_1,
span: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2215pub struct Expr<'hir> {
2216 #[stable_hash(ignore)]
2217 pub hir_id: HirId,
2218 pub kind: ExprKind<'hir>,
2219 pub span: Span,
2220}
2221
2222impl Expr<'_> {
2223 pub fn precedence(&self, has_attr: &dyn Fn(HirId) -> bool) -> ExprPrecedence {
2224 let prefix_attrs_precedence = || -> ExprPrecedence {
2225 if has_attr(self.hir_id) { ExprPrecedence::Prefix } else { ExprPrecedence::Unambiguous }
2226 };
2227
2228 match &self.kind {
2229 ExprKind::Closure(closure) => match closure.fn_decl.output {
2230 FnRetTy::DefaultReturn(_) => ExprPrecedence::Jump,
2231 FnRetTy::Return(_) => prefix_attrs_precedence(),
2232 },
2233
2234 ExprKind::Break(..)
2235 | ExprKind::Ret(..)
2236 | ExprKind::Yield(..)
2237 | ExprKind::Become(..) => ExprPrecedence::Jump,
2238
2239 ExprKind::Binary(op, ..) => op.node.precedence(),
2241 ExprKind::Cast(..) => ExprPrecedence::Cast,
2242
2243 ExprKind::Assign(..) | ExprKind::AssignOp(..) => ExprPrecedence::Assign,
2244
2245 ExprKind::AddrOf(..) => ExprPrecedence::Prefix,
2247
2248 ExprKind::Let(..) | ExprKind::Unary(..) => ExprPrecedence::Prefix,
2253
2254 ExprKind::Array(_)
2256 | ExprKind::Block(..)
2257 | ExprKind::Call(..)
2258 | ExprKind::ConstBlock(_)
2259 | ExprKind::Continue(..)
2260 | ExprKind::Field(..)
2261 | ExprKind::If(..)
2262 | ExprKind::Index(..)
2263 | ExprKind::InlineAsm(..)
2264 | ExprKind::Lit(_)
2265 | ExprKind::Loop(..)
2266 | ExprKind::Match(..)
2267 | ExprKind::MethodCall(..)
2268 | ExprKind::OffsetOf(..)
2269 | ExprKind::RawHandle(..)
2270 | ExprKind::Path(..)
2271 | ExprKind::Repeat(..)
2272 | ExprKind::Struct(..)
2273 | ExprKind::Tup(_)
2274 | ExprKind::Type(..)
2275 | ExprKind::UnsafeBinderCast(..)
2276 | ExprKind::Use(..)
2277 | ExprKind::Err(_) => prefix_attrs_precedence(),
2278
2279 ExprKind::DropTemps(expr, ..) => expr.precedence(has_attr),
2280 }
2281 }
2282
2283 pub fn is_syntactic_place_expr(&self) -> bool {
2288 self.is_place_expr(|_| true)
2289 }
2290
2291 pub fn is_place_expr(&self, mut allow_projections_from: impl FnMut(&Self) -> bool) -> bool {
2296 match self.kind {
2297 ExprKind::Path(QPath::Resolved(_, ref path)) => {
2298 #[allow(non_exhaustive_omitted_patterns)] match path.res {
Res::Local(..) | Res::Def(DefKind::Static { .. }, _) | Res::Err => true,
_ => false,
}matches!(path.res, Res::Local(..) | Res::Def(DefKind::Static { .. }, _) | Res::Err)
2299 }
2300
2301 ExprKind::Type(ref e, _) => e.is_place_expr(allow_projections_from),
2305
2306 ExprKind::UnsafeBinderCast(_, e, _) => e.is_place_expr(allow_projections_from),
2308
2309 ExprKind::Unary(UnOp::Deref, _) => true,
2310
2311 ExprKind::Field(ref base, _) | ExprKind::Index(ref base, _, _) => {
2312 allow_projections_from(base) || base.is_place_expr(allow_projections_from)
2313 }
2314
2315 ExprKind::Err(_guar)
2317 | ExprKind::Let(&LetExpr { recovered: ast::Recovered::Yes(_guar), .. }) => true,
2318
2319 ExprKind::Path(QPath::TypeRelative(..))
2322 | ExprKind::Call(..)
2323 | ExprKind::MethodCall(..)
2324 | ExprKind::Use(..)
2325 | ExprKind::Struct(..)
2326 | ExprKind::Tup(..)
2327 | ExprKind::If(..)
2328 | ExprKind::Match(..)
2329 | ExprKind::Closure { .. }
2330 | ExprKind::Block(..)
2331 | ExprKind::Repeat(..)
2332 | ExprKind::Array(..)
2333 | ExprKind::Break(..)
2334 | ExprKind::Continue(..)
2335 | ExprKind::Ret(..)
2336 | ExprKind::Become(..)
2337 | ExprKind::Let(..)
2338 | ExprKind::Loop(..)
2339 | ExprKind::Assign(..)
2340 | ExprKind::InlineAsm(..)
2341 | ExprKind::OffsetOf(..)
2342 | ExprKind::RawHandle(..)
2343 | ExprKind::AssignOp(..)
2344 | ExprKind::Lit(_)
2345 | ExprKind::ConstBlock(..)
2346 | ExprKind::Unary(..)
2347 | ExprKind::AddrOf(..)
2348 | ExprKind::Binary(..)
2349 | ExprKind::Yield(..)
2350 | ExprKind::Cast(..)
2351 | ExprKind::DropTemps(..) => false,
2352 }
2353 }
2354
2355 pub fn is_constant_for_zero_repeat(&self) -> bool {
2358 match self.kind {
2361 ExprKind::ConstBlock(_) | ExprKind::Lit(_) => true,
2362 ExprKind::Cast(inner, _) | ExprKind::Type(inner, _) => {
2363 inner.is_constant_for_zero_repeat()
2364 }
2365
2366 ExprKind::Path(qpath) => {
2367 match qpath {
2368 QPath::Resolved(_, Path { res: Res::Def(def_kind, _), .. }) => match def_kind {
2369 DefKind::Const | DefKind::ConstParam | DefKind::AssocConst => true,
2370
2371 DefKind::Mod
2372 | DefKind::Struct
2373 | DefKind::Union
2374 | DefKind::Enum
2375 | DefKind::Variant
2376 | DefKind::Trait
2377 | DefKind::TyAlias
2378 | DefKind::ForeignTy
2379 | DefKind::TraitAlias
2380 | DefKind::AssocTy
2381 | DefKind::TyParam
2382 | DefKind::Fn
2383 | DefKind::Static { .. }
2384 | DefKind::Ctor(..)
2385 | DefKind::AssocFn
2386 | DefKind::Macro(_)
2387 | DefKind::ExternCrate
2388 | DefKind::Use
2389 | DefKind::ForeignMod
2390 | DefKind::AnonConst
2391 | DefKind::OpaqueTy
2392 | DefKind::Field
2393 | DefKind::LifetimeParam
2394 | DefKind::GlobalAsm
2395 | DefKind::Impl { .. }
2396 | DefKind::Closure
2397 | DefKind::SyntheticCoroutineBody
2398 | DefKind::TestBinderConstraints => false,
2399 },
2400
2401 QPath::Resolved(..) => false,
2403
2404 QPath::TypeRelative(..) => true,
2406 }
2407 }
2408
2409 ExprKind::Array(_)
2410 | ExprKind::Call(..)
2411 | ExprKind::MethodCall(..)
2412 | ExprKind::Use(..)
2413 | ExprKind::Tup(_)
2414 | ExprKind::Binary(..)
2415 | ExprKind::Unary(..)
2416 | ExprKind::DropTemps(_)
2417 | ExprKind::Let(_)
2418 | ExprKind::If(..)
2419 | ExprKind::Loop(..)
2420 | ExprKind::Match(..)
2421 | ExprKind::Closure(_)
2422 | ExprKind::Block(..)
2423 | ExprKind::Assign(..)
2424 | ExprKind::AssignOp(..)
2425 | ExprKind::Field(..)
2426 | ExprKind::Index(..)
2427 | ExprKind::AddrOf(..)
2428 | ExprKind::Break(..)
2429 | ExprKind::Continue(_)
2430 | ExprKind::Ret(_)
2431 | ExprKind::Become(_)
2432 | ExprKind::InlineAsm(_)
2433 | ExprKind::OffsetOf(..)
2434 | ExprKind::RawHandle(..)
2435 | ExprKind::Struct(..)
2436 | ExprKind::Repeat(..)
2437 | ExprKind::Yield(..)
2438 | ExprKind::UnsafeBinderCast(..)
2439 | ExprKind::Err(_) => false,
2440 }
2441 }
2442
2443 pub fn range_span(&self) -> Option<Span> {
2446 is_range_literal(self).then(|| self.span.parent_callsite().unwrap())
2447 }
2448
2449 pub fn is_size_lit(&self) -> bool {
2452 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
ExprKind::Lit(Lit {
node: LitKind::Int(_,
LitIntType::Unsuffixed | LitIntType::Unsigned(UintTy::Usize)), ..
}) => true,
_ => false,
}matches!(
2453 self.kind,
2454 ExprKind::Lit(Lit {
2455 node: LitKind::Int(_, LitIntType::Unsuffixed | LitIntType::Unsigned(UintTy::Usize)),
2456 ..
2457 })
2458 )
2459 }
2460
2461 pub fn peel_drop_temps(&self) -> &Self {
2467 let mut expr = self;
2468 while let ExprKind::DropTemps(inner) = &expr.kind {
2469 expr = inner;
2470 }
2471 expr
2472 }
2473
2474 pub fn peel_blocks(&self) -> &Self {
2475 let mut expr = self;
2476 while let ExprKind::Block(Block { expr: Some(inner), .. }, _) = &expr.kind {
2477 expr = inner;
2478 }
2479 expr
2480 }
2481
2482 pub fn peel_borrows(&self) -> &Self {
2483 let mut expr = self;
2484 while let ExprKind::AddrOf(.., inner) = &expr.kind {
2485 expr = inner;
2486 }
2487 expr
2488 }
2489
2490 pub fn can_have_side_effects(&self) -> bool {
2491 match self.peel_drop_temps().kind {
2492 ExprKind::Path(_)
2493 | ExprKind::Lit(_)
2494 | ExprKind::OffsetOf(..)
2495 | ExprKind::RawHandle(..)
2496 | ExprKind::Use(..) => false,
2497 ExprKind::Type(base, _)
2498 | ExprKind::Unary(_, base)
2499 | ExprKind::Field(base, _)
2500 | ExprKind::Index(base, _, _)
2501 | ExprKind::AddrOf(.., base)
2502 | ExprKind::Cast(base, _)
2503 | ExprKind::UnsafeBinderCast(_, base, _) => {
2504 base.can_have_side_effects()
2508 }
2509 ExprKind::Binary(_, lhs, rhs) => {
2510 lhs.can_have_side_effects() || rhs.can_have_side_effects()
2514 }
2515 ExprKind::Struct(_, fields, init) => {
2516 let init_side_effects = match init {
2517 StructTailExpr::Base(init) => init.can_have_side_effects(),
2518 StructTailExpr::DefaultFields(_)
2519 | StructTailExpr::None
2520 | StructTailExpr::NoneWithError(_) => false,
2521 };
2522 fields.iter().map(|field| field.expr).any(|e| e.can_have_side_effects())
2523 || init_side_effects
2524 }
2525
2526 ExprKind::Array(args)
2527 | ExprKind::Tup(args)
2528 | ExprKind::Call(
2529 Expr {
2530 kind:
2531 ExprKind::Path(QPath::Resolved(
2532 None,
2533 Path { res: Res::Def(DefKind::Ctor(_, CtorKind::Fn), _), .. },
2534 )),
2535 ..
2536 },
2537 args,
2538 ) => args.iter().any(|arg| arg.can_have_side_effects()),
2539 ExprKind::Repeat(arg, _) => arg.can_have_side_effects(),
2540 ExprKind::If(..)
2541 | ExprKind::Match(..)
2542 | ExprKind::MethodCall(..)
2543 | ExprKind::Call(..)
2544 | ExprKind::Closure { .. }
2545 | ExprKind::Block(..)
2546 | ExprKind::Break(..)
2547 | ExprKind::Continue(..)
2548 | ExprKind::Ret(..)
2549 | ExprKind::Become(..)
2550 | ExprKind::Let(..)
2551 | ExprKind::Loop(..)
2552 | ExprKind::Assign(..)
2553 | ExprKind::InlineAsm(..)
2554 | ExprKind::AssignOp(..)
2555 | ExprKind::ConstBlock(..)
2556 | ExprKind::Yield(..)
2557 | ExprKind::DropTemps(..)
2558 | ExprKind::Err(_) => true,
2559 }
2560 }
2561
2562 pub fn is_approximately_pattern(&self) -> bool {
2564 match &self.kind {
2565 ExprKind::Array(_)
2566 | ExprKind::Call(..)
2567 | ExprKind::Tup(_)
2568 | ExprKind::Lit(_)
2569 | ExprKind::Path(_)
2570 | ExprKind::Struct(..) => true,
2571 _ => false,
2572 }
2573 }
2574
2575 pub fn equivalent_for_indexing(&self, other: &Expr<'_>) -> bool {
2580 match (self.kind, other.kind) {
2581 (ExprKind::Lit(lit1), ExprKind::Lit(lit2)) => lit1.node == lit2.node,
2582 (
2583 ExprKind::Path(QPath::Resolved(None, path1)),
2584 ExprKind::Path(QPath::Resolved(None, path2)),
2585 ) => path1.res == path2.res,
2586 (
2587 ExprKind::Struct(
2588 &QPath::Resolved(None, &Path { res: Res::Def(_, path1_def_id), .. }),
2589 args1,
2590 StructTailExpr::None,
2591 ),
2592 ExprKind::Struct(
2593 &QPath::Resolved(None, &Path { res: Res::Def(_, path2_def_id), .. }),
2594 args2,
2595 StructTailExpr::None,
2596 ),
2597 ) => {
2598 path2_def_id == path1_def_id
2599 && is_range_literal(self)
2600 && is_range_literal(other)
2601 && std::iter::zip(args1, args2)
2602 .all(|(a, b)| a.expr.equivalent_for_indexing(b.expr))
2603 }
2604 _ => false,
2605 }
2606 }
2607
2608 pub fn method_ident(&self) -> Option<Ident> {
2609 match self.kind {
2610 ExprKind::MethodCall(receiver_method, ..) => Some(receiver_method.ident),
2611 ExprKind::Unary(_, expr) | ExprKind::AddrOf(.., expr) => expr.method_ident(),
2612 _ => None,
2613 }
2614 }
2615}
2616
2617pub fn is_range_literal(expr: &Expr<'_>) -> bool {
2620 if let ExprKind::Struct(QPath::Resolved(None, path), _, StructTailExpr::None) = expr.kind
2621 && let [.., segment] = path.segments
2622 && let sym::RangeFrom
2623 | sym::RangeFull
2624 | sym::Range
2625 | sym::RangeToInclusive
2626 | sym::RangeTo
2627 | sym::RangeFromCopy
2628 | sym::RangeCopy
2629 | sym::RangeInclusiveCopy
2630 | sym::RangeToInclusiveCopy = segment.ident.name
2631 && expr.span.is_desugaring(DesugaringKind::RangeExpr)
2632 {
2633 true
2634 } else if let ExprKind::Call(func, _) = &expr.kind
2635 && let ExprKind::Path(QPath::Resolved(None, path)) = func.kind
2636 && let [.., segment] = path.segments
2637 && let sym::range_inclusive_new = segment.ident.name
2638 && expr.span.is_desugaring(DesugaringKind::RangeExpr)
2639 {
2640 true
2641 } else {
2642 false
2643 }
2644}
2645
2646pub fn expr_needs_parens(expr: &Expr<'_>) -> bool {
2653 match expr.kind {
2654 ExprKind::Cast(_, _) | ExprKind::Binary(_, _, _) => true,
2656 _ if is_range_literal(expr) => true,
2658 _ => false,
2659 }
2660}
2661
2662#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for PlaceExpr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"PlaceExpr path path_span projections", &self.path,
&self.path_span, &&self.projections)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for PlaceExpr<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for PlaceExpr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir [PlaceExprKind]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for PlaceExpr<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
PlaceExpr<'hir> {
#[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 {
PlaceExpr {
path: ref __binding_0,
path_span: ref __binding_1,
projections: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2663pub struct PlaceExpr<'hir> {
2664 pub path: QPath<'hir>,
2665 pub path_span: Span,
2666 pub projections: &'hir [PlaceExprKind],
2668}
2669
2670#[derive(#[automatically_derived]impl ::core::fmt::Debug for PlaceExprKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Field(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Field",
__self_0, &__self_1),
Self::Deref(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Deref",
&__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for PlaceExprKind {
}
#[automatically_derived]impl ::core::clone::Clone for PlaceExprKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for PlaceExprKind { }Copy, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
PlaceExprKind {
#[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 {
PlaceExprKind::Field(ref __binding_0, ref __binding_1) =>
0u8.stable_hash(__hcx, __hasher),
PlaceExprKind::Deref(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
PlaceExprKind::Field(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
PlaceExprKind::Deref(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2671pub enum PlaceExprKind {
2672 Field(Ident, Span),
2673 Deref(Span),
2674}
2675
2676#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for ExprKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::ConstBlock(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ConstBlock", &__self_0),
Self::Array(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Array",
&__self_0),
Self::Call(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Call",
__self_0, &__self_1),
Self::MethodCall(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_struct_field4_finish(f,
"MethodCall", __self_0, __self_1, __self_2, &__self_3),
Self::Use(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Use",
__self_0, &__self_1),
Self::Tup(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Tup",
&__self_0),
Self::Binary(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Binary", __self_0, __self_1, &__self_2),
Self::Unary(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Unary",
__self_0, &__self_1),
Self::Lit(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Lit",
&__self_0),
Self::Cast(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Cast",
__self_0, &__self_1),
Self::Type(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Type",
__self_0, &__self_1),
Self::DropTemps(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"DropTemps", &__self_0),
Self::Let(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Let",
&__self_0),
Self::If(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "If",
__self_0, __self_1, &__self_2),
Self::Loop(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_struct_field4_finish(f, "Loop",
__self_0, __self_1, __self_2, &__self_3),
Self::Match(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Match",
__self_0, __self_1, &__self_2),
Self::Closure(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Closure", &__self_0),
Self::Block(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Block",
__self_0, &__self_1),
Self::Assign(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Assign", __self_0, __self_1, &__self_2),
Self::AssignOp(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"AssignOp", __self_0, __self_1, &__self_2),
Self::Field(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Field",
__self_0, &__self_1),
Self::Index(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Index",
__self_0, __self_1, &__self_2),
Self::Path(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Path",
&__self_0),
Self::AddrOf(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"AddrOf", __self_0, __self_1, &__self_2),
Self::Break(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Break",
__self_0, &__self_1),
Self::Continue(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Continue", &__self_0),
Self::Ret(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Ret",
&__self_0),
Self::Become(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Become", &__self_0),
Self::InlineAsm(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"InlineAsm", &__self_0),
Self::OffsetOf(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"OffsetOf", __self_0, &__self_1),
Self::RawHandle(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"RawHandle", &__self_0),
Self::Struct(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Struct", __self_0, __self_1, &__self_2),
Self::Repeat(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Repeat", __self_0, &__self_1),
Self::Yield(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Yield",
__self_0, &__self_1),
Self::UnsafeBinderCast(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"UnsafeBinderCast", __self_0, __self_1, &__self_2),
Self::Err(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Err",
&__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ExprKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for ExprKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<ConstBlock>;
let _: ::core::clone::AssertParamIsClone<&'hir [Expr<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Expr<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir PathSegment<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Expr<'hir>]>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Expr<'hir>]>;
let _: ::core::clone::AssertParamIsClone<BinOp>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<UnOp>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<Lit>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir LetExpr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<&'hir Block<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<Label>>;
let _: ::core::clone::AssertParamIsClone<LoopSource>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Arm<'hir>]>;
let _: ::core::clone::AssertParamIsClone<MatchSource>;
let _: ::core::clone::AssertParamIsClone<&'hir Closure<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Block<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<Label>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<AssignOp>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
let _: ::core::clone::AssertParamIsClone<BorrowKind>;
let _: ::core::clone::AssertParamIsClone<Mutability>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<Destination>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir InlineAsm<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Ident]>;
let _: ::core::clone::AssertParamIsClone<&'hir PlaceExpr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir QPath<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [ExprField<'hir>]>;
let _: ::core::clone::AssertParamIsClone<StructTailExpr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<YieldSource>;
let _: ::core::clone::AssertParamIsClone<UnsafeBinderCastKind>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
let _: ::core::clone::AssertParamIsClone<rustc_span::ErrorGuaranteed>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for ExprKind<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ExprKind<'hir> {
#[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 {
ExprKind::ConstBlock(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
ExprKind::Array(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
ExprKind::Call(ref __binding_0, ref __binding_1) =>
2u8.stable_hash(__hcx, __hasher),
ExprKind::MethodCall(ref __binding_0, ref __binding_1,
ref __binding_2, ref __binding_3) =>
3u8.stable_hash(__hcx, __hasher),
ExprKind::Use(ref __binding_0, ref __binding_1) =>
4u8.stable_hash(__hcx, __hasher),
ExprKind::Tup(ref __binding_0) =>
5u8.stable_hash(__hcx, __hasher),
ExprKind::Binary(ref __binding_0, ref __binding_1,
ref __binding_2) => 6u8.stable_hash(__hcx, __hasher),
ExprKind::Unary(ref __binding_0, ref __binding_1) =>
7u8.stable_hash(__hcx, __hasher),
ExprKind::Lit(ref __binding_0) =>
8u8.stable_hash(__hcx, __hasher),
ExprKind::Cast(ref __binding_0, ref __binding_1) =>
9u8.stable_hash(__hcx, __hasher),
ExprKind::Type(ref __binding_0, ref __binding_1) =>
10u8.stable_hash(__hcx, __hasher),
ExprKind::DropTemps(ref __binding_0) =>
11u8.stable_hash(__hcx, __hasher),
ExprKind::Let(ref __binding_0) =>
12u8.stable_hash(__hcx, __hasher),
ExprKind::If(ref __binding_0, ref __binding_1,
ref __binding_2) => 13u8.stable_hash(__hcx, __hasher),
ExprKind::Loop(ref __binding_0, ref __binding_1,
ref __binding_2, ref __binding_3) =>
14u8.stable_hash(__hcx, __hasher),
ExprKind::Match(ref __binding_0, ref __binding_1,
ref __binding_2) => 15u8.stable_hash(__hcx, __hasher),
ExprKind::Closure(ref __binding_0) =>
16u8.stable_hash(__hcx, __hasher),
ExprKind::Block(ref __binding_0, ref __binding_1) =>
17u8.stable_hash(__hcx, __hasher),
ExprKind::Assign(ref __binding_0, ref __binding_1,
ref __binding_2) => 18u8.stable_hash(__hcx, __hasher),
ExprKind::AssignOp(ref __binding_0, ref __binding_1,
ref __binding_2) => 19u8.stable_hash(__hcx, __hasher),
ExprKind::Field(ref __binding_0, ref __binding_1) =>
20u8.stable_hash(__hcx, __hasher),
ExprKind::Index(ref __binding_0, ref __binding_1,
ref __binding_2) => 21u8.stable_hash(__hcx, __hasher),
ExprKind::Path(ref __binding_0) =>
22u8.stable_hash(__hcx, __hasher),
ExprKind::AddrOf(ref __binding_0, ref __binding_1,
ref __binding_2) => 23u8.stable_hash(__hcx, __hasher),
ExprKind::Break(ref __binding_0, ref __binding_1) =>
24u8.stable_hash(__hcx, __hasher),
ExprKind::Continue(ref __binding_0) =>
25u8.stable_hash(__hcx, __hasher),
ExprKind::Ret(ref __binding_0) =>
26u8.stable_hash(__hcx, __hasher),
ExprKind::Become(ref __binding_0) =>
27u8.stable_hash(__hcx, __hasher),
ExprKind::InlineAsm(ref __binding_0) =>
28u8.stable_hash(__hcx, __hasher),
ExprKind::OffsetOf(ref __binding_0, ref __binding_1) =>
29u8.stable_hash(__hcx, __hasher),
ExprKind::RawHandle(ref __binding_0) =>
30u8.stable_hash(__hcx, __hasher),
ExprKind::Struct(ref __binding_0, ref __binding_1,
ref __binding_2) => 31u8.stable_hash(__hcx, __hasher),
ExprKind::Repeat(ref __binding_0, ref __binding_1) =>
32u8.stable_hash(__hcx, __hasher),
ExprKind::Yield(ref __binding_0, ref __binding_1) =>
33u8.stable_hash(__hcx, __hasher),
ExprKind::UnsafeBinderCast(ref __binding_0, ref __binding_1,
ref __binding_2) => 34u8.stable_hash(__hcx, __hasher),
ExprKind::Err(ref __binding_0) =>
35u8.stable_hash(__hcx, __hasher),
}
match *self {
ExprKind::ConstBlock(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::Array(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::Call(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::MethodCall(ref __binding_0, ref __binding_1,
ref __binding_2, 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); }
}
ExprKind::Use(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::Tup(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::Binary(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ExprKind::Unary(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::Lit(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::Cast(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::Type(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::DropTemps(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::Let(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::If(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ExprKind::Loop(ref __binding_0, ref __binding_1,
ref __binding_2, 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); }
}
ExprKind::Match(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ExprKind::Closure(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::Block(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::Assign(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ExprKind::AssignOp(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ExprKind::Field(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::Index(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ExprKind::Path(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::AddrOf(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ExprKind::Break(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::Continue(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::Ret(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::Become(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::InlineAsm(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::OffsetOf(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::RawHandle(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExprKind::Struct(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ExprKind::Repeat(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::Yield(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ExprKind::UnsafeBinderCast(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ExprKind::Err(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2677pub enum ExprKind<'hir> {
2678 ConstBlock(ConstBlock),
2680 Array(&'hir [Expr<'hir>]),
2682 Call(&'hir Expr<'hir>, &'hir [Expr<'hir>]),
2689 MethodCall(&'hir PathSegment<'hir>, &'hir Expr<'hir>, &'hir [Expr<'hir>], Span),
2706 Use(&'hir Expr<'hir>, Span),
2708 Tup(&'hir [Expr<'hir>]),
2710 Binary(BinOp, &'hir Expr<'hir>, &'hir Expr<'hir>),
2712 Unary(UnOp, &'hir Expr<'hir>),
2714 Lit(Lit),
2716 Cast(&'hir Expr<'hir>, &'hir Ty<'hir>),
2718 Type(&'hir Expr<'hir>, &'hir Ty<'hir>),
2720 DropTemps(&'hir Expr<'hir>),
2726 Let(&'hir LetExpr<'hir>),
2731 If(&'hir Expr<'hir>, &'hir Expr<'hir>, Option<&'hir Expr<'hir>>),
2740 Loop(&'hir Block<'hir>, Option<Label>, LoopSource, Span),
2746 Match(&'hir Expr<'hir>, &'hir [Arm<'hir>], MatchSource),
2749 Closure(&'hir Closure<'hir>),
2756 Block(&'hir Block<'hir>, Option<Label>),
2758
2759 Assign(&'hir Expr<'hir>, &'hir Expr<'hir>, Span),
2761 AssignOp(AssignOp, &'hir Expr<'hir>, &'hir Expr<'hir>),
2765 Field(&'hir Expr<'hir>, Ident),
2767 Index(&'hir Expr<'hir>, &'hir Expr<'hir>, Span),
2771
2772 Path(QPath<'hir>),
2774
2775 AddrOf(BorrowKind, Mutability, &'hir Expr<'hir>),
2777 Break(Destination, Option<&'hir Expr<'hir>>),
2779 Continue(Destination),
2781 Ret(Option<&'hir Expr<'hir>>),
2783 Become(&'hir Expr<'hir>),
2785
2786 InlineAsm(&'hir InlineAsm<'hir>),
2788
2789 OffsetOf(&'hir Ty<'hir>, &'hir [Ident]),
2791
2792 RawHandle(&'hir PlaceExpr<'hir>),
2794
2795 Struct(&'hir QPath<'hir>, &'hir [ExprField<'hir>], StructTailExpr<'hir>),
2800
2801 Repeat(&'hir Expr<'hir>, &'hir ConstArg<'hir>),
2806
2807 Yield(&'hir Expr<'hir>, YieldSource),
2809
2810 UnsafeBinderCast(UnsafeBinderCastKind, &'hir Expr<'hir>, Option<&'hir Ty<'hir>>),
2813
2814 Err(rustc_span::ErrorGuaranteed),
2816}
2817
2818#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for StructTailExpr<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::None => ::core::fmt::Formatter::write_str(f, "None"),
Self::Base(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Base",
&__self_0),
Self::DefaultFields(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"DefaultFields", &__self_0),
Self::NoneWithError(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"NoneWithError", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for StructTailExpr<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
StructTailExpr<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<ErrorGuaranteed>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
StructTailExpr<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
StructTailExpr<'hir> {
#[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 {
StructTailExpr::None => 0u8.stable_hash(__hcx, __hasher),
StructTailExpr::Base(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
StructTailExpr::DefaultFields(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
StructTailExpr::NoneWithError(ref __binding_0) =>
3u8.stable_hash(__hcx, __hasher),
}
match *self {
StructTailExpr::None => {}
StructTailExpr::Base(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
StructTailExpr::DefaultFields(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
StructTailExpr::NoneWithError(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2819pub enum StructTailExpr<'hir> {
2820 None,
2822 Base(&'hir Expr<'hir>),
2825 DefaultFields(Span),
2829 NoneWithError(ErrorGuaranteed),
2835}
2836
2837#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for QPath<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Resolved(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Resolved", __self_0, &__self_1),
Self::TypeRelative(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TypeRelative", __self_0, &__self_1),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for QPath<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for QPath<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
let _: ::core::clone::AssertParamIsClone<&'hir Path<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir PathSegment<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for QPath<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
QPath<'hir> {
#[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 {
QPath::Resolved(ref __binding_0, ref __binding_1) =>
0u8.stable_hash(__hcx, __hasher),
QPath::TypeRelative(ref __binding_0, ref __binding_1) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
QPath::Resolved(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
QPath::TypeRelative(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2843pub enum QPath<'hir> {
2844 Resolved(Option<&'hir Ty<'hir>>, &'hir Path<'hir>),
2851
2852 TypeRelative(&'hir Ty<'hir>, &'hir PathSegment<'hir>),
2859}
2860
2861impl<'hir> QPath<'hir> {
2862 pub fn span(&self) -> Span {
2864 match *self {
2865 QPath::Resolved(_, path) => path.span,
2866 QPath::TypeRelative(qself, ps) => qself.span.to(ps.ident.span),
2867 }
2868 }
2869
2870 pub fn qself_span(&self) -> Span {
2873 match *self {
2874 QPath::Resolved(_, path) => path.span,
2875 QPath::TypeRelative(qself, _) => qself.span,
2876 }
2877 }
2878}
2879
2880#[derive(#[automatically_derived]impl ::core::marker::Copy for LocalSource { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for LocalSource {
}
#[automatically_derived]impl ::core::clone::Clone for LocalSource {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::fmt::Debug for LocalSource {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_c_like_enum_write_str(f,
"Normal AsyncFn AwaitDesugar AssignDesugar Contract",
match self {
LocalSource::Normal => 0usize,
LocalSource::AsyncFn => 7usize,
LocalSource::AwaitDesugar => 15usize,
LocalSource::AssignDesugar => 28usize,
LocalSource::Contract => 42usize,
})
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for LocalSource
{
#[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 {
LocalSource::Normal => 0u8.stable_hash(__hcx, __hasher),
LocalSource::AsyncFn => 1u8.stable_hash(__hcx, __hasher),
LocalSource::AwaitDesugar =>
2u8.stable_hash(__hcx, __hasher),
LocalSource::AssignDesugar =>
3u8.stable_hash(__hcx, __hasher),
LocalSource::Contract => 4u8.stable_hash(__hcx, __hasher),
}
match *self {
LocalSource::Normal => {}
LocalSource::AsyncFn => {}
LocalSource::AwaitDesugar => {}
LocalSource::AssignDesugar => {}
LocalSource::Contract => {}
}
}
}
};StableHash)]
2882pub enum LocalSource {
2883 Normal,
2885 AsyncFn,
2896 AwaitDesugar,
2898 AssignDesugar,
2900 Contract,
2902}
2903
2904#[derive(#[automatically_derived]impl ::core::marker::Copy for MatchSource { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for MatchSource {
}
#[automatically_derived]impl ::core::clone::Clone for MatchSource {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
MatchSource {
}
#[automatically_derived]impl ::core::cmp::PartialEq for MatchSource {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::TryDesugar(__self_0), Self::TryDesugar(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for MatchSource {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<HirId>;
}
}Eq, #[automatically_derived]impl ::core::hash::Hash for MatchSource {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
match self {
Self::TryDesugar(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
_ => {}
}
}
}Hash, #[automatically_derived]impl ::core::fmt::Debug for MatchSource {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Normal => ::core::fmt::Formatter::write_str(f, "Normal"),
Self::Postfix => ::core::fmt::Formatter::write_str(f, "Postfix"),
Self::ForLoopDesugar =>
::core::fmt::Formatter::write_str(f, "ForLoopDesugar"),
Self::TryDesugar(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"TryDesugar", &__self_0),
Self::AwaitDesugar =>
::core::fmt::Formatter::write_str(f, "AwaitDesugar"),
Self::FormatArgs =>
::core::fmt::Formatter::write_str(f, "FormatArgs"),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for MatchSource
{
#[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 {
MatchSource::Normal => 0u8.stable_hash(__hcx, __hasher),
MatchSource::Postfix => 1u8.stable_hash(__hcx, __hasher),
MatchSource::ForLoopDesugar =>
2u8.stable_hash(__hcx, __hasher),
MatchSource::TryDesugar(ref __binding_0) =>
3u8.stable_hash(__hcx, __hasher),
MatchSource::AwaitDesugar =>
4u8.stable_hash(__hcx, __hasher),
MatchSource::FormatArgs => 5u8.stable_hash(__hcx, __hasher),
}
match *self {
MatchSource::Normal => {}
MatchSource::Postfix => {}
MatchSource::ForLoopDesugar => {}
MatchSource::TryDesugar(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
MatchSource::AwaitDesugar => {}
MatchSource::FormatArgs => {}
}
}
}
};StableHash, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for MatchSource {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
MatchSource::Normal => { 0usize }
MatchSource::Postfix => { 1usize }
MatchSource::ForLoopDesugar => { 2usize }
MatchSource::TryDesugar(ref __binding_0) => { 3usize }
MatchSource::AwaitDesugar => { 4usize }
MatchSource::FormatArgs => { 5usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
MatchSource::Normal => {}
MatchSource::Postfix => {}
MatchSource::ForLoopDesugar => {}
MatchSource::TryDesugar(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
MatchSource::AwaitDesugar => {}
MatchSource::FormatArgs => {}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for MatchSource {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { MatchSource::Normal }
1usize => { MatchSource::Postfix }
2usize => { MatchSource::ForLoopDesugar }
3usize => {
MatchSource::TryDesugar(::rustc_serialize::Decodable::decode(__decoder))
}
4usize => { MatchSource::AwaitDesugar }
5usize => { MatchSource::FormatArgs }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `MatchSource`, expected 0..6, actual {0}",
n));
}
}
}
}
};Decodable)]
2906pub enum MatchSource {
2907 Normal,
2909 Postfix,
2911 ForLoopDesugar,
2913 TryDesugar(HirId),
2915 AwaitDesugar,
2917 FormatArgs,
2919}
2920
2921impl MatchSource {
2922 #[inline]
2923 pub const fn name(self) -> &'static str {
2924 use MatchSource::*;
2925 match self {
2926 Normal => "match",
2927 Postfix => ".match",
2928 ForLoopDesugar => "for",
2929 TryDesugar(_) => "?",
2930 AwaitDesugar => ".await",
2931 FormatArgs => "format_args!()",
2932 }
2933 }
2934}
2935
2936#[derive(#[automatically_derived]impl ::core::marker::Copy for LoopSource { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for LoopSource {
}
#[automatically_derived]impl ::core::clone::Clone for LoopSource {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
LoopSource {
}
#[automatically_derived]impl ::core::cmp::PartialEq for LoopSource {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]impl ::core::fmt::Debug for LoopSource {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
LoopSource::Loop => "Loop",
LoopSource::While => "While",
LoopSource::ForLoop => "ForLoop",
})
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for LoopSource {
#[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 {
LoopSource::Loop => 0u8.stable_hash(__hcx, __hasher),
LoopSource::While => 1u8.stable_hash(__hcx, __hasher),
LoopSource::ForLoop => 2u8.stable_hash(__hcx, __hasher),
}
match *self {
LoopSource::Loop => {}
LoopSource::While => {}
LoopSource::ForLoop => {}
}
}
}
};StableHash)]
2938pub enum LoopSource {
2939 Loop,
2941 While,
2943 ForLoop,
2945}
2946
2947impl LoopSource {
2948 pub fn name(self) -> &'static str {
2949 match self {
2950 LoopSource::Loop => "loop",
2951 LoopSource::While => "while",
2952 LoopSource::ForLoop => "for",
2953 }
2954 }
2955}
2956
2957#[derive(#[automatically_derived]impl ::core::marker::Copy for LoopIdError { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for LoopIdError {
}
#[automatically_derived]impl ::core::clone::Clone for LoopIdError {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::fmt::Debug for LoopIdError {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
LoopIdError::OutsideLoopScope => "OutsideLoopScope",
LoopIdError::UnlabeledCfInWhileCondition =>
"UnlabeledCfInWhileCondition",
LoopIdError::UnresolvedLabel => "UnresolvedLabel",
})
}
}Debug, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
LoopIdError {
}
#[automatically_derived]impl ::core::cmp::PartialEq for LoopIdError {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for LoopIdError
{
#[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 {
LoopIdError::OutsideLoopScope =>
0u8.stable_hash(__hcx, __hasher),
LoopIdError::UnlabeledCfInWhileCondition =>
1u8.stable_hash(__hcx, __hasher),
LoopIdError::UnresolvedLabel =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
LoopIdError::OutsideLoopScope => {}
LoopIdError::UnlabeledCfInWhileCondition => {}
LoopIdError::UnresolvedLabel => {}
}
}
}
};StableHash)]
2958pub enum LoopIdError {
2959 OutsideLoopScope,
2960 UnlabeledCfInWhileCondition,
2961 UnresolvedLabel,
2962}
2963
2964impl fmt::Display for LoopIdError {
2965 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2966 f.write_str(match self {
2967 LoopIdError::OutsideLoopScope => "not inside loop scope",
2968 LoopIdError::UnlabeledCfInWhileCondition => {
2969 "unlabeled control flow (break or continue) in while condition"
2970 }
2971 LoopIdError::UnresolvedLabel => "label not found",
2972 })
2973 }
2974}
2975
2976#[derive(#[automatically_derived]impl ::core::marker::Copy for Destination { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for Destination {
}
#[automatically_derived]impl ::core::clone::Clone for Destination {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Option<Label>>;
let _: ::core::clone::AssertParamIsClone<Result<HirId, LoopIdError>>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for Destination {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Destination label target_id", &self.label, &&self.target_id)
}
}Debug, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
Destination {
}
#[automatically_derived]impl ::core::cmp::PartialEq for Destination {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.label == other.label && self.target_id == other.target_id
}
}PartialEq, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for Destination
{
#[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 {
Destination {
label: ref __binding_0, target_id: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2977pub struct Destination {
2978 pub label: Option<Label>,
2980
2981 pub target_id: Result<HirId, LoopIdError>,
2984}
2985
2986#[derive(#[automatically_derived]impl ::core::marker::Copy for YieldSource { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for YieldSource {
}
#[automatically_derived]impl ::core::clone::Clone for YieldSource {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Option<HirId>>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for YieldSource {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Await { expr: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Await expr", &__self_0),
Self::Yield => ::core::fmt::Formatter::write_str(f, "Yield"),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for YieldSource
{
#[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 {
YieldSource::Await { expr: ref __binding_0 } =>
0u8.stable_hash(__hcx, __hasher),
YieldSource::Yield => 1u8.stable_hash(__hcx, __hasher),
}
match *self {
YieldSource::Await { expr: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
YieldSource::Yield => {}
}
}
}
};StableHash)]
2988pub enum YieldSource {
2989 Await { expr: Option<HirId> },
2991 Yield,
2993}
2994
2995impl fmt::Display for YieldSource {
2996 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2997 f.write_str(match self {
2998 YieldSource::Await { .. } => "`await`",
2999 YieldSource::Yield => "`yield`",
3000 })
3001 }
3002}
3003
3004#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for FnSig<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"FnSig header decl span", &self.header, &self.decl, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for FnSig<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for FnSig<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<FnHeader>;
let _: ::core::clone::AssertParamIsClone<&'hir FnDecl<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for FnSig<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
FnSig<'hir> {
#[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 {
FnSig {
header: ref __binding_0,
decl: ref __binding_1,
span: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3007pub struct FnSig<'hir> {
3008 pub header: FnHeader,
3009 pub decl: &'hir FnDecl<'hir>,
3010 pub span: Span,
3011}
3012
3013#[derive(#[automatically_derived]impl ::core::marker::Copy for TraitItemId { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for TraitItemId {
}
#[automatically_derived]impl ::core::clone::Clone for TraitItemId {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<OwnerId>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
TraitItemId {
}
#[automatically_derived]impl ::core::cmp::PartialEq for TraitItemId {
#[inline]
fn eq(&self, other: &Self) -> bool { self.owner_id == other.owner_id }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for TraitItemId {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<OwnerId>;
}
}Eq, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for TraitItemId {
fn encode(&self, __encoder: &mut __E) {
let TraitItemId { owner_id: ref __binding_0 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for TraitItemId {
fn decode(__decoder: &mut __D) -> Self {
TraitItemId {
owner_id: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]impl ::core::fmt::Debug for TraitItemId {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"TraitItemId owner_id", &&self.owner_id)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for TraitItemId
{
#[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 {
TraitItemId { owner_id: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3017pub struct TraitItemId {
3018 pub owner_id: OwnerId,
3019}
3020
3021impl TraitItemId {
3022 #[inline]
3023 pub fn hir_id(&self) -> HirId {
3024 HirId::make_owner(self.owner_id.def_id)
3026 }
3027}
3028
3029#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for TraitItem<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"TraitItem ident owner_id generics kind span defaultness",
&[&self.ident, &self.owner_id, &self.generics, &self.kind,
&self.span, &&self.defaultness])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TraitItem<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for TraitItem<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<OwnerId>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<TraitItemKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<Defaultness>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for TraitItem<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TraitItem<'hir> {
#[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 {
TraitItem {
ident: ref __binding_0,
owner_id: ref __binding_1,
generics: ref __binding_2,
kind: ref __binding_3,
span: ref __binding_4,
defaultness: ref __binding_5 } => {
{ __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); }
}
}
}
}
};StableHash)]
3034pub struct TraitItem<'hir> {
3035 pub ident: Ident,
3036 pub owner_id: OwnerId,
3037 pub generics: &'hir Generics<'hir>,
3038 pub kind: TraitItemKind<'hir>,
3039 pub span: Span,
3040 pub defaultness: Defaultness,
3041}
3042
3043macro_rules! expect_methods_self_kind {
3044 ( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
3045 $(
3046 #[track_caller]
3047 pub fn $name(&self) -> $ret_ty {
3048 let $pat = &self.kind else { expect_failed(stringify!($name), self) };
3049 $ret_val
3050 }
3051 )*
3052 }
3053}
3054
3055macro_rules! expect_methods_self {
3056 ( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
3057 $(
3058 #[track_caller]
3059 pub fn $name(&self) -> $ret_ty {
3060 let $pat = self else { expect_failed(stringify!($name), self) };
3061 $ret_val
3062 }
3063 )*
3064 }
3065}
3066
3067#[track_caller]
3068fn expect_failed<T: fmt::Debug>(ident: &'static str, found: T) -> ! {
3069 {
::core::panicking::panic_fmt(format_args!("{0}: found {1:?}", ident,
found));
}panic!("{ident}: found {found:?}")
3070}
3071
3072impl<'hir> TraitItem<'hir> {
3073 #[inline]
3074 pub fn hir_id(&self) -> HirId {
3075 HirId::make_owner(self.owner_id.def_id)
3077 }
3078
3079 pub fn trait_item_id(&self) -> TraitItemId {
3080 TraitItemId { owner_id: self.owner_id }
3081 }
3082
3083 #[track_caller]
pub fn expect_const(&self) -> (&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>) {
let TraitItemKind::Const(ty, rhs) =
&self.kind else { expect_failed("expect_const", self) };
(ty, *rhs)
}
#[track_caller]
pub fn expect_fn(&self) -> (&FnSig<'hir>, &TraitFn<'hir>) {
let TraitItemKind::Fn(ty, trfn) =
&self.kind else { expect_failed("expect_fn", self) };
(ty, trfn)
}
#[track_caller]
pub fn expect_type(&self) -> (GenericBounds<'hir>, Option<&'hir Ty<'hir>>) {
let TraitItemKind::Type(bounds, ty) =
&self.kind else { expect_failed("expect_type", self) };
(bounds, *ty)
}expect_methods_self_kind! {
3084 expect_const, (&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>),
3085 TraitItemKind::Const(ty, rhs), (ty, *rhs);
3086
3087 expect_fn, (&FnSig<'hir>, &TraitFn<'hir>),
3088 TraitItemKind::Fn(ty, trfn), (ty, trfn);
3089
3090 expect_type, (GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
3091 TraitItemKind::Type(bounds, ty), (bounds, *ty);
3092 }
3093}
3094
3095#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for TraitFn<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Required(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Required", &__self_0),
Self::Provided(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Provided", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TraitFn<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for TraitFn<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [Param<'hir>]>;
let _: ::core::clone::AssertParamIsClone<BodyId>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for TraitFn<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TraitFn<'hir> {
#[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 {
TraitFn::Required(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
TraitFn::Provided(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
TraitFn::Required(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TraitFn::Provided(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3097pub enum TraitFn<'hir> {
3098 Required(&'hir [Param<'hir>]),
3100
3101 Provided(BodyId),
3103}
3104
3105#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for TraitItemKind<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Const(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Const",
__self_0, &__self_1),
Self::Fn(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Fn",
__self_0, &__self_1),
Self::Type(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Type",
__self_0, &__self_1),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TraitItemKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
TraitItemKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<ConstItemRhs<'hir>>>;
let _: ::core::clone::AssertParamIsClone<FnSig<'hir>>;
let _: ::core::clone::AssertParamIsClone<TraitFn<'hir>>;
let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
TraitItemKind<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TraitItemKind<'hir> {
#[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 {
TraitItemKind::Const(ref __binding_0, ref __binding_1) =>
0u8.stable_hash(__hcx, __hasher),
TraitItemKind::Fn(ref __binding_0, ref __binding_1) =>
1u8.stable_hash(__hcx, __hasher),
TraitItemKind::Type(ref __binding_0, ref __binding_1) =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
TraitItemKind::Const(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TraitItemKind::Fn(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TraitItemKind::Type(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3107pub enum TraitItemKind<'hir> {
3108 Const(&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>),
3110 Fn(FnSig<'hir>, TraitFn<'hir>),
3112 Type(GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
3115}
3116
3117#[derive(#[automatically_derived]impl ::core::marker::Copy for ImplItemId { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ImplItemId {
}
#[automatically_derived]impl ::core::clone::Clone for ImplItemId {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<OwnerId>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
ImplItemId {
}
#[automatically_derived]impl ::core::cmp::PartialEq for ImplItemId {
#[inline]
fn eq(&self, other: &Self) -> bool { self.owner_id == other.owner_id }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for ImplItemId {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<OwnerId>;
}
}Eq, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for ImplItemId {
fn encode(&self, __encoder: &mut __E) {
let ImplItemId { owner_id: ref __binding_0 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for ImplItemId {
fn decode(__decoder: &mut __D) -> Self {
ImplItemId {
owner_id: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]impl ::core::fmt::Debug for ImplItemId {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ImplItemId owner_id", &&self.owner_id)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for ImplItemId {
#[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 {
ImplItemId { owner_id: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3121pub struct ImplItemId {
3122 pub owner_id: OwnerId,
3123}
3124
3125impl ImplItemId {
3126 #[inline]
3127 pub fn hir_id(&self) -> HirId {
3128 HirId::make_owner(self.owner_id.def_id)
3130 }
3131}
3132
3133#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for ImplItem<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"ImplItem ident owner_id generics kind impl_kind span",
&[&self.ident, &self.owner_id, &self.generics, &self.kind,
&self.impl_kind, &&self.span])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ImplItem<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for ImplItem<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<OwnerId>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<ImplItemKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<ImplItemImplKind>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for ImplItem<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ImplItem<'hir> {
#[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 {
ImplItem {
ident: ref __binding_0,
owner_id: ref __binding_1,
generics: ref __binding_2,
kind: ref __binding_3,
impl_kind: ref __binding_4,
span: ref __binding_5 } => {
{ __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); }
}
}
}
}
};StableHash)]
3137pub struct ImplItem<'hir> {
3138 pub ident: Ident,
3139 pub owner_id: OwnerId,
3140 pub generics: &'hir Generics<'hir>,
3141 pub kind: ImplItemKind<'hir>,
3142 pub impl_kind: ImplItemImplKind,
3143 pub span: Span,
3144}
3145
3146#[derive(#[automatically_derived]impl ::core::fmt::Debug for ImplItemImplKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Inherent { vis_span: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Inherent vis_span", &__self_0),
Self::Trait { defaultness: __self_0, trait_item_def_id: __self_1 }
=>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Trait defaultness trait_item_def_id", __self_0, &__self_1),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ImplItemImplKind {
}
#[automatically_derived]impl ::core::clone::Clone for ImplItemImplKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<Defaultness>;
let _:
::core::clone::AssertParamIsClone<Result<DefId,
ErrorGuaranteed>>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for ImplItemImplKind { }Copy, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
ImplItemImplKind {
#[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 {
ImplItemImplKind::Inherent { vis_span: ref __binding_0 } =>
0u8.stable_hash(__hcx, __hasher),
ImplItemImplKind::Trait {
defaultness: ref __binding_0,
trait_item_def_id: ref __binding_1 } =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
ImplItemImplKind::Inherent { vis_span: ref __binding_0 } =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ImplItemImplKind::Trait {
defaultness: ref __binding_0,
trait_item_def_id: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3147pub enum ImplItemImplKind {
3148 Inherent {
3149 vis_span: Span,
3150 },
3151 Trait {
3152 defaultness: Defaultness,
3153 trait_item_def_id: Result<DefId, ErrorGuaranteed>,
3155 },
3156}
3157
3158impl<'hir> ImplItem<'hir> {
3159 #[inline]
3160 pub fn hir_id(&self) -> HirId {
3161 HirId::make_owner(self.owner_id.def_id)
3163 }
3164
3165 pub fn impl_item_id(&self) -> ImplItemId {
3166 ImplItemId { owner_id: self.owner_id }
3167 }
3168
3169 pub fn is_anon_const(&self) -> bool {
3171 #[allow(non_exhaustive_omitted_patterns)] match self.impl_kind {
ImplItemImplKind::Inherent { .. } => true,
_ => false,
}matches!(self.impl_kind, ImplItemImplKind::Inherent { .. })
3172 && #[allow(non_exhaustive_omitted_patterns)] match self.kind {
ImplItemKind::Const(..) => true,
_ => false,
}matches!(self.kind, ImplItemKind::Const(..))
3173 && self.ident.name == kw::Underscore
3174 }
3175
3176 pub fn vis_span(&self) -> Option<Span> {
3177 match self.impl_kind {
3178 ImplItemImplKind::Trait { .. } => None,
3179 ImplItemImplKind::Inherent { vis_span, .. } => Some(vis_span),
3180 }
3181 }
3182
3183 #[track_caller]
pub fn expect_const(&self) -> (&'hir Ty<'hir>, ConstItemRhs<'hir>) {
let ImplItemKind::Const(ty, rhs) =
&self.kind else { expect_failed("expect_const", self) };
(ty, *rhs)
}
#[track_caller]
pub fn expect_fn(&self) -> (&FnSig<'hir>, BodyId) {
let ImplItemKind::Fn(ty, body) =
&self.kind else { expect_failed("expect_fn", self) };
(ty, *body)
}
#[track_caller]
pub fn expect_type(&self) -> &'hir Ty<'hir> {
let ImplItemKind::Type(ty) =
&self.kind else { expect_failed("expect_type", self) };
ty
}expect_methods_self_kind! {
3184 expect_const, (&'hir Ty<'hir>, ConstItemRhs<'hir>), ImplItemKind::Const(ty, rhs), (ty, *rhs);
3185 expect_fn, (&FnSig<'hir>, BodyId), ImplItemKind::Fn(ty, body), (ty, *body);
3186 expect_type, &'hir Ty<'hir>, ImplItemKind::Type(ty), ty;
3187 }
3188}
3189
3190#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for ImplItemKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Const(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Const",
__self_0, &__self_1),
Self::Fn(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Fn",
__self_0, &__self_1),
Self::Type(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Type",
&__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ImplItemKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for ImplItemKind<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<ConstItemRhs<'hir>>;
let _: ::core::clone::AssertParamIsClone<FnSig<'hir>>;
let _: ::core::clone::AssertParamIsClone<BodyId>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for ImplItemKind<'hir>
{
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ImplItemKind<'hir> {
#[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 {
ImplItemKind::Const(ref __binding_0, ref __binding_1) =>
0u8.stable_hash(__hcx, __hasher),
ImplItemKind::Fn(ref __binding_0, ref __binding_1) =>
1u8.stable_hash(__hcx, __hasher),
ImplItemKind::Type(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
ImplItemKind::Const(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ImplItemKind::Fn(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ImplItemKind::Type(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3192pub enum ImplItemKind<'hir> {
3193 Const(&'hir Ty<'hir>, ConstItemRhs<'hir>),
3196 Fn(FnSig<'hir>, BodyId),
3198 Type(&'hir Ty<'hir>),
3200}
3201
3202#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
AssocItemConstraint<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"AssocItemConstraint hir_id ident gen_args kind span",
&self.hir_id, &self.ident, &self.gen_args, &self.kind,
&&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for AssocItemConstraint<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
AssocItemConstraint<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<&'hir GenericArgs<'hir>>;
let _:
::core::clone::AssertParamIsClone<AssocItemConstraintKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
AssocItemConstraint<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
AssocItemConstraint<'hir> {
#[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 {
AssocItemConstraint {
hir_id: ref __binding_0,
ident: ref __binding_1,
gen_args: ref __binding_2,
kind: ref __binding_3,
span: ref __binding_4 } => {
{}
{ __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)]
3213pub struct AssocItemConstraint<'hir> {
3214 #[stable_hash(ignore)]
3215 pub hir_id: HirId,
3216 pub ident: Ident,
3217 pub gen_args: &'hir GenericArgs<'hir>,
3218 pub kind: AssocItemConstraintKind<'hir>,
3219 pub span: Span,
3220}
3221
3222impl<'hir> AssocItemConstraint<'hir> {
3223 pub fn ty(self) -> Option<&'hir Ty<'hir>> {
3225 match self.kind {
3226 AssocItemConstraintKind::Equality { term: Term::Ty(ty) } => Some(ty),
3227 _ => None,
3228 }
3229 }
3230
3231 pub fn ct(self) -> Option<&'hir ConstArg<'hir>> {
3233 match self.kind {
3234 AssocItemConstraintKind::Equality { term: Term::Const(ct) } => Some(ct),
3235 _ => None,
3236 }
3237 }
3238}
3239
3240#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Term<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Ty(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Ty",
&__self_0),
Self::Const(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
&__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Term<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Term<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Term<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Term<'hir> {
#[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 {
Term::Ty(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
Term::Const(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
Term::Ty(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Term::Const(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3241pub enum Term<'hir> {
3242 Ty(&'hir Ty<'hir>),
3243 Const(&'hir ConstArg<'hir>),
3244}
3245
3246impl<'hir> From<&'hir Ty<'hir>> for Term<'hir> {
3247 fn from(ty: &'hir Ty<'hir>) -> Self {
3248 Term::Ty(ty)
3249 }
3250}
3251
3252impl<'hir> From<&'hir ConstArg<'hir>> for Term<'hir> {
3253 fn from(c: &'hir ConstArg<'hir>) -> Self {
3254 Term::Const(c)
3255 }
3256}
3257
3258#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
AssocItemConstraintKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Equality { term: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Equality term", &__self_0),
Self::Bound { bounds: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Bound bounds", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for AssocItemConstraintKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
AssocItemConstraintKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Term<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [GenericBound<'hir>]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
AssocItemConstraintKind<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
AssocItemConstraintKind<'hir> {
#[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 {
AssocItemConstraintKind::Equality { term: ref __binding_0 }
=> 0u8.stable_hash(__hcx, __hasher),
AssocItemConstraintKind::Bound { bounds: ref __binding_0 }
=> 1u8.stable_hash(__hcx, __hasher),
}
match *self {
AssocItemConstraintKind::Equality { term: ref __binding_0 }
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
AssocItemConstraintKind::Bound { bounds: ref __binding_0 }
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3260pub enum AssocItemConstraintKind<'hir> {
3261 Equality { term: Term<'hir> },
3268 Bound { bounds: &'hir [GenericBound<'hir>] },
3270}
3271
3272impl<'hir> AssocItemConstraintKind<'hir> {
3273 pub fn descr(&self) -> &'static str {
3274 match self {
3275 AssocItemConstraintKind::Equality { .. } => "binding",
3276 AssocItemConstraintKind::Bound { .. } => "constraint",
3277 }
3278 }
3279}
3280
3281#[derive(#[automatically_derived]impl ::core::fmt::Debug for AmbigArg {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match *self {}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for AmbigArg {
}
#[automatically_derived]impl ::core::clone::Clone for AmbigArg {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::Copy for AmbigArg { }Copy, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for AmbigArg {
#[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 {}
}
}
};StableHash)]
3285pub enum AmbigArg {}
3286
3287#[derive(#[automatically_derived]impl<'hir, Unambig: ::core::fmt::Debug>
::core::fmt::Debug for Ty<'hir, Unambig> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Ty hir_id span kind", &self.hir_id, &self.span, &&self.kind)
}
}Debug, #[automatically_derived]impl<'hir, Unambig: ::core::clone::Clone>
::core::clone::Clone for Ty<'hir, Unambig> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
Ty {
hir_id: ::core::clone::Clone::clone(&self.hir_id),
span: ::core::clone::Clone::clone(&self.span),
kind: ::core::clone::Clone::clone(&self.kind),
}
}
}Clone, #[automatically_derived]impl<'hir, Unambig: ::core::marker::Copy>
::core::marker::Copy for Ty<'hir, Unambig> {
}Copy, const _: () =
{
impl<'hir, Unambig> ::rustc_data_structures::stable_hash::StableHash
for Ty<'hir, Unambig> where
Unambig: ::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 {
Ty {
hir_id: ref __binding_0,
span: ref __binding_1,
kind: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3292#[repr(C)]
3293pub struct Ty<'hir, Unambig = ()> {
3294 #[stable_hash(ignore)]
3295 pub hir_id: HirId,
3296 pub span: Span,
3297 pub kind: TyKind<'hir, Unambig>,
3298}
3299
3300impl<'hir> Ty<'hir, AmbigArg> {
3301 pub fn as_unambig_ty(&self) -> &Ty<'hir> {
3312 let ptr = self as *const Ty<'hir, AmbigArg> as *const Ty<'hir, ()>;
3315 unsafe { &*ptr }
3316 }
3317}
3318
3319impl<'hir> Ty<'hir> {
3320 pub fn try_as_ambig_ty(&self) -> Option<&Ty<'hir, AmbigArg>> {
3326 if let TyKind::Infer(()) = self.kind {
3327 return None;
3328 }
3329
3330 let ptr = self as *const Ty<'hir> as *const Ty<'hir, AmbigArg>;
3334 Some(unsafe { &*ptr })
3335 }
3336}
3337
3338impl<'hir> Ty<'hir, AmbigArg> {
3339 pub fn peel_refs(&self) -> &Ty<'hir> {
3340 let mut final_ty = self.as_unambig_ty();
3341 while let TyKind::Ref(_, ty, _) = &final_ty.kind {
3342 final_ty = ty;
3343 }
3344 final_ty
3345 }
3346}
3347
3348impl<'hir> Ty<'hir> {
3349 pub fn peel_refs(&self) -> &Self {
3350 let mut final_ty = self;
3351 while let TyKind::Ref(_, ty, _) = &final_ty.kind {
3352 final_ty = ty;
3353 }
3354 final_ty
3355 }
3356
3357 pub fn as_generic_param(&self) -> Option<(DefId, Ident)> {
3359 let TyKind::Path(QPath::Resolved(None, path)) = self.kind else {
3360 return None;
3361 };
3362 let [segment] = &path.segments else {
3363 return None;
3364 };
3365 match path.res {
3366 Res::Def(DefKind::TyParam, def_id) | Res::SelfTyParam { trait_: def_id } => {
3367 Some((def_id, segment.ident))
3368 }
3369 _ => None,
3370 }
3371 }
3372
3373 pub fn find_self_aliases(&self) -> Vec<Span> {
3374 use crate::intravisit::Visitor;
3375 struct MyVisitor(Vec<Span>);
3376 impl<'v> Visitor<'v> for MyVisitor {
3377 fn visit_ty(&mut self, t: &'v Ty<'v, AmbigArg>) {
3378 if #[allow(non_exhaustive_omitted_patterns)] match &t.kind {
TyKind::Path(QPath::Resolved(_, Path {
res: crate::def::Res::SelfTyAlias { .. }, .. })) => true,
_ => false,
}matches!(
3379 &t.kind,
3380 TyKind::Path(QPath::Resolved(
3381 _,
3382 Path { res: crate::def::Res::SelfTyAlias { .. }, .. },
3383 ))
3384 ) {
3385 self.0.push(t.span);
3386 return;
3387 }
3388 crate::intravisit::walk_ty(self, t);
3389 }
3390 }
3391
3392 let mut my_visitor = MyVisitor(::alloc::vec::Vec::new()vec![]);
3393 my_visitor.visit_ty_unambig(self);
3394 my_visitor.0
3395 }
3396
3397 pub fn is_suggestable_infer_ty(&self) -> bool {
3400 fn are_suggestable_generic_args(generic_args: &[GenericArg<'_>]) -> bool {
3401 generic_args.iter().any(|arg| match arg {
3402 GenericArg::Type(ty) => ty.as_unambig_ty().is_suggestable_infer_ty(),
3403 GenericArg::Infer(_) => true,
3404 _ => false,
3405 })
3406 }
3407 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/064405c5f7fbc7d41aa30b45da1e45a85777bd58/compiler/rustc_hir/src/hir.rs:3407",
"rustc_hir::hir", ::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/064405c5f7fbc7d41aa30b45da1e45a85777bd58/compiler/rustc_hir/src/hir.rs"),
::tracing_core::__macro_support::Option::Some(3407u32),
::tracing_core::__macro_support::Option::Some("rustc_hir::hir"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("self")
}> =
::tracing::__macro_support::FieldName::new("self");
NAME.as_str()
}], ::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(&::tracing::field::debug(&self)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!(?self);
3408 match &self.kind {
3409 TyKind::Infer(()) => true,
3410 TyKind::Slice(ty) => ty.is_suggestable_infer_ty(),
3411 TyKind::Array(ty, length) => {
3412 ty.is_suggestable_infer_ty() || #[allow(non_exhaustive_omitted_patterns)] match length.kind {
ConstArgKind::Infer(..) => true,
_ => false,
}matches!(length.kind, ConstArgKind::Infer(..))
3413 }
3414 TyKind::Tup(tys) => tys.iter().any(Self::is_suggestable_infer_ty),
3415 TyKind::Ptr(ty, _) | TyKind::Ref(_, ty, _) => ty.is_suggestable_infer_ty(),
3416 TyKind::Path(QPath::TypeRelative(ty, segment)) => {
3417 ty.is_suggestable_infer_ty() || are_suggestable_generic_args(segment.args().args)
3418 }
3419 TyKind::Path(QPath::Resolved(ty_opt, Path { segments, .. })) => {
3420 ty_opt.is_some_and(Self::is_suggestable_infer_ty)
3421 || segments
3422 .iter()
3423 .any(|segment| are_suggestable_generic_args(segment.args().args))
3424 }
3425 _ => false,
3426 }
3427 }
3428}
3429
3430#[derive(#[automatically_derived]impl ::core::marker::Copy for PrimTy { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for PrimTy {
}
#[automatically_derived]impl ::core::clone::Clone for PrimTy {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<IntTy>;
let _: ::core::clone::AssertParamIsClone<UintTy>;
let _: ::core::clone::AssertParamIsClone<FloatTy>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for PrimTy {
}
#[automatically_derived]impl ::core::cmp::PartialEq for PrimTy {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Int(__self_0), Self::Int(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::Uint(__self_0), Self::Uint(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::Float(__self_0), Self::Float(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for PrimTy {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<IntTy>;
let _: ::core::cmp::AssertParamIsEq<UintTy>;
let _: ::core::cmp::AssertParamIsEq<FloatTy>;
}
}Eq, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for PrimTy {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
PrimTy::Int(ref __binding_0) => { 0usize }
PrimTy::Uint(ref __binding_0) => { 1usize }
PrimTy::Float(ref __binding_0) => { 2usize }
PrimTy::Str => { 3usize }
PrimTy::Bool => { 4usize }
PrimTy::Char => { 5usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
PrimTy::Int(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
PrimTy::Uint(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
PrimTy::Float(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
PrimTy::Str => {}
PrimTy::Bool => {}
PrimTy::Char => {}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for PrimTy {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
PrimTy::Int(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
PrimTy::Uint(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
PrimTy::Float(::rustc_serialize::Decodable::decode(__decoder))
}
3usize => { PrimTy::Str }
4usize => { PrimTy::Bool }
5usize => { PrimTy::Char }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `PrimTy`, expected 0..6, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]impl ::core::hash::Hash for PrimTy {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
match self {
Self::Int(__self_0) => ::core::hash::Hash::hash(__self_0, state),
Self::Uint(__self_0) => ::core::hash::Hash::hash(__self_0, state),
Self::Float(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
_ => {}
}
}
}Hash, #[automatically_derived]impl ::core::fmt::Debug for PrimTy {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Int(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Int",
&__self_0),
Self::Uint(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Uint",
&__self_0),
Self::Float(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Float",
&__self_0),
Self::Str => ::core::fmt::Formatter::write_str(f, "Str"),
Self::Bool => ::core::fmt::Formatter::write_str(f, "Bool"),
Self::Char => ::core::fmt::Formatter::write_str(f, "Char"),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for PrimTy {
#[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 {
PrimTy::Int(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
PrimTy::Uint(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
PrimTy::Float(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
PrimTy::Str => 3u8.stable_hash(__hcx, __hasher),
PrimTy::Bool => 4u8.stable_hash(__hcx, __hasher),
PrimTy::Char => 5u8.stable_hash(__hcx, __hasher),
}
match *self {
PrimTy::Int(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
PrimTy::Uint(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
PrimTy::Float(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
PrimTy::Str => {}
PrimTy::Bool => {}
PrimTy::Char => {}
}
}
}
};StableHash)]
3432pub enum PrimTy {
3433 Int(IntTy),
3434 Uint(UintTy),
3435 Float(FloatTy),
3436 Str,
3437 Bool,
3438 Char,
3439}
3440
3441impl PrimTy {
3442 pub const ALL: [Self; 19] = [
3444 Self::Int(IntTy::I8),
3446 Self::Int(IntTy::I16),
3447 Self::Int(IntTy::I32),
3448 Self::Int(IntTy::I64),
3449 Self::Int(IntTy::I128),
3450 Self::Int(IntTy::Isize),
3451 Self::Uint(UintTy::U8),
3452 Self::Uint(UintTy::U16),
3453 Self::Uint(UintTy::U32),
3454 Self::Uint(UintTy::U64),
3455 Self::Uint(UintTy::U128),
3456 Self::Uint(UintTy::Usize),
3457 Self::Float(FloatTy::F16),
3458 Self::Float(FloatTy::F32),
3459 Self::Float(FloatTy::F64),
3460 Self::Float(FloatTy::F128),
3461 Self::Bool,
3462 Self::Char,
3463 Self::Str,
3464 ];
3465
3466 pub fn name_str(self) -> &'static str {
3470 match self {
3471 PrimTy::Int(i) => i.name_str(),
3472 PrimTy::Uint(u) => u.name_str(),
3473 PrimTy::Float(f) => f.name_str(),
3474 PrimTy::Str => "str",
3475 PrimTy::Bool => "bool",
3476 PrimTy::Char => "char",
3477 }
3478 }
3479
3480 pub fn name(self) -> Symbol {
3481 match self {
3482 PrimTy::Int(i) => i.name(),
3483 PrimTy::Uint(u) => u.name(),
3484 PrimTy::Float(f) => f.name(),
3485 PrimTy::Str => sym::str,
3486 PrimTy::Bool => sym::bool,
3487 PrimTy::Char => sym::char,
3488 }
3489 }
3490
3491 pub fn from_name(name: Symbol) -> Option<Self> {
3494 let ty = match name {
3495 sym::i8 => Self::Int(IntTy::I8),
3497 sym::i16 => Self::Int(IntTy::I16),
3498 sym::i32 => Self::Int(IntTy::I32),
3499 sym::i64 => Self::Int(IntTy::I64),
3500 sym::i128 => Self::Int(IntTy::I128),
3501 sym::isize => Self::Int(IntTy::Isize),
3502 sym::u8 => Self::Uint(UintTy::U8),
3503 sym::u16 => Self::Uint(UintTy::U16),
3504 sym::u32 => Self::Uint(UintTy::U32),
3505 sym::u64 => Self::Uint(UintTy::U64),
3506 sym::u128 => Self::Uint(UintTy::U128),
3507 sym::usize => Self::Uint(UintTy::Usize),
3508 sym::f16 => Self::Float(FloatTy::F16),
3509 sym::f32 => Self::Float(FloatTy::F32),
3510 sym::f64 => Self::Float(FloatTy::F64),
3511 sym::f128 => Self::Float(FloatTy::F128),
3512 sym::bool => Self::Bool,
3513 sym::char => Self::Char,
3514 sym::str => Self::Str,
3515 _ => return None,
3516 };
3517 Some(ty)
3518 }
3519}
3520
3521#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for FnPtrTy<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"FnPtrTy safety abi generic_params decl param_idents",
&self.safety, &self.abi, &self.generic_params, &self.decl,
&&self.param_idents)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for FnPtrTy<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for FnPtrTy<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Safety>;
let _: ::core::clone::AssertParamIsClone<ExternAbi>;
let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir FnDecl<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Option<Ident>]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for FnPtrTy<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
FnPtrTy<'hir> {
#[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 {
FnPtrTy {
safety: ref __binding_0,
abi: ref __binding_1,
generic_params: ref __binding_2,
decl: ref __binding_3,
param_idents: 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)]
3522pub struct FnPtrTy<'hir> {
3523 pub safety: Safety,
3524 pub abi: ExternAbi,
3525 pub generic_params: &'hir [GenericParam<'hir>],
3526 pub decl: &'hir FnDecl<'hir>,
3527 pub param_idents: &'hir [Option<Ident>],
3530}
3531
3532#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for UnsafeBinderTy<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"UnsafeBinderTy generic_params inner_ty", &self.generic_params,
&&self.inner_ty)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for UnsafeBinderTy<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
UnsafeBinderTy<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
UnsafeBinderTy<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
UnsafeBinderTy<'hir> {
#[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 {
UnsafeBinderTy {
generic_params: ref __binding_0, inner_ty: ref __binding_1 }
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3533pub struct UnsafeBinderTy<'hir> {
3534 pub generic_params: &'hir [GenericParam<'hir>],
3535 pub inner_ty: &'hir Ty<'hir>,
3536}
3537
3538#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for OpaqueTy<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"OpaqueTy hir_id def_id bounds origin span", &self.hir_id,
&self.def_id, &self.bounds, &self.origin, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for OpaqueTy<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for OpaqueTy<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
let _: ::core::clone::AssertParamIsClone<OpaqueTyOrigin<LocalDefId>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for OpaqueTy<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
OpaqueTy<'hir> {
#[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 {
OpaqueTy {
hir_id: ref __binding_0,
def_id: ref __binding_1,
bounds: ref __binding_2,
origin: ref __binding_3,
span: ref __binding_4 } => {
{}
{ __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)]
3539pub struct OpaqueTy<'hir> {
3540 #[stable_hash(ignore)]
3541 pub hir_id: HirId,
3542 pub def_id: LocalDefId,
3543 pub bounds: GenericBounds<'hir>,
3544 pub origin: OpaqueTyOrigin<LocalDefId>,
3545 pub span: Span,
3546}
3547
3548#[derive(#[automatically_derived]impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug>
::core::fmt::Debug for PreciseCapturingArgKind<T, U> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Lifetime(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Lifetime", &__self_0),
Self::Param(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Param",
&__self_0),
}
}
}Debug, #[automatically_derived]impl<T: ::core::clone::Clone, U: ::core::clone::Clone>
::core::clone::Clone for PreciseCapturingArgKind<T, U> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
match self {
Self::Lifetime(__self_0) =>
PreciseCapturingArgKind::Lifetime(::core::clone::Clone::clone(__self_0)),
Self::Param(__self_0) =>
PreciseCapturingArgKind::Param(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, #[automatically_derived]impl<T: ::core::marker::Copy, U: ::core::marker::Copy>
::core::marker::Copy for PreciseCapturingArgKind<T, U> {
}Copy, const _: () =
{
impl<T, U> ::rustc_data_structures::stable_hash::StableHash for
PreciseCapturingArgKind<T, U> where
T: ::rustc_data_structures::stable_hash::StableHash,
U: ::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 {
PreciseCapturingArgKind::Lifetime(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
PreciseCapturingArgKind::Param(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
PreciseCapturingArgKind::Lifetime(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
PreciseCapturingArgKind::Param(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<T, U, __E: ::rustc_span::SpanEncoder>
::rustc_serialize::Encodable<__E> for
PreciseCapturingArgKind<T, U> where
T: ::rustc_serialize::Encodable<__E>,
U: ::rustc_serialize::Encodable<__E> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
PreciseCapturingArgKind::Lifetime(ref __binding_0) => {
0usize
}
PreciseCapturingArgKind::Param(ref __binding_0) => {
1usize
}
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
PreciseCapturingArgKind::Lifetime(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
PreciseCapturingArgKind::Param(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};Encodable, const _: () =
{
impl<T, U, __D: ::rustc_span::SpanDecoder>
::rustc_serialize::Decodable<__D> for
PreciseCapturingArgKind<T, U> where
T: ::rustc_serialize::Decodable<__D>,
U: ::rustc_serialize::Decodable<__D> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
PreciseCapturingArgKind::Lifetime(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
PreciseCapturingArgKind::Param(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `PreciseCapturingArgKind`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable)]
3549pub enum PreciseCapturingArgKind<T, U> {
3550 Lifetime(T),
3551 Param(U),
3553}
3554
3555pub type PreciseCapturingArg<'hir> =
3556 PreciseCapturingArgKind<&'hir Lifetime, PreciseCapturingNonLifetimeArg>;
3557
3558impl PreciseCapturingArg<'_> {
3559 pub fn hir_id(self) -> HirId {
3560 match self {
3561 PreciseCapturingArg::Lifetime(lt) => lt.hir_id,
3562 PreciseCapturingArg::Param(param) => param.hir_id,
3563 }
3564 }
3565
3566 pub fn name(self) -> Symbol {
3567 match self {
3568 PreciseCapturingArg::Lifetime(lt) => lt.ident.name,
3569 PreciseCapturingArg::Param(param) => param.ident.name,
3570 }
3571 }
3572}
3573
3574#[derive(#[automatically_derived]impl ::core::fmt::Debug for
PreciseCapturingNonLifetimeArg {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"PreciseCapturingNonLifetimeArg hir_id ident res", &self.hir_id,
&self.ident, &&self.res)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for PreciseCapturingNonLifetimeArg {
}
#[automatically_derived]impl ::core::clone::Clone for
PreciseCapturingNonLifetimeArg {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<Res>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for
PreciseCapturingNonLifetimeArg {
}Copy, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
PreciseCapturingNonLifetimeArg {
#[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 {
PreciseCapturingNonLifetimeArg {
hir_id: ref __binding_0,
ident: ref __binding_1,
res: ref __binding_2 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3579pub struct PreciseCapturingNonLifetimeArg {
3580 #[stable_hash(ignore)]
3581 pub hir_id: HirId,
3582 pub ident: Ident,
3583 pub res: Res,
3584}
3585
3586#[derive(#[automatically_derived]impl ::core::marker::Copy for RpitContext { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for RpitContext {
}
#[automatically_derived]impl ::core::clone::Clone for RpitContext {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
RpitContext {
}
#[automatically_derived]impl ::core::cmp::PartialEq for RpitContext {
#[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 RpitContext { }Eq, #[automatically_derived]impl ::core::fmt::Debug for RpitContext {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
RpitContext::Trait => "Trait",
RpitContext::TraitImpl => "TraitImpl",
})
}
}Debug)]
3587#[derive(const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for RpitContext
{
#[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 {
RpitContext::Trait => 0u8.stable_hash(__hcx, __hasher),
RpitContext::TraitImpl => 1u8.stable_hash(__hcx, __hasher),
}
match *self {
RpitContext::Trait => {}
RpitContext::TraitImpl => {}
}
}
}
};StableHash, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for RpitContext {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
RpitContext::Trait => { 0usize }
RpitContext::TraitImpl => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for RpitContext {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { RpitContext::Trait }
1usize => { RpitContext::TraitImpl }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `RpitContext`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable)]
3588pub enum RpitContext {
3589 Trait,
3590 TraitImpl,
3591}
3592
3593#[derive(#[automatically_derived]impl<D: ::core::marker::Copy> ::core::marker::Copy for
OpaqueTyOrigin<D> {
}Copy, #[automatically_derived]impl<D: ::core::clone::Clone> ::core::clone::Clone for
OpaqueTyOrigin<D> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
match self {
Self::FnReturn { parent: __self_0, in_trait_or_impl: __self_1 } =>
OpaqueTyOrigin::FnReturn {
parent: ::core::clone::Clone::clone(__self_0),
in_trait_or_impl: ::core::clone::Clone::clone(__self_1),
},
Self::AsyncFn { parent: __self_0, in_trait_or_impl: __self_1 } =>
OpaqueTyOrigin::AsyncFn {
parent: ::core::clone::Clone::clone(__self_0),
in_trait_or_impl: ::core::clone::Clone::clone(__self_1),
},
Self::TyAlias { parent: __self_0, in_assoc_ty: __self_1 } =>
OpaqueTyOrigin::TyAlias {
parent: ::core::clone::Clone::clone(__self_0),
in_assoc_ty: ::core::clone::Clone::clone(__self_1),
},
}
}
}Clone, #[automatically_derived]impl<D: ::core::cmp::PartialEq>
::core::marker::StructuralPartialEq for OpaqueTyOrigin<D> {
}
#[automatically_derived]impl<D: ::core::cmp::PartialEq> ::core::cmp::PartialEq
for OpaqueTyOrigin<D> {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::FnReturn { parent: __self_0, in_trait_or_impl: __self_1
}, Self::FnReturn {
parent: __arg1_0, in_trait_or_impl: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(Self::AsyncFn { parent: __self_0, in_trait_or_impl: __self_1
}, Self::AsyncFn {
parent: __arg1_0, in_trait_or_impl: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(Self::TyAlias { parent: __self_0, in_assoc_ty: __self_1 },
Self::TyAlias { parent: __arg1_0, in_assoc_ty: __arg1_1 })
=> __self_1 == __arg1_1 && __self_0 == __arg1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
}
}PartialEq, #[automatically_derived]impl<D: ::core::cmp::Eq> ::core::cmp::Eq for
OpaqueTyOrigin<D> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<D>;
let _: ::core::cmp::AssertParamIsEq<Option<RpitContext>>;
let _: ::core::cmp::AssertParamIsEq<Option<RpitContext>>;
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq, #[automatically_derived]impl<D: ::core::fmt::Debug> ::core::fmt::Debug for
OpaqueTyOrigin<D> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::FnReturn { parent: __self_0, in_trait_or_impl: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"FnReturn parent in_trait_or_impl", __self_0, &__self_1),
Self::AsyncFn { parent: __self_0, in_trait_or_impl: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"AsyncFn parent in_trait_or_impl", __self_0, &__self_1),
Self::TyAlias { parent: __self_0, in_assoc_ty: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TyAlias parent in_assoc_ty", __self_0, &__self_1),
}
}
}Debug)]
3595#[derive(const _: () =
{
impl<D> ::rustc_data_structures::stable_hash::StableHash for
OpaqueTyOrigin<D> where
D: ::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 {
OpaqueTyOrigin::FnReturn {
parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
=> 0u8.stable_hash(__hcx, __hasher),
OpaqueTyOrigin::AsyncFn {
parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
=> 1u8.stable_hash(__hcx, __hasher),
OpaqueTyOrigin::TyAlias {
parent: ref __binding_0, in_assoc_ty: ref __binding_1 } =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
OpaqueTyOrigin::FnReturn {
parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
OpaqueTyOrigin::AsyncFn {
parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
OpaqueTyOrigin::TyAlias {
parent: ref __binding_0, in_assoc_ty: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<D, __E: ::rustc_span::SpanEncoder>
::rustc_serialize::Encodable<__E> for OpaqueTyOrigin<D> where
D: ::rustc_serialize::Encodable<__E> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
OpaqueTyOrigin::FnReturn {
parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
=> {
0usize
}
OpaqueTyOrigin::AsyncFn {
parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
=> {
1usize
}
OpaqueTyOrigin::TyAlias {
parent: ref __binding_0, in_assoc_ty: ref __binding_1 } => {
2usize
}
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
OpaqueTyOrigin::FnReturn {
parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
=> {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
OpaqueTyOrigin::AsyncFn {
parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
=> {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
OpaqueTyOrigin::TyAlias {
parent: ref __binding_0, in_assoc_ty: ref __binding_1 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
}
}
};Encodable, const _: () =
{
impl<D, __D: ::rustc_span::SpanDecoder>
::rustc_serialize::Decodable<__D> for OpaqueTyOrigin<D> where
D: ::rustc_serialize::Decodable<__D> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
OpaqueTyOrigin::FnReturn {
parent: ::rustc_serialize::Decodable::decode(__decoder),
in_trait_or_impl: ::rustc_serialize::Decodable::decode(__decoder),
}
}
1usize => {
OpaqueTyOrigin::AsyncFn {
parent: ::rustc_serialize::Decodable::decode(__decoder),
in_trait_or_impl: ::rustc_serialize::Decodable::decode(__decoder),
}
}
2usize => {
OpaqueTyOrigin::TyAlias {
parent: ::rustc_serialize::Decodable::decode(__decoder),
in_assoc_ty: ::rustc_serialize::Decodable::decode(__decoder),
}
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `OpaqueTyOrigin`, expected 0..3, actual {0}",
n));
}
}
}
}
};Decodable)]
3596pub enum OpaqueTyOrigin<D> {
3597 FnReturn {
3599 parent: D,
3601 in_trait_or_impl: Option<RpitContext>,
3603 },
3604 AsyncFn {
3606 parent: D,
3608 in_trait_or_impl: Option<RpitContext>,
3610 },
3611 TyAlias {
3613 parent: D,
3615 in_assoc_ty: bool,
3617 },
3618}
3619
3620#[derive(#[automatically_derived]impl ::core::fmt::Debug for
DelegationSelfTyPropagationKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::SelfTy(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"SelfTy", &__self_0),
Self::SelfParam =>
::core::fmt::Formatter::write_str(f, "SelfParam"),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for DelegationSelfTyPropagationKind {
}
#[automatically_derived]impl ::core::clone::Clone for
DelegationSelfTyPropagationKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for
DelegationSelfTyPropagationKind {
}Copy, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
DelegationSelfTyPropagationKind {
}
#[automatically_derived]impl ::core::cmp::PartialEq for
DelegationSelfTyPropagationKind {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::SelfTy(__self_0), Self::SelfTy(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for
DelegationSelfTyPropagationKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<HirId>;
}
}Eq, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
DelegationSelfTyPropagationKind {
#[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 {
DelegationSelfTyPropagationKind::SelfTy(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
DelegationSelfTyPropagationKind::SelfParam =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
DelegationSelfTyPropagationKind::SelfTy(ref __binding_0) =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
}
DelegationSelfTyPropagationKind::SelfParam => {}
}
}
}
};StableHash)]
3621pub enum DelegationSelfTyPropagationKind {
3622 SelfTy(HirId ),
3625 SelfParam,
3628}
3629
3630#[derive(#[automatically_derived]impl ::core::fmt::Debug for DelegationInfo {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"DelegationInfo call_expr_id call_path_res child_seg_id parent_seg_id_for_sig child_seg_id_for_sig self_ty_propagation_kind group_id arguments_to_map",
&[&self.call_expr_id, &self.call_path_res, &self.child_seg_id,
&self.parent_seg_id_for_sig, &self.child_seg_id_for_sig,
&self.self_ty_propagation_kind, &self.group_id,
&&self.arguments_to_map])
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
DelegationInfo {
#[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 {
DelegationInfo {
call_expr_id: ref __binding_0,
call_path_res: ref __binding_1,
child_seg_id: ref __binding_2,
parent_seg_id_for_sig: ref __binding_3,
child_seg_id_for_sig: ref __binding_4,
self_ty_propagation_kind: ref __binding_5,
group_id: ref __binding_6,
arguments_to_map: ref __binding_7 } => {
{ __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); }
}
}
}
}
};StableHash)]
3631pub struct DelegationInfo {
3632 pub call_expr_id: HirId,
3633 pub call_path_res: DefId,
3634
3635 pub child_seg_id: HirId,
3638
3639 pub parent_seg_id_for_sig: Option<HirId>,
3645 pub child_seg_id_for_sig: Option<HirId>,
3646
3647 pub self_ty_propagation_kind: Option<DelegationSelfTyPropagationKind>,
3648 pub group_id: Option<(LocalExpnId, bool )>,
3649
3650 pub arguments_to_map: FxIndexSet<usize>,
3651}
3652
3653#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
InferDelegationSig<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Input(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Input",
&__self_0),
Self::Output(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Output", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for InferDelegationSig<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
InferDelegationSig<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<usize>;
let _: ::core::clone::AssertParamIsClone<&'hir DelegationInfo>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
InferDelegationSig<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
InferDelegationSig<'hir> {
#[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 {
InferDelegationSig::Input(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
InferDelegationSig::Output(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
InferDelegationSig::Input(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
InferDelegationSig::Output(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3654pub enum InferDelegationSig<'hir> {
3655 Input(usize),
3656 Output(&'hir DelegationInfo),
3658}
3659
3660#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
InferDelegation<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::DefId(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "DefId",
&__self_0),
Self::Sig(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Sig",
__self_0, &__self_1),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for InferDelegation<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
InferDelegation<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<DefId>;
let _: ::core::clone::AssertParamIsClone<InferDelegationSig<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
InferDelegation<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
InferDelegation<'hir> {
#[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 {
InferDelegation::DefId(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
InferDelegation::Sig(ref __binding_0, ref __binding_1) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
InferDelegation::DefId(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
InferDelegation::Sig(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3661pub enum InferDelegation<'hir> {
3662 DefId(DefId),
3665 Sig(DefId, InferDelegationSig<'hir>),
3667}
3668
3669#[repr(u8, C)]
3675#[derive(#[automatically_derived]impl<'hir, Unambig: ::core::fmt::Debug>
::core::fmt::Debug for TyKind<'hir, Unambig> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::InferDelegation(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"InferDelegation", &__self_0),
Self::Slice(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Slice",
&__self_0),
Self::Array(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Array",
__self_0, &__self_1),
Self::Ptr(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Ptr",
__self_0, &__self_1),
Self::Ref(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Ref",
__self_0, __self_1, &__self_2),
Self::FnPtr(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "FnPtr",
&__self_0),
Self::UnsafeBinder(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"UnsafeBinder", &__self_0),
Self::Never => ::core::fmt::Formatter::write_str(f, "Never"),
Self::Tup(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Tup",
&__self_0),
Self::Path(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Path",
&__self_0),
Self::OpaqueDef(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"OpaqueDef", &__self_0),
Self::TraitAscription(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"TraitAscription", &__self_0),
Self::TraitObject(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TraitObject", __self_0, &__self_1),
Self::Err(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Err",
&__self_0),
Self::Pat(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Pat",
__self_0, &__self_1),
Self::FieldOf(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"FieldOf", __self_0, &__self_1),
Self::View(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "View",
__self_0, &__self_1),
Self::Infer(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Infer",
&__self_0),
}
}
}Debug, #[automatically_derived]impl<'hir, Unambig: ::core::clone::Clone>
::core::clone::Clone for TyKind<'hir, Unambig> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
match self {
Self::InferDelegation(__self_0) =>
TyKind::InferDelegation(::core::clone::Clone::clone(__self_0)),
Self::Slice(__self_0) =>
TyKind::Slice(::core::clone::Clone::clone(__self_0)),
Self::Array(__self_0, __self_1) =>
TyKind::Array(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
Self::Ptr(__self_0, __self_1) =>
TyKind::Ptr(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
Self::Ref(__self_0, __self_1, __self_2) =>
TyKind::Ref(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1),
::core::clone::Clone::clone(__self_2)),
Self::FnPtr(__self_0) =>
TyKind::FnPtr(::core::clone::Clone::clone(__self_0)),
Self::UnsafeBinder(__self_0) =>
TyKind::UnsafeBinder(::core::clone::Clone::clone(__self_0)),
Self::Never => TyKind::Never,
Self::Tup(__self_0) =>
TyKind::Tup(::core::clone::Clone::clone(__self_0)),
Self::Path(__self_0) =>
TyKind::Path(::core::clone::Clone::clone(__self_0)),
Self::OpaqueDef(__self_0) =>
TyKind::OpaqueDef(::core::clone::Clone::clone(__self_0)),
Self::TraitAscription(__self_0) =>
TyKind::TraitAscription(::core::clone::Clone::clone(__self_0)),
Self::TraitObject(__self_0, __self_1) =>
TyKind::TraitObject(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
Self::Err(__self_0) =>
TyKind::Err(::core::clone::Clone::clone(__self_0)),
Self::Pat(__self_0, __self_1) =>
TyKind::Pat(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
Self::FieldOf(__self_0, __self_1) =>
TyKind::FieldOf(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
Self::View(__self_0, __self_1) =>
TyKind::View(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
Self::Infer(__self_0) =>
TyKind::Infer(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, #[automatically_derived]impl<'hir, Unambig: ::core::marker::Copy>
::core::marker::Copy for TyKind<'hir, Unambig> {
}Copy, const _: () =
{
impl<'hir, Unambig> ::rustc_data_structures::stable_hash::StableHash
for TyKind<'hir, Unambig> where
Unambig: ::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 {
TyKind::InferDelegation(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
TyKind::Slice(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
TyKind::Array(ref __binding_0, ref __binding_1) =>
2u8.stable_hash(__hcx, __hasher),
TyKind::Ptr(ref __binding_0, ref __binding_1) =>
3u8.stable_hash(__hcx, __hasher),
TyKind::Ref(ref __binding_0, ref __binding_1,
ref __binding_2) => 4u8.stable_hash(__hcx, __hasher),
TyKind::FnPtr(ref __binding_0) =>
5u8.stable_hash(__hcx, __hasher),
TyKind::UnsafeBinder(ref __binding_0) =>
6u8.stable_hash(__hcx, __hasher),
TyKind::Never => 7u8.stable_hash(__hcx, __hasher),
TyKind::Tup(ref __binding_0) =>
8u8.stable_hash(__hcx, __hasher),
TyKind::Path(ref __binding_0) =>
9u8.stable_hash(__hcx, __hasher),
TyKind::OpaqueDef(ref __binding_0) =>
10u8.stable_hash(__hcx, __hasher),
TyKind::TraitAscription(ref __binding_0) =>
11u8.stable_hash(__hcx, __hasher),
TyKind::TraitObject(ref __binding_0, ref __binding_1) =>
12u8.stable_hash(__hcx, __hasher),
TyKind::Err(ref __binding_0) =>
13u8.stable_hash(__hcx, __hasher),
TyKind::Pat(ref __binding_0, ref __binding_1) =>
14u8.stable_hash(__hcx, __hasher),
TyKind::FieldOf(ref __binding_0, ref __binding_1) =>
15u8.stable_hash(__hcx, __hasher),
TyKind::View(ref __binding_0, ref __binding_1) =>
16u8.stable_hash(__hcx, __hasher),
TyKind::Infer(ref __binding_0) =>
17u8.stable_hash(__hcx, __hasher),
}
match *self {
TyKind::InferDelegation(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::Slice(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::Array(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TyKind::Ptr(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TyKind::Ref(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
TyKind::FnPtr(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::UnsafeBinder(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::Never => {}
TyKind::Tup(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::Path(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::OpaqueDef(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::TraitAscription(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::TraitObject(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TyKind::Err(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::Pat(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TyKind::FieldOf(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TyKind::View(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TyKind::Infer(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3676pub enum TyKind<'hir, Unambig = ()> {
3677 InferDelegation(InferDelegation<'hir>),
3679 Slice(&'hir Ty<'hir>),
3681 Array(&'hir Ty<'hir>, &'hir ConstArg<'hir>),
3683 Ptr(&'hir Ty<'hir>, Mutability),
3685 Ref(&'hir Lifetime, &'hir Ty<'hir>, Mutability),
3687 FnPtr(&'hir FnPtrTy<'hir>),
3689 UnsafeBinder(&'hir UnsafeBinderTy<'hir>),
3691 Never,
3693 Tup(&'hir [Ty<'hir>]),
3695 Path(QPath<'hir>),
3700 OpaqueDef(&'hir OpaqueTy<'hir>),
3702 TraitAscription(GenericBounds<'hir>),
3704 TraitObject(&'hir [PolyTraitRef<'hir>], TaggedRef<'hir, Lifetime, TraitObjectSyntax>),
3710 Err(rustc_span::ErrorGuaranteed),
3712 Pat(&'hir Ty<'hir>, &'hir TyPat<'hir>),
3714 FieldOf(&'hir Ty<'hir>, &'hir TyFieldPath),
3718 View(&'hir Ty<'hir>, &'hir [Ident]),
3720 Infer(Unambig),
3726}
3727
3728#[derive(#[automatically_derived]impl ::core::fmt::Debug for InlineAsmRegOrRegClass {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Reg { reg: __self_0, source_name: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Reg reg source_name", __self_0, &__self_1),
Self::RegClass(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"RegClass", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for InlineAsmRegOrRegClass {
}
#[automatically_derived]impl ::core::clone::Clone for InlineAsmRegOrRegClass {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<asm::InlineAsmReg>;
let _: ::core::clone::AssertParamIsClone<Option<Symbol>>;
let _: ::core::clone::AssertParamIsClone<asm::InlineAsmRegClass>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for InlineAsmRegOrRegClass {
}Copy, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
InlineAsmRegOrRegClass {
#[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 {
InlineAsmRegOrRegClass::Reg {
reg: ref __binding_0, source_name: ref __binding_1 } =>
0u8.stable_hash(__hcx, __hasher),
InlineAsmRegOrRegClass::RegClass(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
InlineAsmRegOrRegClass::Reg {
reg: ref __binding_0, source_name: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
InlineAsmRegOrRegClass::RegClass(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3731pub enum InlineAsmRegOrRegClass {
3732 Reg { reg: asm::InlineAsmReg, source_name: Option<Symbol> },
3733 RegClass(asm::InlineAsmRegClass),
3734}
3735
3736impl InlineAsmRegOrRegClass {
3737 pub fn as_target(self) -> asm::InlineAsmRegOrRegClass {
3739 match self {
3740 Self::Reg { reg, .. } => asm::InlineAsmRegOrRegClass::Reg(reg),
3741 Self::RegClass(reg_class) => asm::InlineAsmRegOrRegClass::RegClass(reg_class),
3742 }
3743 }
3744
3745 pub fn reg_class(self) -> asm::InlineAsmRegClass {
3747 self.as_target().reg_class()
3748 }
3749
3750 pub fn source_name(self) -> Option<Symbol> {
3752 match self {
3753 Self::Reg { source_name, .. } => source_name,
3754 Self::RegClass(_) => None,
3755 }
3756 }
3757}
3758
3759impl fmt::Display for InlineAsmRegOrRegClass {
3761 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3762 self.as_target().fmt(f)
3763 }
3764}
3765
3766#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
InlineAsmOperand<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::In { reg: __self_0, expr: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"In reg expr", __self_0, &__self_1),
Self::Out { reg: __self_0, late: __self_1, expr: __self_2 } =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Out reg late expr", __self_0, __self_1, &__self_2),
Self::InOut { reg: __self_0, late: __self_1, expr: __self_2 } =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"InOut reg late expr", __self_0, __self_1, &__self_2),
Self::SplitInOut {
reg: __self_0,
late: __self_1,
in_expr: __self_2,
out_expr: __self_3 } =>
::core::fmt::Formatter::debug_struct_field4_finish(f,
"SplitInOut reg late in_expr out_expr", __self_0, __self_1,
__self_2, &__self_3),
Self::Const { anon_const: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Const anon_const", &__self_0),
Self::SymFn { expr: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"SymFn expr", &__self_0),
Self::SymStatic { path: __self_0, def_id: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"SymStatic path def_id", __self_0, &__self_1),
Self::Label { block: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Label block", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for InlineAsmOperand<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
InlineAsmOperand<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<InlineAsmRegOrRegClass>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
let _: ::core::clone::AssertParamIsClone<ConstBlock>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
let _: ::core::clone::AssertParamIsClone<DefId>;
let _: ::core::clone::AssertParamIsClone<&'hir Block<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
InlineAsmOperand<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
InlineAsmOperand<'hir> {
#[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 {
InlineAsmOperand::In {
reg: ref __binding_0, expr: ref __binding_1 } =>
0u8.stable_hash(__hcx, __hasher),
InlineAsmOperand::Out {
reg: ref __binding_0,
late: ref __binding_1,
expr: ref __binding_2 } => 1u8.stable_hash(__hcx, __hasher),
InlineAsmOperand::InOut {
reg: ref __binding_0,
late: ref __binding_1,
expr: ref __binding_2 } => 2u8.stable_hash(__hcx, __hasher),
InlineAsmOperand::SplitInOut {
reg: ref __binding_0,
late: ref __binding_1,
in_expr: ref __binding_2,
out_expr: ref __binding_3 } =>
3u8.stable_hash(__hcx, __hasher),
InlineAsmOperand::Const { anon_const: ref __binding_0 } =>
4u8.stable_hash(__hcx, __hasher),
InlineAsmOperand::SymFn { expr: ref __binding_0 } =>
5u8.stable_hash(__hcx, __hasher),
InlineAsmOperand::SymStatic {
path: ref __binding_0, def_id: ref __binding_1 } =>
6u8.stable_hash(__hcx, __hasher),
InlineAsmOperand::Label { block: ref __binding_0 } =>
7u8.stable_hash(__hcx, __hasher),
}
match *self {
InlineAsmOperand::In {
reg: ref __binding_0, expr: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
InlineAsmOperand::Out {
reg: ref __binding_0,
late: ref __binding_1,
expr: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
InlineAsmOperand::InOut {
reg: ref __binding_0,
late: ref __binding_1,
expr: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
InlineAsmOperand::SplitInOut {
reg: ref __binding_0,
late: ref __binding_1,
in_expr: ref __binding_2,
out_expr: 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); }
}
InlineAsmOperand::Const { anon_const: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
InlineAsmOperand::SymFn { expr: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
InlineAsmOperand::SymStatic {
path: ref __binding_0, def_id: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
InlineAsmOperand::Label { block: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3767pub enum InlineAsmOperand<'hir> {
3768 In {
3769 reg: InlineAsmRegOrRegClass,
3770 expr: &'hir Expr<'hir>,
3771 },
3772 Out {
3773 reg: InlineAsmRegOrRegClass,
3774 late: bool,
3775 expr: Option<&'hir Expr<'hir>>,
3776 },
3777 InOut {
3778 reg: InlineAsmRegOrRegClass,
3779 late: bool,
3780 expr: &'hir Expr<'hir>,
3781 },
3782 SplitInOut {
3783 reg: InlineAsmRegOrRegClass,
3784 late: bool,
3785 in_expr: &'hir Expr<'hir>,
3786 out_expr: Option<&'hir Expr<'hir>>,
3787 },
3788 Const {
3789 anon_const: ConstBlock,
3790 },
3791 SymFn {
3792 expr: &'hir Expr<'hir>,
3793 },
3794 SymStatic {
3795 path: QPath<'hir>,
3796 def_id: DefId,
3797 },
3798 Label {
3799 block: &'hir Block<'hir>,
3800 },
3801}
3802
3803impl<'hir> InlineAsmOperand<'hir> {
3804 pub fn reg(&self) -> Option<InlineAsmRegOrRegClass> {
3805 match *self {
3806 Self::In { reg, .. }
3807 | Self::Out { reg, .. }
3808 | Self::InOut { reg, .. }
3809 | Self::SplitInOut { reg, .. } => Some(reg),
3810 Self::Const { .. }
3811 | Self::SymFn { .. }
3812 | Self::SymStatic { .. }
3813 | Self::Label { .. } => None,
3814 }
3815 }
3816
3817 pub fn is_clobber(&self) -> bool {
3818 #[allow(non_exhaustive_omitted_patterns)] match self {
InlineAsmOperand::Out {
reg: InlineAsmRegOrRegClass::Reg { .. }, expr: None, .. } => true,
_ => false,
}matches!(
3819 self,
3820 InlineAsmOperand::Out { reg: InlineAsmRegOrRegClass::Reg { .. }, expr: None, .. }
3821 )
3822 }
3823}
3824
3825#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for InlineAsm<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"InlineAsm asm_macro template template_strs operands options line_spans",
&[&self.asm_macro, &self.template, &self.template_strs,
&self.operands, &self.options, &&self.line_spans])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for InlineAsm<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for InlineAsm<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<ast::AsmMacro>;
let _:
::core::clone::AssertParamIsClone<&'hir [InlineAsmTemplatePiece]>;
let _:
::core::clone::AssertParamIsClone<&'hir [(Symbol,
Option<Symbol>, Span)]>;
let _:
::core::clone::AssertParamIsClone<&'hir [(InlineAsmOperand<'hir>,
Span)]>;
let _: ::core::clone::AssertParamIsClone<InlineAsmOptions>;
let _: ::core::clone::AssertParamIsClone<&'hir [Span]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for InlineAsm<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
InlineAsm<'hir> {
#[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 {
InlineAsm {
asm_macro: ref __binding_0,
template: ref __binding_1,
template_strs: ref __binding_2,
operands: ref __binding_3,
options: ref __binding_4,
line_spans: ref __binding_5 } => {
{ __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); }
}
}
}
}
};StableHash)]
3826pub struct InlineAsm<'hir> {
3827 pub asm_macro: ast::AsmMacro,
3828 pub template: &'hir [InlineAsmTemplatePiece],
3829 pub template_strs: &'hir [(Symbol, Option<Symbol>, Span)],
3830 pub operands: &'hir [(InlineAsmOperand<'hir>, Span)],
3831 pub options: InlineAsmOptions,
3832 pub line_spans: &'hir [Span],
3833}
3834
3835impl InlineAsm<'_> {
3836 pub fn contains_label(&self) -> bool {
3837 self.operands.iter().any(|x| #[allow(non_exhaustive_omitted_patterns)] match x.0 {
InlineAsmOperand::Label { .. } => true,
_ => false,
}matches!(x.0, InlineAsmOperand::Label { .. }))
3838 }
3839}
3840
3841#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Param<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"Param hir_id pat ty_span span", &self.hir_id, &self.pat,
&self.ty_span, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Param<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Param<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Param<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Param<'hir> {
#[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 {
Param {
hir_id: ref __binding_0,
pat: ref __binding_1,
ty_span: ref __binding_2,
span: ref __binding_3 } => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3843pub struct Param<'hir> {
3844 #[stable_hash(ignore)]
3845 pub hir_id: HirId,
3846 pub pat: &'hir Pat<'hir>,
3847 pub ty_span: Span,
3848 pub span: Span,
3849}
3850
3851#[derive(#[automatically_derived]impl ::core::fmt::Debug for SplattedArgIndexError {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::InvalidIndex { splatted_arg_index: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"InvalidIndex splatted_arg_index", &__self_0),
Self::OutOfBounds {
splatted_arg_index: __self_0, args_len: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"OutOfBounds splatted_arg_index args_len", __self_0,
&__self_1),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for SplattedArgIndexError {
}
#[automatically_derived]impl ::core::clone::Clone for SplattedArgIndexError {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<u8>;
let _: ::core::clone::AssertParamIsClone<u16>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for SplattedArgIndexError {
}Copy, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
SplattedArgIndexError {
}
#[automatically_derived]impl ::core::cmp::PartialEq for SplattedArgIndexError
{
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::InvalidIndex { splatted_arg_index: __self_0 },
Self::InvalidIndex { splatted_arg_index: __arg1_0 }) =>
__self_0 == __arg1_0,
(Self::OutOfBounds {
splatted_arg_index: __self_0, args_len: __self_1 },
Self::OutOfBounds {
splatted_arg_index: __arg1_0, args_len: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
_ => unsafe { ::core::intrinsics::unreachable() }
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for SplattedArgIndexError {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<u8>;
let _: ::core::cmp::AssertParamIsEq<u16>;
}
}Eq)]
3853pub enum SplattedArgIndexError {
3854 InvalidIndex { splatted_arg_index: u8 },
3858
3859 OutOfBounds { splatted_arg_index: u8, args_len: u16 },
3861}
3862
3863#[derive(#[automatically_derived]impl ::core::marker::Copy for FnDeclFlags { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for FnDeclFlags {
}
#[automatically_derived]impl ::core::clone::Clone for FnDeclFlags {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<u8>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
FnDeclFlags {
}
#[automatically_derived]impl ::core::cmp::PartialEq for FnDeclFlags {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.flags == other.flags && self.splatted == other.splatted
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for FnDeclFlags {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<u8>;
}
}Eq, #[automatically_derived]impl ::core::cmp::PartialOrd for FnDeclFlags {
#[inline]
fn partial_cmp(&self, other: &Self)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
}
}PartialOrd, #[automatically_derived]impl ::core::cmp::Ord for FnDeclFlags {
#[inline]
fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
match ::core::cmp::Ord::cmp(&self.flags, &other.flags) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ord::cmp(&self.splatted, &other.splatted),
cmp => cmp,
}
}
}Ord, #[automatically_derived]impl ::core::hash::Hash for FnDeclFlags {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.flags, state);
::core::hash::Hash::hash(&self.splatted, state)
}
}Hash)]
3865#[derive(const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for FnDeclFlags {
fn encode(&self, __encoder: &mut __E) {
let FnDeclFlags {
flags: ref __binding_0, splatted: ref __binding_1 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for FnDeclFlags {
fn decode(__decoder: &mut __D) -> Self {
FnDeclFlags {
flags: ::rustc_serialize::Decodable::decode(__decoder),
splatted: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for FnDeclFlags
{
#[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 {
FnDeclFlags {
flags: ref __binding_0, splatted: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
3866pub struct FnDeclFlags {
3867 flags: u8,
3869
3870 splatted: u8,
3874}
3875
3876impl fmt::Debug for FnDeclFlags {
3877 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3878 let mut f = f.debug_tuple("FnDeclFlags");
3879 f.field(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("ImplicitSelfKind({0:?})",
self.implicit_self()))
})format!("ImplicitSelfKind({:?})", self.implicit_self()));
3880
3881 if self.lifetime_elision_allowed() {
3882 f.field(&"LifetimeElisionAllowed");
3883 } else {
3884 f.field(&"NoLifetimeElision");
3885 }
3886
3887 if self.c_variadic() {
3888 f.field(&"CVariadic");
3889 }
3890
3891 if let Some(index) = self.splatted() {
3892 f.field(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Splatted({0})", index))
})format!("Splatted({})", index));
3893 }
3894
3895 f.finish()
3896 }
3897}
3898
3899impl FnDeclFlags {
3900 const IMPLICIT_SELF_MASK: u8 = 0b111;
3902
3903 const C_VARIADIC_FLAG: u8 = 1 << 3;
3905
3906 const LIFETIME_ELISION_ALLOWED_FLAG: u8 = 1 << 4;
3908
3909 const NO_SPLATTED_ARG_INDEX: u8 = u8::MAX;
3912
3913 pub fn default() -> Self {
3918 Self { flags: 0, splatted: 0 }
3919 .set_implicit_self(ImplicitSelfKind::None)
3920 .set_lifetime_elision_allowed(false)
3921 .set_c_variadic(false)
3922 .set_no_splatted_args()
3923 }
3924
3925 #[must_use = "this method does not modify the receiver"]
3927 pub fn set_implicit_self(mut self, implicit_self: ImplicitSelfKind) -> Self {
3928 self.flags &= !Self::IMPLICIT_SELF_MASK;
3929
3930 match implicit_self {
3931 ImplicitSelfKind::None => self.flags |= 0,
3932 ImplicitSelfKind::Imm => self.flags |= 1,
3933 ImplicitSelfKind::Mut => self.flags |= 2,
3934 ImplicitSelfKind::RefImm => self.flags |= 3,
3935 ImplicitSelfKind::RefMut => self.flags |= 4,
3936 }
3937
3938 self
3939 }
3940
3941 #[must_use = "this method does not modify the receiver"]
3943 pub fn set_c_variadic(mut self, c_variadic: bool) -> Self {
3944 if c_variadic {
3945 self.flags |= Self::C_VARIADIC_FLAG;
3946 } else {
3947 self.flags &= !Self::C_VARIADIC_FLAG;
3948 }
3949
3950 self
3951 }
3952
3953 #[must_use = "this method does not modify the receiver"]
3955 pub fn set_lifetime_elision_allowed(mut self, allowed: bool) -> Self {
3956 if allowed {
3957 self.flags |= Self::LIFETIME_ELISION_ALLOWED_FLAG;
3958 } else {
3959 self.flags &= !Self::LIFETIME_ELISION_ALLOWED_FLAG;
3960 }
3961
3962 self
3963 }
3964
3965 #[must_use = "this method does not modify the receiver"]
3968 pub fn set_splatted(
3969 mut self,
3970 splatted: Option<u8>,
3971 args_len: usize,
3972 ) -> Result<Self, SplattedArgIndexError> {
3973 if let Some(splatted_arg_index) = splatted {
3974 if splatted_arg_index == Self::NO_SPLATTED_ARG_INDEX {
3975 return Err(SplattedArgIndexError::InvalidIndex { splatted_arg_index });
3978 } else if usize::from(splatted_arg_index) >= args_len {
3979 return Err(SplattedArgIndexError::OutOfBounds {
3980 splatted_arg_index,
3981 args_len: args_len as u16,
3982 });
3983 }
3984
3985 self.splatted = splatted_arg_index;
3986 } else {
3987 self.splatted = Self::NO_SPLATTED_ARG_INDEX;
3988 }
3989
3990 Ok(self)
3991 }
3992
3993 #[must_use = "this method does not modify the receiver"]
3995 pub fn set_no_splatted_args(mut self) -> Self {
3996 self.splatted = Self::NO_SPLATTED_ARG_INDEX;
3997
3998 self
3999 }
4000
4001 pub fn implicit_self(self) -> ImplicitSelfKind {
4003 match self.flags & Self::IMPLICIT_SELF_MASK {
4004 0 => ImplicitSelfKind::None,
4005 1 => ImplicitSelfKind::Imm,
4006 2 => ImplicitSelfKind::Mut,
4007 3 => ImplicitSelfKind::RefImm,
4008 4 => ImplicitSelfKind::RefMut,
4009 _ => ::core::panicking::unreachable_default_msg()unreachable!(),
4010 }
4011 }
4012
4013 pub fn c_variadic(self) -> bool {
4015 self.flags & Self::C_VARIADIC_FLAG != 0
4016 }
4017
4018 pub fn lifetime_elision_allowed(self) -> bool {
4020 self.flags & Self::LIFETIME_ELISION_ALLOWED_FLAG != 0
4021 }
4022
4023 pub fn splatted(self) -> Option<u8> {
4025 if self.splatted == Self::NO_SPLATTED_ARG_INDEX { None } else { Some(self.splatted) }
4026 }
4027}
4028
4029#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for FnDecl<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"FnDecl inputs output fn_decl_kind", &self.inputs, &self.output,
&&self.fn_decl_kind)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for FnDecl<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for FnDecl<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [Ty<'hir>]>;
let _: ::core::clone::AssertParamIsClone<FnRetTy<'hir>>;
let _: ::core::clone::AssertParamIsClone<FnDeclFlags>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for FnDecl<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
FnDecl<'hir> {
#[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 {
FnDecl {
inputs: ref __binding_0,
output: ref __binding_1,
fn_decl_kind: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4031pub struct FnDecl<'hir> {
4032 pub inputs: &'hir [Ty<'hir>],
4036 pub output: FnRetTy<'hir>,
4037 pub fn_decl_kind: FnDeclFlags,
4039}
4040
4041impl<'hir> FnDecl<'hir> {
4042 pub fn opt_delegation_sig_id(&self) -> Option<DefId> {
4043 if let FnRetTy::Return(ty) = self.output
4044 && let TyKind::InferDelegation(InferDelegation::Sig(sig_id, _)) = ty.kind
4045 {
4046 return Some(sig_id);
4047 }
4048 None
4049 }
4050
4051 pub fn opt_delegation_info(&self) -> Option<&'hir DelegationInfo> {
4052 if let FnRetTy::Return(ty) = self.output
4053 && let TyKind::InferDelegation(InferDelegation::Sig(_, kind)) = ty.kind
4054 && let InferDelegationSig::Output(generics) = kind
4055 {
4056 return Some(generics);
4057 }
4058
4059 None
4060 }
4061
4062 pub fn implicit_self(&self) -> ImplicitSelfKind {
4063 self.fn_decl_kind.implicit_self()
4064 }
4065
4066 pub fn c_variadic(&self) -> bool {
4067 self.fn_decl_kind.c_variadic()
4068 }
4069
4070 pub fn lifetime_elision_allowed(&self) -> bool {
4071 self.fn_decl_kind.lifetime_elision_allowed()
4072 }
4073
4074 pub fn splatted(&self) -> Option<u8> {
4075 self.fn_decl_kind.splatted()
4076 }
4077
4078 pub fn dummy(span: Span) -> Self {
4079 Self {
4080 inputs: &[],
4081 output: FnRetTy::DefaultReturn(span),
4082 fn_decl_kind: FnDeclFlags::default().set_lifetime_elision_allowed(true),
4083 }
4084 }
4085}
4086
4087#[derive(#[automatically_derived]impl ::core::marker::Copy for ImplicitSelfKind { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ImplicitSelfKind {
}
#[automatically_derived]impl ::core::clone::Clone for ImplicitSelfKind {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
ImplicitSelfKind {
}
#[automatically_derived]impl ::core::cmp::PartialEq for ImplicitSelfKind {
#[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 ImplicitSelfKind { }Eq, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for ImplicitSelfKind {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
ImplicitSelfKind::Imm => { 0usize }
ImplicitSelfKind::Mut => { 1usize }
ImplicitSelfKind::RefImm => { 2usize }
ImplicitSelfKind::RefMut => { 3usize }
ImplicitSelfKind::None => { 4usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for ImplicitSelfKind {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { ImplicitSelfKind::Imm }
1usize => { ImplicitSelfKind::Mut }
2usize => { ImplicitSelfKind::RefImm }
3usize => { ImplicitSelfKind::RefMut }
4usize => { ImplicitSelfKind::None }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ImplicitSelfKind`, expected 0..5, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]impl ::core::fmt::Debug for ImplicitSelfKind {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_c_like_enum_write_str(f,
"Imm Mut RefImm RefMut None",
match self {
ImplicitSelfKind::Imm => 0usize,
ImplicitSelfKind::Mut => 4usize,
ImplicitSelfKind::RefImm => 8usize,
ImplicitSelfKind::RefMut => 15usize,
ImplicitSelfKind::None => 22usize,
})
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
ImplicitSelfKind {
#[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 {
ImplicitSelfKind::Imm => 0u8.stable_hash(__hcx, __hasher),
ImplicitSelfKind::Mut => 1u8.stable_hash(__hcx, __hasher),
ImplicitSelfKind::RefImm =>
2u8.stable_hash(__hcx, __hasher),
ImplicitSelfKind::RefMut =>
3u8.stable_hash(__hcx, __hasher),
ImplicitSelfKind::None => 4u8.stable_hash(__hcx, __hasher),
}
match *self {
ImplicitSelfKind::Imm => {}
ImplicitSelfKind::Mut => {}
ImplicitSelfKind::RefImm => {}
ImplicitSelfKind::RefMut => {}
ImplicitSelfKind::None => {}
}
}
}
};StableHash)]
4089pub enum ImplicitSelfKind {
4090 Imm,
4092 Mut,
4094 RefImm,
4096 RefMut,
4098 None,
4101}
4102
4103impl ImplicitSelfKind {
4104 pub fn has_implicit_self(&self) -> bool {
4106 !#[allow(non_exhaustive_omitted_patterns)] match *self {
ImplicitSelfKind::None => true,
_ => false,
}matches!(*self, ImplicitSelfKind::None)
4107 }
4108}
4109
4110#[derive(#[automatically_derived]impl ::core::marker::Copy for IsAsync { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for IsAsync {
}
#[automatically_derived]impl ::core::clone::Clone for IsAsync {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for IsAsync {
}
#[automatically_derived]impl ::core::cmp::PartialEq for IsAsync {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Async(__self_0), Self::Async(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for IsAsync {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<Span>;
}
}Eq, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for IsAsync {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
IsAsync::Async(ref __binding_0) => { 0usize }
IsAsync::NotAsync => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
IsAsync::Async(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
IsAsync::NotAsync => {}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for IsAsync {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
IsAsync::Async(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => { IsAsync::NotAsync }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `IsAsync`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable, #[automatically_derived]impl ::core::fmt::Debug for IsAsync {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Async(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Async",
&__self_0),
Self::NotAsync =>
::core::fmt::Formatter::write_str(f, "NotAsync"),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for IsAsync {
#[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 {
IsAsync::Async(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
IsAsync::NotAsync => 1u8.stable_hash(__hcx, __hasher),
}
match *self {
IsAsync::Async(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
IsAsync::NotAsync => {}
}
}
}
};StableHash)]
4111pub enum IsAsync {
4112 Async(Span),
4113 NotAsync,
4114}
4115
4116impl IsAsync {
4117 pub fn is_async(self) -> bool {
4118 #[allow(non_exhaustive_omitted_patterns)] match self {
IsAsync::Async(_) => true,
_ => false,
}matches!(self, IsAsync::Async(_))
4119 }
4120}
4121
4122#[derive(#[automatically_derived]impl ::core::marker::Copy for Defaultness { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for Defaultness {
}
#[automatically_derived]impl ::core::clone::Clone for Defaultness {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
Defaultness {
}
#[automatically_derived]impl ::core::cmp::PartialEq for Defaultness {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Default { has_value: __self_0 }, Self::Default {
has_value: __arg1_0 }) => __self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for Defaultness {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq, #[automatically_derived]impl ::core::fmt::Debug for Defaultness {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Default { has_value: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Default has_value", &__self_0),
Self::Final => ::core::fmt::Formatter::write_str(f, "Final"),
}
}
}Debug, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for Defaultness {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
Defaultness::Default { has_value: ref __binding_0 } => {
0usize
}
Defaultness::Final => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
Defaultness::Default { has_value: ref __binding_0 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
Defaultness::Final => {}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for Defaultness {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
Defaultness::Default {
has_value: ::rustc_serialize::Decodable::decode(__decoder),
}
}
1usize => { Defaultness::Final }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Defaultness`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for Defaultness
{
#[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 {
Defaultness::Default { has_value: ref __binding_0 } =>
0u8.stable_hash(__hcx, __hasher),
Defaultness::Final => 1u8.stable_hash(__hcx, __hasher),
}
match *self {
Defaultness::Default { has_value: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Defaultness::Final => {}
}
}
}
};StableHash)]
4123#[derive(#[automatically_derived]impl ::core::default::Default for Defaultness {
#[inline]
fn default() -> Self { Self::Final }
}Default)]
4124pub enum Defaultness {
4125 Default {
4126 has_value: bool,
4127 },
4128 #[default]
4129 Final,
4130}
4131
4132impl Defaultness {
4133 pub fn has_value(&self) -> bool {
4134 match *self {
4135 Defaultness::Default { has_value } => has_value,
4136 Defaultness::Final => true,
4137 }
4138 }
4139
4140 pub fn is_final(&self) -> bool {
4141 *self == Defaultness::Final
4142 }
4143
4144 pub fn is_default(&self) -> bool {
4145 #[allow(non_exhaustive_omitted_patterns)] match *self {
Defaultness::Default { .. } => true,
_ => false,
}matches!(*self, Defaultness::Default { .. })
4146 }
4147}
4148
4149#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for FnRetTy<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::DefaultReturn(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"DefaultReturn", &__self_0),
Self::Return(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Return", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for FnRetTy<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for FnRetTy<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for FnRetTy<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
FnRetTy<'hir> {
#[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 {
FnRetTy::DefaultReturn(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
FnRetTy::Return(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
FnRetTy::DefaultReturn(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
FnRetTy::Return(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4150pub enum FnRetTy<'hir> {
4151 DefaultReturn(Span),
4157 Return(&'hir Ty<'hir>),
4159}
4160
4161impl<'hir> FnRetTy<'hir> {
4162 #[inline]
4163 pub fn span(&self) -> Span {
4164 match *self {
4165 Self::DefaultReturn(span) => span,
4166 Self::Return(ref ty) => ty.span,
4167 }
4168 }
4169
4170 pub fn is_suggestable_infer_ty(&self) -> Option<&'hir Ty<'hir>> {
4171 if let Self::Return(ty) = self
4172 && ty.is_suggestable_infer_ty()
4173 {
4174 return Some(*ty);
4175 }
4176 None
4177 }
4178}
4179
4180#[derive(#[automatically_derived]impl ::core::marker::Copy for ClosureBinder { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ClosureBinder {
}
#[automatically_derived]impl ::core::clone::Clone for ClosureBinder {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for ClosureBinder {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Default => ::core::fmt::Formatter::write_str(f, "Default"),
Self::For { span: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"For span", &__self_0),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
ClosureBinder {
#[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 {
ClosureBinder::Default => 0u8.stable_hash(__hcx, __hasher),
ClosureBinder::For { span: ref __binding_0 } =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
ClosureBinder::Default => {}
ClosureBinder::For { span: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4182pub enum ClosureBinder {
4183 Default,
4185 For { span: Span },
4189}
4190
4191#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Mod<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Mod spans item_ids", &self.spans, &&self.item_ids)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Mod<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Mod<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<ModSpans>;
let _: ::core::clone::AssertParamIsClone<&'hir [ItemId]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Mod<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Mod<'hir> {
#[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 {
Mod { spans: ref __binding_0, item_ids: ref __binding_1 } =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4192pub struct Mod<'hir> {
4193 pub spans: ModSpans,
4194 pub item_ids: &'hir [ItemId],
4195}
4196
4197#[derive(#[automatically_derived]impl ::core::marker::Copy for ModSpans { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ModSpans {
}
#[automatically_derived]impl ::core::clone::Clone for ModSpans {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for ModSpans {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"ModSpans inner_span inject_use_span", &self.inner_span,
&&self.inject_use_span)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for ModSpans {
#[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 {
ModSpans {
inner_span: ref __binding_0,
inject_use_span: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4198pub struct ModSpans {
4199 pub inner_span: Span,
4203 pub inject_use_span: Span,
4204}
4205
4206#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for EnumDef<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"EnumDef variants", &&self.variants)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for EnumDef<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for EnumDef<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [Variant<'hir>]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for EnumDef<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
EnumDef<'hir> {
#[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 {
EnumDef { variants: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4207pub struct EnumDef<'hir> {
4208 pub variants: &'hir [Variant<'hir>],
4209}
4210
4211#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Variant<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"Variant ident hir_id def_id data disr_expr span",
&[&self.ident, &self.hir_id, &self.def_id, &self.data,
&self.disr_expr, &&self.span])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Variant<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Variant<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
let _: ::core::clone::AssertParamIsClone<VariantData<'hir>>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir AnonConst>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Variant<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Variant<'hir> {
#[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 {
Variant {
ident: ref __binding_0,
hir_id: ref __binding_1,
def_id: ref __binding_2,
data: ref __binding_3,
disr_expr: ref __binding_4,
span: ref __binding_5 } => {
{ __binding_0.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); }
}
}
}
}
};StableHash)]
4212pub struct Variant<'hir> {
4213 pub ident: Ident,
4215 #[stable_hash(ignore)]
4217 pub hir_id: HirId,
4218 pub def_id: LocalDefId,
4219 pub data: VariantData<'hir>,
4221 pub disr_expr: Option<&'hir AnonConst>,
4223 pub span: Span,
4225}
4226
4227#[derive(#[automatically_derived]impl<'hir> ::core::marker::Copy for UseTree<'hir> { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for UseTree<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for UseTree<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir UsePath<'hir>>;
let _: ::core::clone::AssertParamIsClone<UseKind<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::fmt::Debug for UseTree<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"UseTree prefix kind", &self.prefix, &&self.kind)
}
}Debug, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
UseTree<'hir> {
#[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 {
UseTree { prefix: ref __binding_0, kind: ref __binding_1 }
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4228pub struct UseTree<'hir> {
4229 pub prefix: &'hir UsePath<'hir>,
4230 pub kind: UseKind<'hir>,
4231}
4232
4233impl UseTree<'_> {
4234 pub fn resolutions(&self) -> impl Iterator<Item = PerNS<Option<Res>>> {
4235 Box::new(std::iter::iter!(|| {
4236 match self.kind {
4237 UseKind::Glob => yield self.prefix.res,
4238 UseKind::Single(_) => yield self.prefix.res,
4239 UseKind::Nested { items } => {
4240 for (item, _, _) in items {
4241 for res in item.resolutions() {
4242 yield res;
4243 }
4244 }
4245 }
4246 }
4247 })())
4248 }
4249}
4250
4251#[derive(#[automatically_derived]impl<'hir> ::core::marker::Copy for UseKind<'hir> { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for UseKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for UseKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Ident>;
let _:
::core::clone::AssertParamIsClone<&'hir [(UseTree<'hir>,
HirId, LocalDefId)]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::fmt::Debug for UseKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Single(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Single", &__self_0),
Self::Glob => ::core::fmt::Formatter::write_str(f, "Glob"),
Self::Nested { items: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Nested items", &__self_0),
}
}
}Debug, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
UseKind<'hir> {
#[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 {
UseKind::Single(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
UseKind::Glob => 1u8.stable_hash(__hcx, __hasher),
UseKind::Nested { items: ref __binding_0 } =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
UseKind::Single(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
UseKind::Glob => {}
UseKind::Nested { items: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4252pub enum UseKind<'hir> {
4253 Single(Ident),
4260
4261 Glob,
4263
4264 Nested { items: &'hir [(UseTree<'hir>, HirId, LocalDefId)] },
4266}
4267
4268#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TraitRef<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for TraitRef<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Path<'hir>>;
let _: ::core::clone::AssertParamIsClone<HirId>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::fmt::Debug for TraitRef<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TraitRef path hir_ref_id", &self.path, &&self.hir_ref_id)
}
}Debug, #[automatically_derived]impl<'hir> ::core::marker::Copy for TraitRef<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TraitRef<'hir> {
#[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 {
TraitRef {
path: ref __binding_0, hir_ref_id: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{}
}
}
}
}
};StableHash)]
4275pub struct TraitRef<'hir> {
4276 pub path: &'hir Path<'hir>,
4277 #[stable_hash(ignore)]
4279 pub hir_ref_id: HirId,
4280}
4281
4282impl TraitRef<'_> {
4283 pub fn trait_def_id(&self) -> Option<DefId> {
4285 match self.path.res {
4286 Res::Def(DefKind::Trait | DefKind::TraitAlias, did) => Some(did),
4287 Res::Err => None,
4288 res => {
::core::panicking::panic_fmt(format_args!("{0:?} did not resolve to a trait or trait alias",
res));
}panic!("{res:?} did not resolve to a trait or trait alias"),
4289 }
4290 }
4291}
4292
4293#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for PolyTraitRef<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for PolyTraitRef<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
let _: ::core::clone::AssertParamIsClone<TraitBoundModifiers>;
let _: ::core::clone::AssertParamIsClone<TraitRef<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::fmt::Debug for PolyTraitRef<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"PolyTraitRef bound_generic_params modifiers trait_ref span",
&self.bound_generic_params, &self.modifiers, &self.trait_ref,
&&self.span)
}
}Debug, #[automatically_derived]impl<'hir> ::core::marker::Copy for PolyTraitRef<'hir>
{
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
PolyTraitRef<'hir> {
#[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 {
PolyTraitRef {
bound_generic_params: ref __binding_0,
modifiers: ref __binding_1,
trait_ref: ref __binding_2,
span: 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)]
4294pub struct PolyTraitRef<'hir> {
4295 pub bound_generic_params: &'hir [GenericParam<'hir>],
4297
4298 pub modifiers: TraitBoundModifiers,
4302
4303 pub trait_ref: TraitRef<'hir>,
4305
4306 pub span: Span,
4307}
4308
4309#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for FieldDef<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_fields_finish(f,
"FieldDef span vis_span mut_restriction ident hir_id def_id ty safety default",
&[&self.span, &self.vis_span, &self.mut_restriction, &self.ident,
&self.hir_id, &self.def_id, &self.ty, &self.safety,
&&self.default])
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for FieldDef<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for FieldDef<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir MutRestriction<'hir>>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<Safety>;
let _: ::core::clone::AssertParamIsClone<Option<&'hir AnonConst>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for FieldDef<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
FieldDef<'hir> {
#[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 {
FieldDef {
span: ref __binding_0,
vis_span: ref __binding_1,
mut_restriction: ref __binding_2,
ident: ref __binding_3,
hir_id: ref __binding_4,
def_id: ref __binding_5,
ty: ref __binding_6,
safety: ref __binding_7,
default: ref __binding_8 } => {
{ __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_5.stable_hash(__hcx, __hasher); }
{ __binding_6.stable_hash(__hcx, __hasher); }
{ __binding_7.stable_hash(__hcx, __hasher); }
{ __binding_8.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4310pub struct FieldDef<'hir> {
4311 pub span: Span,
4312 pub vis_span: Span,
4313 pub mut_restriction: &'hir MutRestriction<'hir>,
4314 pub ident: Ident,
4315 #[stable_hash(ignore)]
4316 pub hir_id: HirId,
4317 pub def_id: LocalDefId,
4318 pub ty: &'hir Ty<'hir>,
4319 pub safety: Safety,
4320 pub default: Option<&'hir AnonConst>,
4321}
4322
4323impl FieldDef<'_> {
4324 pub fn is_positional(&self) -> bool {
4326 self.ident.as_str().as_bytes()[0].is_ascii_digit()
4327 }
4328}
4329
4330#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for VariantData<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Struct { fields: __self_0, recovered: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Struct fields recovered", __self_0, &__self_1),
Self::Tuple(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Tuple",
__self_0, __self_1, &__self_2),
Self::Unit(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Unit",
__self_0, &__self_1),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for VariantData<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for VariantData<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir [FieldDef<'hir>]>;
let _: ::core::clone::AssertParamIsClone<ast::Recovered>;
let _: ::core::clone::AssertParamIsClone<&'hir [FieldDef<'hir>]>;
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for VariantData<'hir>
{
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
VariantData<'hir> {
#[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 {
VariantData::Struct {
fields: ref __binding_0, recovered: ref __binding_1 } =>
0u8.stable_hash(__hcx, __hasher),
VariantData::Tuple(ref __binding_0, ref __binding_1,
ref __binding_2) => 1u8.stable_hash(__hcx, __hasher),
VariantData::Unit(ref __binding_0, ref __binding_1) =>
2u8.stable_hash(__hcx, __hasher),
}
match *self {
VariantData::Struct {
fields: ref __binding_0, recovered: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
VariantData::Tuple(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{}
{ __binding_2.stable_hash(__hcx, __hasher); }
}
VariantData::Unit(ref __binding_0, ref __binding_1) => {
{}
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4332pub enum VariantData<'hir> {
4333 Struct { fields: &'hir [FieldDef<'hir>], recovered: ast::Recovered },
4337 Tuple(&'hir [FieldDef<'hir>], #[stable_hash(ignore)] HirId, LocalDefId),
4341 Unit(#[stable_hash(ignore)] HirId, LocalDefId),
4345}
4346
4347impl<'hir> VariantData<'hir> {
4348 pub fn fields(&self) -> &'hir [FieldDef<'hir>] {
4350 match *self {
4351 VariantData::Struct { fields, .. } | VariantData::Tuple(fields, ..) => fields,
4352 _ => &[],
4353 }
4354 }
4355
4356 pub fn ctor(&self) -> Option<(CtorKind, HirId, LocalDefId)> {
4357 match *self {
4358 VariantData::Tuple(_, hir_id, def_id) => Some((CtorKind::Fn, hir_id, def_id)),
4359 VariantData::Unit(hir_id, def_id) => Some((CtorKind::Const, hir_id, def_id)),
4360 VariantData::Struct { .. } => None,
4361 }
4362 }
4363
4364 #[inline]
4365 pub fn ctor_kind(&self) -> Option<CtorKind> {
4366 self.ctor().map(|(kind, ..)| kind)
4367 }
4368
4369 #[inline]
4371 pub fn ctor_hir_id(&self) -> Option<HirId> {
4372 self.ctor().map(|(_, hir_id, _)| hir_id)
4373 }
4374
4375 #[inline]
4377 pub fn ctor_def_id(&self) -> Option<LocalDefId> {
4378 self.ctor().map(|(.., def_id)| def_id)
4379 }
4380}
4381
4382#[derive(#[automatically_derived]impl ::core::marker::Copy for ItemId { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ItemId {
}
#[automatically_derived]impl ::core::clone::Clone for ItemId {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<OwnerId>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for ItemId {
}
#[automatically_derived]impl ::core::cmp::PartialEq for ItemId {
#[inline]
fn eq(&self, other: &Self) -> bool { self.owner_id == other.owner_id }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for ItemId {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<OwnerId>;
}
}Eq, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for ItemId {
fn encode(&self, __encoder: &mut __E) {
let ItemId { owner_id: ref __binding_0 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for ItemId {
fn decode(__decoder: &mut __D) -> Self {
ItemId {
owner_id: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]impl ::core::fmt::Debug for ItemId {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ItemId owner_id", &&self.owner_id)
}
}Debug, #[automatically_derived]impl ::core::hash::Hash for ItemId {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.owner_id, state)
}
}Hash, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for ItemId {
#[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 {
ItemId { owner_id: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4386pub struct ItemId {
4387 pub owner_id: OwnerId,
4388}
4389
4390impl ItemId {
4391 #[inline]
4392 pub fn hir_id(&self) -> HirId {
4393 HirId::make_owner(self.owner_id.def_id)
4395 }
4396}
4397
4398#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Item<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"Item owner_id kind span vis_span eii", &self.owner_id,
&self.kind, &self.span, &self.vis_span, &&self.eii)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Item<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Item<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<OwnerId>;
let _: ::core::clone::AssertParamIsClone<ItemKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Item<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Item<'hir> {
#[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 {
Item {
owner_id: ref __binding_0,
kind: ref __binding_1,
span: ref __binding_2,
vis_span: ref __binding_3,
eii: 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)]
4407pub struct Item<'hir> {
4408 pub owner_id: OwnerId,
4409 pub kind: ItemKind<'hir>,
4410 pub span: Span,
4411 pub vis_span: Span,
4412 pub eii: bool,
4415}
4416
4417impl<'hir> Item<'hir> {
4418 #[inline]
4419 pub fn hir_id(&self) -> HirId {
4420 HirId::make_owner(self.owner_id.def_id)
4422 }
4423
4424 #[inline]
4425 pub fn item_id(&self) -> ItemId {
4426 ItemId { owner_id: self.owner_id }
4427 }
4428
4429 pub fn is_adt(&self) -> bool {
4432 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) => true,
_ => false,
}matches!(self.kind, ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..))
4433 }
4434
4435 pub fn is_struct_or_union(&self) -> bool {
4437 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
ItemKind::Struct(..) | ItemKind::Union(..) => true,
_ => false,
}matches!(self.kind, ItemKind::Struct(..) | ItemKind::Union(..))
4438 }
4439
4440 #[track_caller]
pub fn expect_extern_crate(&self) -> (Option<Symbol>, Ident) {
let ItemKind::ExternCrate(s, ident) =
&self.kind else { expect_failed("expect_extern_crate", self) };
(*s, *ident)
}
#[track_caller]
pub fn expect_use(&self) -> UseTree<'hir> {
let ItemKind::Use(ut) =
&self.kind else { expect_failed("expect_use", self) };
*ut
}
#[track_caller]
pub fn expect_static(&self) -> (Mutability, Ident, &'hir Ty<'hir>, BodyId) {
let ItemKind::Static(mutbl, ident, ty, body) =
&self.kind else { expect_failed("expect_static", self) };
(*mutbl, *ident, ty, *body)
}
#[track_caller]
pub fn expect_const(&self)
-> (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, ConstItemRhs<'hir>) {
let ItemKind::Const(ident, generics, ty, rhs) =
&self.kind else { expect_failed("expect_const", self) };
(*ident, generics, ty, *rhs)
}
#[track_caller]
pub fn expect_fn(&self)
-> (Ident, &FnSig<'hir>, &'hir Generics<'hir>, BodyId) {
let ItemKind::Fn { ident, sig, generics, body, .. } =
&self.kind else { expect_failed("expect_fn", self) };
(*ident, sig, generics, *body)
}
#[track_caller]
pub fn expect_macro(&self) -> (Ident, &ast::MacroDef, MacroKinds) {
let ItemKind::Macro(ident, def, mk) =
&self.kind else { expect_failed("expect_macro", self) };
(*ident, def, *mk)
}
#[track_caller]
pub fn expect_mod(&self) -> (Ident, &'hir Mod<'hir>) {
let ItemKind::Mod(ident, m) =
&self.kind else { expect_failed("expect_mod", self) };
(*ident, m)
}
#[track_caller]
pub fn expect_foreign_mod(&self) -> (ExternAbi, &'hir [ForeignItemId]) {
let ItemKind::ForeignMod { abi, items } =
&self.kind else { expect_failed("expect_foreign_mod", self) };
(*abi, items)
}
#[track_caller]
pub fn expect_global_asm(&self) -> &'hir InlineAsm<'hir> {
let ItemKind::GlobalAsm { asm, .. } =
&self.kind else { expect_failed("expect_global_asm", self) };
asm
}
#[track_caller]
pub fn expect_ty_alias(&self)
-> (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>) {
let ItemKind::TyAlias(ident, generics, ty) =
&self.kind else { expect_failed("expect_ty_alias", self) };
(*ident, generics, ty)
}
#[track_caller]
pub fn expect_enum(&self) -> (Ident, &'hir Generics<'hir>, &EnumDef<'hir>) {
let ItemKind::Enum(ident, generics, def) =
&self.kind else { expect_failed("expect_enum", self) };
(*ident, generics, def)
}
#[track_caller]
pub fn expect_struct(&self)
-> (Ident, &'hir Generics<'hir>, &VariantData<'hir>) {
let ItemKind::Struct(ident, generics, data) =
&self.kind else { expect_failed("expect_struct", self) };
(*ident, generics, data)
}
#[track_caller]
pub fn expect_union(&self)
-> (Ident, &'hir Generics<'hir>, &VariantData<'hir>) {
let ItemKind::Union(ident, generics, data) =
&self.kind else { expect_failed("expect_union", self) };
(*ident, generics, data)
}
#[track_caller]
pub fn expect_trait(&self)
->
(&'hir ImplRestriction<'hir>, Constness, IsAuto, Safety, Ident,
&'hir Generics<'hir>, GenericBounds<'hir>, &'hir [TraitItemId]) {
let ItemKind::Trait {
impl_restriction,
constness,
is_auto,
safety,
ident,
generics,
bounds,
items } = &self.kind else { expect_failed("expect_trait", self) };
(impl_restriction, *constness, *is_auto, *safety, *ident, generics,
bounds, items)
}
#[track_caller]
pub fn expect_trait_alias(&self)
-> (Constness, Ident, &'hir Generics<'hir>, GenericBounds<'hir>) {
let ItemKind::TraitAlias(constness, ident, generics, bounds) =
&self.kind else { expect_failed("expect_trait_alias", self) };
(*constness, *ident, generics, bounds)
}
#[track_caller]
pub fn expect_impl(&self) -> &Impl<'hir> {
let ItemKind::Impl(imp) =
&self.kind else { expect_failed("expect_impl", self) };
imp
}
#[track_caller]
pub fn expect_test_binder_constraints(&self)
-> (&'hir Generics<'hir>, &'hir TestBinderBody<'hir>) {
let ItemKind::TestBinderConstraints { generics, body } =
&self.kind else {
expect_failed("expect_test_binder_constraints", self)
};
(generics, body)
}expect_methods_self_kind! {
4441 expect_extern_crate, (Option<Symbol>, Ident),
4442 ItemKind::ExternCrate(s, ident), (*s, *ident);
4443
4444 expect_use, UseTree<'hir>, ItemKind::Use(ut), *ut;
4445
4446 expect_static, (Mutability, Ident, &'hir Ty<'hir>, BodyId),
4447 ItemKind::Static(mutbl, ident, ty, body), (*mutbl, *ident, ty, *body);
4448
4449 expect_const, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, ConstItemRhs<'hir>),
4450 ItemKind::Const(ident, generics, ty, rhs), (*ident, generics, ty, *rhs);
4451
4452 expect_fn, (Ident, &FnSig<'hir>, &'hir Generics<'hir>, BodyId),
4453 ItemKind::Fn { ident, sig, generics, body, .. }, (*ident, sig, generics, *body);
4454
4455 expect_macro, (Ident, &ast::MacroDef, MacroKinds),
4456 ItemKind::Macro(ident, def, mk), (*ident, def, *mk);
4457
4458 expect_mod, (Ident, &'hir Mod<'hir>), ItemKind::Mod(ident, m), (*ident, m);
4459
4460 expect_foreign_mod, (ExternAbi, &'hir [ForeignItemId]),
4461 ItemKind::ForeignMod { abi, items }, (*abi, items);
4462
4463 expect_global_asm, &'hir InlineAsm<'hir>, ItemKind::GlobalAsm { asm, .. }, asm;
4464
4465 expect_ty_alias, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
4466 ItemKind::TyAlias(ident, generics, ty), (*ident, generics, ty);
4467
4468 expect_enum, (Ident, &'hir Generics<'hir>, &EnumDef<'hir>),
4469 ItemKind::Enum(ident, generics, def), (*ident, generics, def);
4470
4471 expect_struct, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
4472 ItemKind::Struct(ident, generics, data), (*ident, generics, data);
4473
4474 expect_union, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
4475 ItemKind::Union(ident, generics, data), (*ident, generics, data);
4476
4477 expect_trait,
4478 (
4479 &'hir ImplRestriction<'hir>,
4480 Constness,
4481 IsAuto,
4482 Safety,
4483 Ident,
4484 &'hir Generics<'hir>,
4485 GenericBounds<'hir>,
4486 &'hir [TraitItemId]
4487 ),
4488 ItemKind::Trait { impl_restriction, constness, is_auto, safety, ident, generics, bounds, items },
4489 (impl_restriction, *constness, *is_auto, *safety, *ident, generics, bounds, items);
4490
4491 expect_trait_alias, (Constness, Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
4492 ItemKind::TraitAlias(constness, ident, generics, bounds), (*constness, *ident, generics, bounds);
4493
4494 expect_impl, &Impl<'hir>, ItemKind::Impl(imp), imp;
4495
4496 expect_test_binder_constraints, (&'hir Generics<'hir>, &'hir TestBinderBody<'hir>),
4497 ItemKind::TestBinderConstraints { generics, body }, (generics, body);
4498 }
4499}
4500
4501#[derive(#[automatically_derived]impl ::core::marker::Copy for Safety { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for Safety {
}
#[automatically_derived]impl ::core::clone::Clone for Safety {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for Safety {
}
#[automatically_derived]impl ::core::cmp::PartialEq for Safety {
#[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 Safety { }Eq, #[automatically_derived]impl ::core::cmp::PartialOrd for Safety {
#[inline]
fn partial_cmp(&self, other: &Self)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
}
}PartialOrd, #[automatically_derived]impl ::core::cmp::Ord for Safety {
#[inline]
fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
::core::cmp::Ord::cmp(&::core::intrinsics::discriminant_value(self),
&::core::intrinsics::discriminant_value(other))
}
}Ord, #[automatically_derived]impl ::core::hash::Hash for Safety {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state)
}
}Hash, #[automatically_derived]impl ::core::fmt::Debug for Safety {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
Safety::Unsafe => "Unsafe",
Safety::Safe => "Safe",
})
}
}Debug)]
4502#[derive(const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for Safety {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
Safety::Unsafe => { 0usize }
Safety::Safe => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for Safety {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { Safety::Unsafe }
1usize => { Safety::Safe }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Safety`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for Safety {
#[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 {
Safety::Unsafe => 0u8.stable_hash(__hcx, __hasher),
Safety::Safe => 1u8.stable_hash(__hcx, __hasher),
}
match *self { Safety::Unsafe => {} Safety::Safe => {} }
}
}
};StableHash, #[automatically_derived]impl ::core::default::Default for Safety {
#[inline]
fn default() -> Self { Self::Unsafe }
}Default)]
4503pub enum Safety {
4504 #[default]
4509 Unsafe,
4510 Safe,
4511}
4512
4513impl Safety {
4514 pub fn prefix_str(self) -> &'static str {
4515 match self {
4516 Self::Unsafe => "unsafe ",
4517 Self::Safe => "",
4518 }
4519 }
4520
4521 #[inline]
4522 pub fn is_unsafe(self) -> bool {
4523 !self.is_safe()
4524 }
4525
4526 #[inline]
4527 pub fn is_safe(self) -> bool {
4528 match self {
4529 Self::Unsafe => false,
4530 Self::Safe => true,
4531 }
4532 }
4533}
4534
4535impl fmt::Display for Safety {
4536 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4537 f.write_str(match *self {
4538 Self::Unsafe => "unsafe",
4539 Self::Safe => "safe",
4540 })
4541 }
4542}
4543
4544#[derive(#[automatically_derived]impl ::core::marker::Copy for Constness { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for Constness {
}
#[automatically_derived]impl ::core::clone::Clone for Constness {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for Constness
{
}
#[automatically_derived]impl ::core::cmp::PartialEq for Constness {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Const { always: __self_0 }, Self::Const {
always: __arg1_0 }) => __self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for Constness {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq, #[automatically_derived]impl ::core::fmt::Debug for Constness {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Const { always: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Const always", &__self_0),
Self::NotConst =>
::core::fmt::Formatter::write_str(f, "NotConst"),
}
}
}Debug, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for Constness {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
Constness::Const { always: ref __binding_0 } => { 0usize }
Constness::NotConst => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
Constness::Const { always: ref __binding_0 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
Constness::NotConst => {}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for Constness {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
Constness::Const {
always: ::rustc_serialize::Decodable::decode(__decoder),
}
}
1usize => { Constness::NotConst }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Constness`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for Constness {
#[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 {
Constness::Const { always: ref __binding_0 } =>
0u8.stable_hash(__hcx, __hasher),
Constness::NotConst => 1u8.stable_hash(__hcx, __hasher),
}
match *self {
Constness::Const { always: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Constness::NotConst => {}
}
}
}
};StableHash)]
4545pub enum Constness {
4546 Const { always: bool },
4547 NotConst,
4548}
4549
4550impl Default for Constness {
4553 fn default() -> Self {
4554 Self::Const { always: false }
4555 }
4556}
4557
4558impl fmt::Display for Constness {
4559 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4560 f.write_str(match *self {
4561 Self::Const { always: true } => "comptime",
4562 Self::Const { always: false } => "const",
4563 Self::NotConst => "non-const",
4564 })
4565 }
4566}
4567
4568#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
ImplRestriction<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"ImplRestriction kind span", &self.kind, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ImplRestriction<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
ImplRestriction<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<RestrictionKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
ImplRestriction<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ImplRestriction<'hir> {
#[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 {
ImplRestriction {
kind: ref __binding_0, span: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4569pub struct ImplRestriction<'hir> {
4570 pub kind: RestrictionKind<'hir>,
4571 pub span: Span,
4572}
4573
4574#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for MutRestriction<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"MutRestriction kind span", &self.kind, &&self.span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for MutRestriction<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
MutRestriction<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<RestrictionKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
MutRestriction<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
MutRestriction<'hir> {
#[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 {
MutRestriction {
kind: ref __binding_0, span: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4575pub struct MutRestriction<'hir> {
4576 pub kind: RestrictionKind<'hir>,
4577 pub span: Span,
4578}
4579
4580#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
RestrictionKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Unrestricted =>
::core::fmt::Formatter::write_str(f, "Unrestricted"),
Self::Restricted(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Restricted", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for RestrictionKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
RestrictionKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Path<'hir, DefId>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
RestrictionKind<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
RestrictionKind<'hir> {
#[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 {
RestrictionKind::Unrestricted =>
0u8.stable_hash(__hcx, __hasher),
RestrictionKind::Restricted(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
RestrictionKind::Unrestricted => {}
RestrictionKind::Restricted(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4581pub enum RestrictionKind<'hir> {
4582 Unrestricted,
4584 Restricted(&'hir Path<'hir, DefId>),
4588}
4589
4590#[derive(#[automatically_derived]impl ::core::marker::Copy for HeaderSafety { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for HeaderSafety {
}
#[automatically_derived]impl ::core::clone::Clone for HeaderSafety {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Safety>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for HeaderSafety {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::SafeTargetFeatures =>
::core::fmt::Formatter::write_str(f, "SafeTargetFeatures"),
Self::Normal(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Normal", &__self_0),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for HeaderSafety
{
#[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 {
HeaderSafety::SafeTargetFeatures =>
0u8.stable_hash(__hcx, __hasher),
HeaderSafety::Normal(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
}
match *self {
HeaderSafety::SafeTargetFeatures => {}
HeaderSafety::Normal(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
HeaderSafety {
}
#[automatically_derived]impl ::core::cmp::PartialEq for HeaderSafety {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::Normal(__self_0), Self::Normal(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for HeaderSafety {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<Safety>;
}
}Eq)]
4595pub enum HeaderSafety {
4596 SafeTargetFeatures,
4602 Normal(Safety),
4603}
4604
4605impl From<Safety> for HeaderSafety {
4606 fn from(v: Safety) -> Self {
4607 Self::Normal(v)
4608 }
4609}
4610
4611#[derive(#[automatically_derived]impl ::core::marker::Copy for FnHeader { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for FnHeader {
}
#[automatically_derived]impl ::core::clone::Clone for FnHeader {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<HeaderSafety>;
let _: ::core::clone::AssertParamIsClone<Constness>;
let _: ::core::clone::AssertParamIsClone<IsAsync>;
let _: ::core::clone::AssertParamIsClone<ExternAbi>;
*self
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for FnHeader {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"FnHeader safety constness asyncness abi", &self.safety,
&self.constness, &self.asyncness, &&self.abi)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for FnHeader {
#[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 {
FnHeader {
safety: ref __binding_0,
constness: ref __binding_1,
asyncness: ref __binding_2,
abi: 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)]
4612pub struct FnHeader {
4613 pub safety: HeaderSafety,
4614 pub constness: Constness,
4615 pub asyncness: IsAsync,
4616 pub abi: ExternAbi,
4617}
4618
4619impl FnHeader {
4620 pub fn is_async(&self) -> bool {
4621 #[allow(non_exhaustive_omitted_patterns)] match self.asyncness {
IsAsync::Async(_) => true,
_ => false,
}matches!(self.asyncness, IsAsync::Async(_))
4622 }
4623
4624 pub fn is_unsafe(&self) -> bool {
4625 self.safety().is_unsafe()
4626 }
4627
4628 pub fn is_safe(&self) -> bool {
4629 self.safety().is_safe()
4630 }
4631
4632 pub fn safety(&self) -> Safety {
4633 match self.safety {
4634 HeaderSafety::SafeTargetFeatures => Safety::Unsafe,
4635 HeaderSafety::Normal(safety) => safety,
4636 }
4637 }
4638}
4639
4640#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for TestBinderBody<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TestBinderBody span items", &self.span, &&self.items)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TestBinderBody<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
TestBinderBody<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _:
::core::clone::AssertParamIsClone<&'hir [TestBinderItem<'hir>]>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
TestBinderBody<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TestBinderBody<'hir> {
#[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 {
TestBinderBody {
span: ref __binding_0, items: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4641pub struct TestBinderBody<'hir> {
4642 pub span: Span,
4643 pub items: &'hir [TestBinderItem<'hir>],
4644}
4645
4646#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for TestBinderItem<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Forall(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Forall", &__self_0),
Self::Exists(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Exists", &__self_0),
Self::RegionEquality { lhs: __self_0, rhs: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"RegionEquality lhs rhs", __self_0, &__self_1),
Self::Constraint(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Constraint", &__self_0),
Self::Predicate(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Predicate", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TestBinderItem<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
TestBinderItem<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<TestBinderForall<'hir>>;
let _: ::core::clone::AssertParamIsClone<TestBinderExists<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
let _: ::core::clone::AssertParamIsClone<TestBinderConstraint<'hir>>;
let _: ::core::clone::AssertParamIsClone<WherePredicate<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
TestBinderItem<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TestBinderItem<'hir> {
#[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 {
TestBinderItem::Forall(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
TestBinderItem::Exists(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
TestBinderItem::RegionEquality {
lhs: ref __binding_0, rhs: ref __binding_1 } =>
2u8.stable_hash(__hcx, __hasher),
TestBinderItem::Constraint(ref __binding_0) =>
3u8.stable_hash(__hcx, __hasher),
TestBinderItem::Predicate(ref __binding_0) =>
4u8.stable_hash(__hcx, __hasher),
}
match *self {
TestBinderItem::Forall(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TestBinderItem::Exists(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TestBinderItem::RegionEquality {
lhs: ref __binding_0, rhs: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TestBinderItem::Constraint(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TestBinderItem::Predicate(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4647pub enum TestBinderItem<'hir> {
4648 Forall(TestBinderForall<'hir>),
4649 Exists(TestBinderExists<'hir>),
4650 RegionEquality {
4651 lhs: &'hir Lifetime,
4652 rhs: &'hir Lifetime,
4653 },
4654 Constraint(TestBinderConstraint<'hir>),
4656 Predicate(WherePredicate<'hir>),
4658}
4659#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
TestBinderForall<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"TestBinderForall span generics body assert_on_exit", &self.span,
&self.generics, &self.body, &&self.assert_on_exit)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TestBinderForall<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
TestBinderForall<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir TestBinderBody<'hir>>;
let _:
::core::clone::AssertParamIsClone<Option<&'hir TestBinderConstraint<'hir>>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
TestBinderForall<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TestBinderForall<'hir> {
#[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 {
TestBinderForall {
span: ref __binding_0,
generics: ref __binding_1,
body: ref __binding_2,
assert_on_exit: 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)]
4660pub struct TestBinderForall<'hir> {
4661 pub span: Span,
4662 pub generics: &'hir Generics<'hir>,
4663 pub body: &'hir TestBinderBody<'hir>,
4664 pub assert_on_exit: Option<&'hir TestBinderConstraint<'hir>>,
4665}
4666
4667#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
TestBinderExists<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"TestBinderExists span params body", &self.span, &self.params,
&&self.body)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TestBinderExists<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
TestBinderExists<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir TestBinderBody<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
TestBinderExists<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TestBinderExists<'hir> {
#[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 {
TestBinderExists {
span: ref __binding_0,
params: ref __binding_1,
body: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4668pub struct TestBinderExists<'hir> {
4669 pub span: Span,
4670 pub params: &'hir [GenericParam<'hir>],
4671 pub body: &'hir TestBinderBody<'hir>,
4672}
4673
4674#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
TestBinderConstraint<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::And { items: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"And items", &__self_0),
Self::Or { items: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Or items", &__self_0),
Self::Ambiguity { span: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Ambiguity span", &__self_0),
Self::Lifetime { lhs: __self_0, rhs: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Lifetime lhs rhs", __self_0, &__self_1),
Self::PlaceholderOutlives { lhs: __self_0, rhs: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"PlaceholderOutlives lhs rhs", __self_0, &__self_1),
Self::AliasOutlives { bound_type_constraint: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"AliasOutlives bound_type_constraint", &__self_0),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TestBinderConstraint<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
TestBinderConstraint<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _:
::core::clone::AssertParamIsClone<&'hir [TestBinderConstraint<'hir>]>;
let _:
::core::clone::AssertParamIsClone<&'hir [TestBinderConstraint<'hir>]>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
let _:
::core::clone::AssertParamIsClone<&'hir TestBinderBoundTypeConstraint<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
TestBinderConstraint<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TestBinderConstraint<'hir> {
#[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 {
TestBinderConstraint::And { items: ref __binding_0 } =>
0u8.stable_hash(__hcx, __hasher),
TestBinderConstraint::Or { items: ref __binding_0 } =>
1u8.stable_hash(__hcx, __hasher),
TestBinderConstraint::Ambiguity { span: ref __binding_0 } =>
2u8.stable_hash(__hcx, __hasher),
TestBinderConstraint::Lifetime {
lhs: ref __binding_0, rhs: ref __binding_1 } =>
3u8.stable_hash(__hcx, __hasher),
TestBinderConstraint::PlaceholderOutlives {
lhs: ref __binding_0, rhs: ref __binding_1 } =>
4u8.stable_hash(__hcx, __hasher),
TestBinderConstraint::AliasOutlives {
bound_type_constraint: ref __binding_0 } =>
5u8.stable_hash(__hcx, __hasher),
}
match *self {
TestBinderConstraint::And { items: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TestBinderConstraint::Or { items: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TestBinderConstraint::Ambiguity { span: ref __binding_0 } =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TestBinderConstraint::Lifetime {
lhs: ref __binding_0, rhs: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TestBinderConstraint::PlaceholderOutlives {
lhs: ref __binding_0, rhs: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
TestBinderConstraint::AliasOutlives {
bound_type_constraint: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4675pub enum TestBinderConstraint<'hir> {
4676 And { items: &'hir [TestBinderConstraint<'hir>] },
4677 Or { items: &'hir [TestBinderConstraint<'hir>] },
4678 Ambiguity { span: Span },
4679 Lifetime { lhs: &'hir Lifetime, rhs: &'hir Lifetime },
4680 PlaceholderOutlives { lhs: &'hir Ty<'hir>, rhs: &'hir Lifetime },
4681 AliasOutlives { bound_type_constraint: &'hir TestBinderBoundTypeConstraint<'hir> },
4682}
4683
4684#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
TestBinderBoundTypeConstraint<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"TestBinderBoundTypeConstraint span hir_id params lhs rhs",
&self.span, &self.hir_id, &self.params, &self.lhs, &&self.rhs)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TestBinderBoundTypeConstraint<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
TestBinderBoundTypeConstraint<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<HirId>;
let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
TestBinderBoundTypeConstraint<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TestBinderBoundTypeConstraint<'hir> {
#[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 {
TestBinderBoundTypeConstraint {
span: ref __binding_0,
hir_id: ref __binding_1,
params: ref __binding_2,
lhs: ref __binding_3,
rhs: 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)]
4685pub struct TestBinderBoundTypeConstraint<'hir> {
4686 pub span: Span,
4687 pub hir_id: HirId,
4688 pub params: &'hir [GenericParam<'hir>],
4689 pub lhs: &'hir Ty<'hir>,
4690 pub rhs: &'hir Lifetime,
4691}
4692
4693#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for ItemKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::ExternCrate(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"ExternCrate", __self_0, &__self_1),
Self::Use(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Use",
&__self_0),
Self::Static(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_struct_field4_finish(f,
"Static", __self_0, __self_1, __self_2, &__self_3),
Self::Const(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_struct_field4_finish(f, "Const",
__self_0, __self_1, __self_2, &__self_3),
Self::Fn {
sig: __self_0,
ident: __self_1,
generics: __self_2,
body: __self_3,
has_body: __self_4 } =>
::core::fmt::Formatter::debug_struct_field5_finish(f,
"Fn sig ident generics body has_body", __self_0, __self_1,
__self_2, __self_3, &__self_4),
Self::Macro(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Macro",
__self_0, __self_1, &__self_2),
Self::Mod(__self_0, __self_1) =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Mod",
__self_0, &__self_1),
Self::ForeignMod { abi: __self_0, items: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"ForeignMod abi items", __self_0, &__self_1),
Self::GlobalAsm { asm: __self_0, fake_body: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"GlobalAsm asm fake_body", __self_0, &__self_1),
Self::TyAlias(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"TyAlias", __self_0, __self_1, &__self_2),
Self::Enum(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Enum",
__self_0, __self_1, &__self_2),
Self::Struct(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Struct", __self_0, __self_1, &__self_2),
Self::Union(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Union",
__self_0, __self_1, &__self_2),
Self::Trait {
impl_restriction: __self_0,
constness: __self_1,
is_auto: __self_2,
safety: __self_3,
ident: __self_4,
generics: __self_5,
bounds: __self_6,
items: __self_7 } =>
::core::fmt::Formatter::debug_struct_fields_finish(f,
"Trait impl_restriction constness is_auto safety ident generics bounds items",
&[__self_0, __self_1, __self_2, __self_3, __self_4,
__self_5, __self_6, &__self_7]),
Self::TraitAlias(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_struct_field4_finish(f,
"TraitAlias", __self_0, __self_1, __self_2, &__self_3),
Self::Impl(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Impl",
&__self_0),
Self::TestBinderConstraints { generics: __self_0, body: __self_1 }
=>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TestBinderConstraints generics body", __self_0, &__self_1),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ItemKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for ItemKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Option<Symbol>>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<UseTree<'hir>>;
let _: ::core::clone::AssertParamIsClone<Mutability>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<BodyId>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<ConstItemRhs<'hir>>;
let _: ::core::clone::AssertParamIsClone<FnSig<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<&'hir ast::MacroDef>;
let _: ::core::clone::AssertParamIsClone<MacroKinds>;
let _: ::core::clone::AssertParamIsClone<&'hir Mod<'hir>>;
let _: ::core::clone::AssertParamIsClone<ExternAbi>;
let _: ::core::clone::AssertParamIsClone<&'hir [ForeignItemId]>;
let _: ::core::clone::AssertParamIsClone<&'hir InlineAsm<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<EnumDef<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<VariantData<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<VariantData<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir ImplRestriction<'hir>>;
let _: ::core::clone::AssertParamIsClone<Constness>;
let _: ::core::clone::AssertParamIsClone<IsAuto>;
let _: ::core::clone::AssertParamIsClone<Safety>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [TraitItemId]>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
let _: ::core::clone::AssertParamIsClone<Impl<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir TestBinderBody<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for ItemKind<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ItemKind<'hir> {
#[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 {
ItemKind::ExternCrate(ref __binding_0, ref __binding_1) =>
0u8.stable_hash(__hcx, __hasher),
ItemKind::Use(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
ItemKind::Static(ref __binding_0, ref __binding_1,
ref __binding_2, ref __binding_3) =>
2u8.stable_hash(__hcx, __hasher),
ItemKind::Const(ref __binding_0, ref __binding_1,
ref __binding_2, ref __binding_3) =>
3u8.stable_hash(__hcx, __hasher),
ItemKind::Fn {
sig: ref __binding_0,
ident: ref __binding_1,
generics: ref __binding_2,
body: ref __binding_3,
has_body: ref __binding_4 } =>
4u8.stable_hash(__hcx, __hasher),
ItemKind::Macro(ref __binding_0, ref __binding_1,
ref __binding_2) => 5u8.stable_hash(__hcx, __hasher),
ItemKind::Mod(ref __binding_0, ref __binding_1) =>
6u8.stable_hash(__hcx, __hasher),
ItemKind::ForeignMod {
abi: ref __binding_0, items: ref __binding_1 } =>
7u8.stable_hash(__hcx, __hasher),
ItemKind::GlobalAsm {
asm: ref __binding_0, fake_body: ref __binding_1 } =>
8u8.stable_hash(__hcx, __hasher),
ItemKind::TyAlias(ref __binding_0, ref __binding_1,
ref __binding_2) => 9u8.stable_hash(__hcx, __hasher),
ItemKind::Enum(ref __binding_0, ref __binding_1,
ref __binding_2) => 10u8.stable_hash(__hcx, __hasher),
ItemKind::Struct(ref __binding_0, ref __binding_1,
ref __binding_2) => 11u8.stable_hash(__hcx, __hasher),
ItemKind::Union(ref __binding_0, ref __binding_1,
ref __binding_2) => 12u8.stable_hash(__hcx, __hasher),
ItemKind::Trait {
impl_restriction: ref __binding_0,
constness: ref __binding_1,
is_auto: ref __binding_2,
safety: ref __binding_3,
ident: ref __binding_4,
generics: ref __binding_5,
bounds: ref __binding_6,
items: ref __binding_7 } =>
13u8.stable_hash(__hcx, __hasher),
ItemKind::TraitAlias(ref __binding_0, ref __binding_1,
ref __binding_2, ref __binding_3) =>
14u8.stable_hash(__hcx, __hasher),
ItemKind::Impl(ref __binding_0) =>
15u8.stable_hash(__hcx, __hasher),
ItemKind::TestBinderConstraints {
generics: ref __binding_0, body: ref __binding_1 } =>
16u8.stable_hash(__hcx, __hasher),
}
match *self {
ItemKind::ExternCrate(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ItemKind::Use(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ItemKind::Static(ref __binding_0, ref __binding_1,
ref __binding_2, 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); }
}
ItemKind::Const(ref __binding_0, ref __binding_1,
ref __binding_2, 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); }
}
ItemKind::Fn {
sig: ref __binding_0,
ident: ref __binding_1,
generics: ref __binding_2,
body: ref __binding_3,
has_body: 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); }
}
ItemKind::Macro(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ItemKind::Mod(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ItemKind::ForeignMod {
abi: ref __binding_0, items: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ItemKind::GlobalAsm {
asm: ref __binding_0, fake_body: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
ItemKind::TyAlias(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ItemKind::Enum(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ItemKind::Struct(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ItemKind::Union(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ItemKind::Trait {
impl_restriction: ref __binding_0,
constness: ref __binding_1,
is_auto: ref __binding_2,
safety: ref __binding_3,
ident: ref __binding_4,
generics: ref __binding_5,
bounds: ref __binding_6,
items: ref __binding_7 } => {
{ __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); }
}
ItemKind::TraitAlias(ref __binding_0, ref __binding_1,
ref __binding_2, 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); }
}
ItemKind::Impl(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ItemKind::TestBinderConstraints {
generics: ref __binding_0, body: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4694pub enum ItemKind<'hir> {
4695 ExternCrate(Option<Symbol>, Ident),
4699
4700 Use(UseTree<'hir>),
4706
4707 Static(Mutability, Ident, &'hir Ty<'hir>, BodyId),
4709 Const(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, ConstItemRhs<'hir>),
4711 Fn {
4713 sig: FnSig<'hir>,
4714 ident: Ident,
4715 generics: &'hir Generics<'hir>,
4716 body: BodyId,
4717 has_body: bool,
4721 },
4722 Macro(Ident, &'hir ast::MacroDef, MacroKinds),
4724 Mod(Ident, &'hir Mod<'hir>),
4726 ForeignMod {
4728 abi: ExternAbi,
4729 items: &'hir [ForeignItemId],
4730 },
4731 GlobalAsm {
4733 asm: &'hir InlineAsm<'hir>,
4734 fake_body: BodyId,
4740 },
4741 TyAlias(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
4743 Enum(Ident, &'hir Generics<'hir>, EnumDef<'hir>),
4745 Struct(Ident, &'hir Generics<'hir>, VariantData<'hir>),
4747 Union(Ident, &'hir Generics<'hir>, VariantData<'hir>),
4749 Trait {
4751 impl_restriction: &'hir ImplRestriction<'hir>,
4752 constness: Constness,
4753 is_auto: IsAuto,
4754 safety: Safety,
4755 ident: Ident,
4756 generics: &'hir Generics<'hir>,
4757 bounds: GenericBounds<'hir>,
4758 items: &'hir [TraitItemId],
4759 },
4760 TraitAlias(Constness, Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
4762
4763 Impl(Impl<'hir>),
4765
4766 TestBinderConstraints {
4767 generics: &'hir Generics<'hir>,
4768 body: &'hir TestBinderBody<'hir>,
4769 },
4770}
4771
4772#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for Impl<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"Impl generics of_trait self_ty items constness", &self.generics,
&self.of_trait, &self.self_ty, &self.items, &&self.constness)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Impl<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Impl<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _:
::core::clone::AssertParamIsClone<Option<&'hir TraitImplHeader<'hir>>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [ImplItemId]>;
let _: ::core::clone::AssertParamIsClone<Constness>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for Impl<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Impl<'hir> {
#[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 {
Impl {
generics: ref __binding_0,
of_trait: ref __binding_1,
self_ty: ref __binding_2,
items: ref __binding_3,
constness: 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)]
4777pub struct Impl<'hir> {
4778 pub generics: &'hir Generics<'hir>,
4779 pub of_trait: Option<&'hir TraitImplHeader<'hir>>,
4780 pub self_ty: &'hir Ty<'hir>,
4781 pub items: &'hir [ImplItemId],
4782 pub constness: Constness,
4783}
4784
4785#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
TraitImplHeader<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"TraitImplHeader safety polarity defaultness defaultness_span trait_ref",
&self.safety, &self.polarity, &self.defaultness,
&self.defaultness_span, &&self.trait_ref)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TraitImplHeader<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
TraitImplHeader<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Safety>;
let _: ::core::clone::AssertParamIsClone<ImplPolarity>;
let _: ::core::clone::AssertParamIsClone<Defaultness>;
let _: ::core::clone::AssertParamIsClone<Option<Span>>;
let _: ::core::clone::AssertParamIsClone<TraitRef<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
TraitImplHeader<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TraitImplHeader<'hir> {
#[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 {
TraitImplHeader {
safety: ref __binding_0,
polarity: ref __binding_1,
defaultness: ref __binding_2,
defaultness_span: ref __binding_3,
trait_ref: 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)]
4786pub struct TraitImplHeader<'hir> {
4787 pub safety: Safety,
4788 pub polarity: ImplPolarity,
4789 pub defaultness: Defaultness,
4790 pub defaultness_span: Option<Span>,
4793 pub trait_ref: TraitRef<'hir>,
4794}
4795
4796impl ItemKind<'_> {
4797 pub fn ident(&self) -> Option<Ident> {
4798 match *self {
4799 ItemKind::ExternCrate(_, ident)
4800 | ItemKind::Use(UseTree { kind: UseKind::Single(ident), .. })
4801 | ItemKind::Static(_, ident, ..)
4802 | ItemKind::Const(ident, ..)
4803 | ItemKind::Fn { ident, .. }
4804 | ItemKind::Macro(ident, ..)
4805 | ItemKind::Mod(ident, ..)
4806 | ItemKind::TyAlias(ident, ..)
4807 | ItemKind::Enum(ident, ..)
4808 | ItemKind::Struct(ident, ..)
4809 | ItemKind::Union(ident, ..)
4810 | ItemKind::Trait { ident, .. }
4811 | ItemKind::TraitAlias(_, ident, ..) => Some(ident),
4812
4813 ItemKind::Use(UseTree { kind: UseKind::Glob | UseKind::Nested { .. }, .. })
4814 | ItemKind::ForeignMod { .. }
4815 | ItemKind::GlobalAsm { .. }
4816 | ItemKind::Impl(_)
4817 | ItemKind::TestBinderConstraints { .. } => None,
4818 }
4819 }
4820
4821 pub fn generics(&self) -> Option<&Generics<'_>> {
4822 Some(match self {
4823 ItemKind::Fn { generics, .. }
4824 | ItemKind::TyAlias(_, generics, _)
4825 | ItemKind::Const(_, generics, _, _)
4826 | ItemKind::Enum(_, generics, _)
4827 | ItemKind::Struct(_, generics, _)
4828 | ItemKind::Union(_, generics, _)
4829 | ItemKind::Trait { generics, .. }
4830 | ItemKind::TraitAlias(_, _, generics, _)
4831 | ItemKind::Impl(Impl { generics, .. })
4832 | ItemKind::TestBinderConstraints { generics, .. } => generics,
4833 _ => return None,
4834 })
4835 }
4836
4837 pub fn recovered(&self) -> bool {
4838 match self {
4839 ItemKind::Struct(
4840 _,
4841 _,
4842 VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
4843 ) => true,
4844 ItemKind::Union(
4845 _,
4846 _,
4847 VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
4848 ) => true,
4849 ItemKind::Enum(_, _, def) => def.variants.iter().any(|v| match v.data {
4850 VariantData::Struct { recovered: ast::Recovered::Yes(_), .. } => true,
4851 _ => false,
4852 }),
4853 _ => false,
4854 }
4855 }
4856}
4857
4858#[derive(#[automatically_derived]impl ::core::marker::Copy for ForeignItemId { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for ForeignItemId {
}
#[automatically_derived]impl ::core::clone::Clone for ForeignItemId {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<OwnerId>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
ForeignItemId {
}
#[automatically_derived]impl ::core::cmp::PartialEq for ForeignItemId {
#[inline]
fn eq(&self, other: &Self) -> bool { self.owner_id == other.owner_id }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for ForeignItemId {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<OwnerId>;
}
}Eq, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for ForeignItemId {
fn encode(&self, __encoder: &mut __E) {
let ForeignItemId { owner_id: ref __binding_0 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for ForeignItemId {
fn decode(__decoder: &mut __D) -> Self {
ForeignItemId {
owner_id: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, #[automatically_derived]impl ::core::fmt::Debug for ForeignItemId {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ForeignItemId owner_id", &&self.owner_id)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
ForeignItemId {
#[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 {
ForeignItemId { owner_id: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4862pub struct ForeignItemId {
4863 pub owner_id: OwnerId,
4864}
4865
4866impl ForeignItemId {
4867 #[inline]
4868 pub fn hir_id(&self) -> HirId {
4869 HirId::make_owner(self.owner_id.def_id)
4871 }
4872}
4873
4874#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for ForeignItem<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"ForeignItem ident kind owner_id span vis_span", &self.ident,
&self.kind, &self.owner_id, &self.span, &&self.vis_span)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ForeignItem<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for ForeignItem<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<ForeignItemKind<'hir>>;
let _: ::core::clone::AssertParamIsClone<OwnerId>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for ForeignItem<'hir>
{
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ForeignItem<'hir> {
#[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 {
ForeignItem {
ident: ref __binding_0,
kind: ref __binding_1,
owner_id: ref __binding_2,
span: ref __binding_3,
vis_span: 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)]
4875pub struct ForeignItem<'hir> {
4876 pub ident: Ident,
4877 pub kind: ForeignItemKind<'hir>,
4878 pub owner_id: OwnerId,
4879 pub span: Span,
4880 pub vis_span: Span,
4881}
4882
4883impl ForeignItem<'_> {
4884 #[inline]
4885 pub fn hir_id(&self) -> HirId {
4886 HirId::make_owner(self.owner_id.def_id)
4888 }
4889
4890 pub fn foreign_item_id(&self) -> ForeignItemId {
4891 ForeignItemId { owner_id: self.owner_id }
4892 }
4893}
4894
4895#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for
ForeignItemKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Fn(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Fn",
__self_0, __self_1, &__self_2),
Self::Static(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"Static", __self_0, __self_1, &__self_2),
Self::Type => ::core::fmt::Formatter::write_str(f, "Type"),
}
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for ForeignItemKind<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
ForeignItemKind<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<FnSig<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Param<'hir>]>;
let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<Mutability>;
let _: ::core::clone::AssertParamIsClone<Safety>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
ForeignItemKind<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
ForeignItemKind<'hir> {
#[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 {
ForeignItemKind::Fn(ref __binding_0, ref __binding_1,
ref __binding_2) => 0u8.stable_hash(__hcx, __hasher),
ForeignItemKind::Static(ref __binding_0, ref __binding_1,
ref __binding_2) => 1u8.stable_hash(__hcx, __hasher),
ForeignItemKind::Type => 2u8.stable_hash(__hcx, __hasher),
}
match *self {
ForeignItemKind::Fn(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ForeignItemKind::Static(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ForeignItemKind::Type => {}
}
}
}
};StableHash)]
4897pub enum ForeignItemKind<'hir> {
4898 Fn(FnSig<'hir>, &'hir [Param<'hir>], &'hir Generics<'hir>),
4900 Static(&'hir Ty<'hir>, Mutability, Safety),
4902 Type,
4904}
4905
4906#[derive(#[automatically_derived]impl ::core::fmt::Debug for Upvar {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "Upvar span",
&&self.span)
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for Upvar { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for Upvar {
}
#[automatically_derived]impl ::core::clone::Clone for Upvar {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for Upvar {
#[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 {
Upvar { span: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4908pub struct Upvar {
4909 pub span: Span,
4911}
4912
4913#[derive(#[automatically_derived]impl<'hir> ::core::fmt::Debug for TraitCandidate<'hir>
{
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"TraitCandidate def_id import_ids lint_ambiguous", &self.def_id,
&self.import_ids, &&self.lint_ambiguous)
}
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for TraitCandidate<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for
TraitCandidate<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<DefId>;
let _: ::core::clone::AssertParamIsClone<&'hir [LocalDefId]>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::marker::Copy for
TraitCandidate<'hir> {
}Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
TraitCandidate<'hir> {
#[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 {
TraitCandidate {
def_id: ref __binding_0,
import_ids: ref __binding_1,
lint_ambiguous: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4917pub struct TraitCandidate<'hir> {
4918 pub def_id: DefId,
4919 pub import_ids: &'hir [LocalDefId],
4920 pub lint_ambiguous: bool,
4925}
4926
4927#[derive(#[automatically_derived]impl<'hir> ::core::marker::Copy for OwnerNode<'hir> {
}Copy, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for OwnerNode<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for OwnerNode<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Item<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir ForeignItem<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir TraitItem<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir ImplItem<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Mod<'hir>>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::fmt::Debug for OwnerNode<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Item(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Item",
&__self_0),
Self::ForeignItem(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ForeignItem", &__self_0),
Self::TraitItem(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"TraitItem", &__self_0),
Self::ImplItem(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ImplItem", &__self_0),
Self::Crate(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Crate",
&__self_0),
Self::Synthetic =>
::core::fmt::Formatter::write_str(f, "Synthetic"),
}
}
}Debug, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
OwnerNode<'hir> {
#[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 {
OwnerNode::Item(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
OwnerNode::ForeignItem(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
OwnerNode::TraitItem(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
OwnerNode::ImplItem(ref __binding_0) =>
3u8.stable_hash(__hcx, __hasher),
OwnerNode::Crate(ref __binding_0) =>
4u8.stable_hash(__hcx, __hasher),
OwnerNode::Synthetic => 5u8.stable_hash(__hcx, __hasher),
}
match *self {
OwnerNode::Item(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
OwnerNode::ForeignItem(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
OwnerNode::TraitItem(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
OwnerNode::ImplItem(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
OwnerNode::Crate(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
OwnerNode::Synthetic => {}
}
}
}
};StableHash)]
4928pub enum OwnerNode<'hir> {
4929 Item(&'hir Item<'hir>),
4930 ForeignItem(&'hir ForeignItem<'hir>),
4931 TraitItem(&'hir TraitItem<'hir>),
4932 ImplItem(&'hir ImplItem<'hir>),
4933 Crate(&'hir Mod<'hir>),
4934 Synthetic,
4935}
4936
4937impl<'hir> OwnerNode<'hir> {
4938 pub fn span(&self) -> Span {
4939 match self {
4940 OwnerNode::Item(Item { span, .. })
4941 | OwnerNode::ForeignItem(ForeignItem { span, .. })
4942 | OwnerNode::ImplItem(ImplItem { span, .. })
4943 | OwnerNode::TraitItem(TraitItem { span, .. }) => *span,
4944 OwnerNode::Crate(Mod { spans: ModSpans { inner_span, .. }, .. }) => *inner_span,
4945 OwnerNode::Synthetic => ::core::panicking::unreachable_default_msg()unreachable!(),
4946 }
4947 }
4948
4949 pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
4950 match self {
4951 OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
4952 | OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
4953 | OwnerNode::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
4954 | OwnerNode::ForeignItem(ForeignItem {
4955 kind: ForeignItemKind::Fn(fn_sig, _, _), ..
4956 }) => Some(fn_sig),
4957 _ => None,
4958 }
4959 }
4960
4961 pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
4962 match self {
4963 OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
4964 | OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
4965 | OwnerNode::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
4966 | OwnerNode::ForeignItem(ForeignItem {
4967 kind: ForeignItemKind::Fn(fn_sig, _, _), ..
4968 }) => Some(fn_sig.decl),
4969 _ => None,
4970 }
4971 }
4972
4973 pub fn body_id(&self) -> Option<BodyId> {
4974 match self {
4975 OwnerNode::Item(Item {
4976 kind:
4977 ItemKind::Static(_, _, _, body)
4978 | ItemKind::Const(.., ConstItemRhs::Body(body))
4979 | ItemKind::Fn { body, .. },
4980 ..
4981 })
4982 | OwnerNode::TraitItem(TraitItem {
4983 kind:
4984 TraitItemKind::Fn(_, TraitFn::Provided(body))
4985 | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body))),
4986 ..
4987 })
4988 | OwnerNode::ImplItem(ImplItem {
4989 kind: ImplItemKind::Fn(_, body) | ImplItemKind::Const(_, ConstItemRhs::Body(body)),
4990 ..
4991 }) => Some(*body),
4992 _ => None,
4993 }
4994 }
4995
4996 pub fn generics(self) -> Option<&'hir Generics<'hir>> {
4997 Node::generics(self.into())
4998 }
4999
5000 pub fn def_id(self) -> OwnerId {
5001 match self {
5002 OwnerNode::Item(Item { owner_id, .. })
5003 | OwnerNode::TraitItem(TraitItem { owner_id, .. })
5004 | OwnerNode::ImplItem(ImplItem { owner_id, .. })
5005 | OwnerNode::ForeignItem(ForeignItem { owner_id, .. }) => *owner_id,
5006 OwnerNode::Crate(..) => rustc_hir_id::CRATE_HIR_ID.owner,
5007 OwnerNode::Synthetic => ::core::panicking::unreachable_default_msg()unreachable!(),
5008 }
5009 }
5010
5011 pub fn is_impl_block(&self) -> bool {
5013 #[allow(non_exhaustive_omitted_patterns)] match self {
OwnerNode::Item(Item { kind: ItemKind::Impl(_), .. }) => true,
_ => false,
}matches!(self, OwnerNode::Item(Item { kind: ItemKind::Impl(_), .. }))
5014 }
5015
5016 #[track_caller]
pub fn expect_item(&self) -> &'hir Item<'hir> {
let OwnerNode::Item(n) = self else { expect_failed("expect_item", self) };
n
}
#[track_caller]
pub fn expect_foreign_item(&self) -> &'hir ForeignItem<'hir> {
let OwnerNode::ForeignItem(n) =
self else { expect_failed("expect_foreign_item", self) };
n
}
#[track_caller]
pub fn expect_impl_item(&self) -> &'hir ImplItem<'hir> {
let OwnerNode::ImplItem(n) =
self else { expect_failed("expect_impl_item", self) };
n
}
#[track_caller]
pub fn expect_trait_item(&self) -> &'hir TraitItem<'hir> {
let OwnerNode::TraitItem(n) =
self else { expect_failed("expect_trait_item", self) };
n
}expect_methods_self! {
5017 expect_item, &'hir Item<'hir>, OwnerNode::Item(n), n;
5018 expect_foreign_item, &'hir ForeignItem<'hir>, OwnerNode::ForeignItem(n), n;
5019 expect_impl_item, &'hir ImplItem<'hir>, OwnerNode::ImplItem(n), n;
5020 expect_trait_item, &'hir TraitItem<'hir>, OwnerNode::TraitItem(n), n;
5021 }
5022}
5023
5024impl<'hir> From<&'hir Item<'hir>> for OwnerNode<'hir> {
5025 fn from(val: &'hir Item<'hir>) -> Self {
5026 OwnerNode::Item(val)
5027 }
5028}
5029
5030impl<'hir> From<&'hir ForeignItem<'hir>> for OwnerNode<'hir> {
5031 fn from(val: &'hir ForeignItem<'hir>) -> Self {
5032 OwnerNode::ForeignItem(val)
5033 }
5034}
5035
5036impl<'hir> From<&'hir ImplItem<'hir>> for OwnerNode<'hir> {
5037 fn from(val: &'hir ImplItem<'hir>) -> Self {
5038 OwnerNode::ImplItem(val)
5039 }
5040}
5041
5042impl<'hir> From<&'hir TraitItem<'hir>> for OwnerNode<'hir> {
5043 fn from(val: &'hir TraitItem<'hir>) -> Self {
5044 OwnerNode::TraitItem(val)
5045 }
5046}
5047
5048impl<'hir> From<OwnerNode<'hir>> for Node<'hir> {
5049 fn from(val: OwnerNode<'hir>) -> Self {
5050 match val {
5051 OwnerNode::Item(n) => Node::Item(n),
5052 OwnerNode::ForeignItem(n) => Node::ForeignItem(n),
5053 OwnerNode::ImplItem(n) => Node::ImplItem(n),
5054 OwnerNode::TraitItem(n) => Node::TraitItem(n),
5055 OwnerNode::Crate(n) => Node::Crate(n),
5056 OwnerNode::Synthetic => Node::Synthetic,
5057 }
5058 }
5059}
5060
5061#[derive(#[automatically_derived]impl<'hir> ::core::marker::Copy for Node<'hir> { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl<'hir>
::core::clone::TrivialClone for Node<'hir> {
}
#[automatically_derived]impl<'hir> ::core::clone::Clone for Node<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<&'hir Param<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Item<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir UseTree<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir ForeignItem<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir TraitItem<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir ImplItem<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Variant<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir FieldDef<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir AnonConst>;
let _: ::core::clone::AssertParamIsClone<&'hir ConstBlock>;
let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir ExprField<'hir>>;
let _:
::core::clone::AssertParamIsClone<&'hir ConstArgExprField<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Stmt<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir PathSegment<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _:
::core::clone::AssertParamIsClone<&'hir AssocItemConstraint<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir TraitRef<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir OpaqueTy<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir TyPat<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir PatField<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir PatExpr<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Arm<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Block<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir LetStmt<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir VariantData<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
let _: ::core::clone::AssertParamIsClone<&'hir GenericParam<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Mod<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir InferArg>;
let _: ::core::clone::AssertParamIsClone<&'hir WherePredicate<'hir>>;
let _:
::core::clone::AssertParamIsClone<&'hir PreciseCapturingNonLifetimeArg>;
let _:
::core::clone::AssertParamIsClone<&'hir TestBinderBoundTypeConstraint<'hir>>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]impl<'hir> ::core::fmt::Debug for Node<'hir> {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::Param(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Param",
&__self_0),
Self::Item(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Item",
&__self_0),
Self::NestedUseTree(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"NestedUseTree", &__self_0),
Self::ForeignItem(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ForeignItem", &__self_0),
Self::TraitItem(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"TraitItem", &__self_0),
Self::ImplItem(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ImplItem", &__self_0),
Self::Variant(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Variant", &__self_0),
Self::Field(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Field",
&__self_0),
Self::AnonConst(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"AnonConst", &__self_0),
Self::ConstBlock(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ConstBlock", &__self_0),
Self::ConstArg(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ConstArg", &__self_0),
Self::Expr(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Expr",
&__self_0),
Self::ExprField(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ExprField", &__self_0),
Self::ConstArgExprField(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ConstArgExprField", &__self_0),
Self::Stmt(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Stmt",
&__self_0),
Self::PathSegment(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"PathSegment", &__self_0),
Self::Ty(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Ty",
&__self_0),
Self::AssocItemConstraint(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"AssocItemConstraint", &__self_0),
Self::TraitRef(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"TraitRef", &__self_0),
Self::OpaqueTy(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"OpaqueTy", &__self_0),
Self::TyPat(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "TyPat",
&__self_0),
Self::Pat(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Pat",
&__self_0),
Self::PatField(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"PatField", &__self_0),
Self::PatExpr(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"PatExpr", &__self_0),
Self::Arm(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Arm",
&__self_0),
Self::Block(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Block",
&__self_0),
Self::LetStmt(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"LetStmt", &__self_0),
Self::Ctor(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Ctor",
&__self_0),
Self::Lifetime(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Lifetime", &__self_0),
Self::GenericParam(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"GenericParam", &__self_0),
Self::Crate(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Crate",
&__self_0),
Self::Infer(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Infer",
&__self_0),
Self::WherePredicate(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"WherePredicate", &__self_0),
Self::PreciseCapturingNonLifetimeArg(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"PreciseCapturingNonLifetimeArg", &__self_0),
Self::TestBinderBoundTypeConstraint(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"TestBinderBoundTypeConstraint", &__self_0),
Self::Synthetic =>
::core::fmt::Formatter::write_str(f, "Synthetic"),
Self::Err(__self_0) =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Err",
&__self_0),
}
}
}Debug, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
Node<'hir> {
#[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 {
Node::Param(ref __binding_0) =>
0u8.stable_hash(__hcx, __hasher),
Node::Item(ref __binding_0) =>
1u8.stable_hash(__hcx, __hasher),
Node::NestedUseTree(ref __binding_0) =>
2u8.stable_hash(__hcx, __hasher),
Node::ForeignItem(ref __binding_0) =>
3u8.stable_hash(__hcx, __hasher),
Node::TraitItem(ref __binding_0) =>
4u8.stable_hash(__hcx, __hasher),
Node::ImplItem(ref __binding_0) =>
5u8.stable_hash(__hcx, __hasher),
Node::Variant(ref __binding_0) =>
6u8.stable_hash(__hcx, __hasher),
Node::Field(ref __binding_0) =>
7u8.stable_hash(__hcx, __hasher),
Node::AnonConst(ref __binding_0) =>
8u8.stable_hash(__hcx, __hasher),
Node::ConstBlock(ref __binding_0) =>
9u8.stable_hash(__hcx, __hasher),
Node::ConstArg(ref __binding_0) =>
10u8.stable_hash(__hcx, __hasher),
Node::Expr(ref __binding_0) =>
11u8.stable_hash(__hcx, __hasher),
Node::ExprField(ref __binding_0) =>
12u8.stable_hash(__hcx, __hasher),
Node::ConstArgExprField(ref __binding_0) =>
13u8.stable_hash(__hcx, __hasher),
Node::Stmt(ref __binding_0) =>
14u8.stable_hash(__hcx, __hasher),
Node::PathSegment(ref __binding_0) =>
15u8.stable_hash(__hcx, __hasher),
Node::Ty(ref __binding_0) =>
16u8.stable_hash(__hcx, __hasher),
Node::AssocItemConstraint(ref __binding_0) =>
17u8.stable_hash(__hcx, __hasher),
Node::TraitRef(ref __binding_0) =>
18u8.stable_hash(__hcx, __hasher),
Node::OpaqueTy(ref __binding_0) =>
19u8.stable_hash(__hcx, __hasher),
Node::TyPat(ref __binding_0) =>
20u8.stable_hash(__hcx, __hasher),
Node::Pat(ref __binding_0) =>
21u8.stable_hash(__hcx, __hasher),
Node::PatField(ref __binding_0) =>
22u8.stable_hash(__hcx, __hasher),
Node::PatExpr(ref __binding_0) =>
23u8.stable_hash(__hcx, __hasher),
Node::Arm(ref __binding_0) =>
24u8.stable_hash(__hcx, __hasher),
Node::Block(ref __binding_0) =>
25u8.stable_hash(__hcx, __hasher),
Node::LetStmt(ref __binding_0) =>
26u8.stable_hash(__hcx, __hasher),
Node::Ctor(ref __binding_0) =>
27u8.stable_hash(__hcx, __hasher),
Node::Lifetime(ref __binding_0) =>
28u8.stable_hash(__hcx, __hasher),
Node::GenericParam(ref __binding_0) =>
29u8.stable_hash(__hcx, __hasher),
Node::Crate(ref __binding_0) =>
30u8.stable_hash(__hcx, __hasher),
Node::Infer(ref __binding_0) =>
31u8.stable_hash(__hcx, __hasher),
Node::WherePredicate(ref __binding_0) =>
32u8.stable_hash(__hcx, __hasher),
Node::PreciseCapturingNonLifetimeArg(ref __binding_0) =>
33u8.stable_hash(__hcx, __hasher),
Node::TestBinderBoundTypeConstraint(ref __binding_0) =>
34u8.stable_hash(__hcx, __hasher),
Node::Synthetic => 35u8.stable_hash(__hcx, __hasher),
Node::Err(ref __binding_0) =>
36u8.stable_hash(__hcx, __hasher),
}
match *self {
Node::Param(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Item(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::NestedUseTree(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::ForeignItem(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::TraitItem(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::ImplItem(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Variant(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Field(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::AnonConst(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::ConstBlock(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::ConstArg(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Expr(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::ExprField(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::ConstArgExprField(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Stmt(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::PathSegment(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Ty(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::AssocItemConstraint(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::TraitRef(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::OpaqueTy(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::TyPat(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Pat(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::PatField(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::PatExpr(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Arm(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Block(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::LetStmt(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Ctor(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Lifetime(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::GenericParam(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Crate(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Infer(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::WherePredicate(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::PreciseCapturingNonLifetimeArg(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::TestBinderBoundTypeConstraint(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::Synthetic => {}
Node::Err(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
5062pub enum Node<'hir> {
5063 Param(&'hir Param<'hir>),
5064 Item(&'hir Item<'hir>),
5065 NestedUseTree(&'hir UseTree<'hir>),
5066 ForeignItem(&'hir ForeignItem<'hir>),
5067 TraitItem(&'hir TraitItem<'hir>),
5068 ImplItem(&'hir ImplItem<'hir>),
5069 Variant(&'hir Variant<'hir>),
5070 Field(&'hir FieldDef<'hir>),
5071 AnonConst(&'hir AnonConst),
5072 ConstBlock(&'hir ConstBlock),
5073 ConstArg(&'hir ConstArg<'hir>),
5074 Expr(&'hir Expr<'hir>),
5075 ExprField(&'hir ExprField<'hir>),
5076 ConstArgExprField(&'hir ConstArgExprField<'hir>),
5077 Stmt(&'hir Stmt<'hir>),
5078 PathSegment(&'hir PathSegment<'hir>),
5079 Ty(&'hir Ty<'hir>),
5080 AssocItemConstraint(&'hir AssocItemConstraint<'hir>),
5081 TraitRef(&'hir TraitRef<'hir>),
5082 OpaqueTy(&'hir OpaqueTy<'hir>),
5083 TyPat(&'hir TyPat<'hir>),
5084 Pat(&'hir Pat<'hir>),
5085 PatField(&'hir PatField<'hir>),
5086 PatExpr(&'hir PatExpr<'hir>),
5090 Arm(&'hir Arm<'hir>),
5091 Block(&'hir Block<'hir>),
5092 LetStmt(&'hir LetStmt<'hir>),
5093 Ctor(&'hir VariantData<'hir>),
5096 Lifetime(&'hir Lifetime),
5097 GenericParam(&'hir GenericParam<'hir>),
5098 Crate(&'hir Mod<'hir>),
5099 Infer(&'hir InferArg),
5100 WherePredicate(&'hir WherePredicate<'hir>),
5101 PreciseCapturingNonLifetimeArg(&'hir PreciseCapturingNonLifetimeArg),
5102 TestBinderBoundTypeConstraint(&'hir TestBinderBoundTypeConstraint<'hir>),
5103 Synthetic,
5105 Err(Span),
5106}
5107
5108impl<'hir> Node<'hir> {
5109 pub fn ident(&self) -> Option<Ident> {
5124 match self {
5125 Node::Item(item) => item.kind.ident(),
5126 Node::TraitItem(TraitItem { ident, .. })
5127 | Node::ImplItem(ImplItem { ident, .. })
5128 | Node::ForeignItem(ForeignItem { ident, .. })
5129 | Node::NestedUseTree(UseTree { kind: UseKind::Single(ident), .. })
5130 | Node::Field(FieldDef { ident, .. })
5131 | Node::Variant(Variant { ident, .. })
5132 | Node::PathSegment(PathSegment { ident, .. }) => Some(*ident),
5133 Node::Lifetime(lt) => Some(lt.ident),
5134 Node::GenericParam(p) => Some(p.name.ident()),
5135 Node::AssocItemConstraint(c) => Some(c.ident),
5136 Node::PatField(f) => Some(f.ident),
5137 Node::ExprField(f) => Some(f.ident),
5138 Node::ConstArgExprField(f) => Some(f.field),
5139 Node::PreciseCapturingNonLifetimeArg(a) => Some(a.ident),
5140 Node::Param(..)
5141 | Node::AnonConst(..)
5142 | Node::ConstBlock(..)
5143 | Node::ConstArg(..)
5144 | Node::Expr(..)
5145 | Node::Stmt(..)
5146 | Node::Block(..)
5147 | Node::Ctor(..)
5148 | Node::Pat(..)
5149 | Node::TyPat(..)
5150 | Node::PatExpr(..)
5151 | Node::Arm(..)
5152 | Node::LetStmt(..)
5153 | Node::Crate(..)
5154 | Node::Ty(..)
5155 | Node::TraitRef(..)
5156 | Node::OpaqueTy(..)
5157 | Node::NestedUseTree(_)
5158 | Node::Infer(..)
5159 | Node::WherePredicate(..)
5160 | Node::TestBinderBoundTypeConstraint(..)
5161 | Node::Synthetic
5162 | Node::Err(..) => None,
5163 }
5164 }
5165
5166 pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
5167 match self {
5168 Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
5169 | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
5170 | Node::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
5171 | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_sig, _, _), .. }) => {
5172 Some(fn_sig.decl)
5173 }
5174 Node::Expr(Expr { kind: ExprKind::Closure(Closure { fn_decl, .. }), .. }) => {
5175 Some(fn_decl)
5176 }
5177 _ => None,
5178 }
5179 }
5180
5181 pub fn impl_block_of_trait(self, trait_def_id: DefId) -> Option<&'hir Impl<'hir>> {
5183 if let Node::Item(Item { kind: ItemKind::Impl(impl_block), .. }) = self
5184 && let Some(of_trait) = impl_block.of_trait
5185 && let Some(trait_id) = of_trait.trait_ref.trait_def_id()
5186 && trait_id == trait_def_id
5187 {
5188 Some(impl_block)
5189 } else {
5190 None
5191 }
5192 }
5193
5194 pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
5195 match self {
5196 Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
5197 | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
5198 | Node::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
5199 | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_sig, _, _), .. }) => {
5200 Some(fn_sig)
5201 }
5202 _ => None,
5203 }
5204 }
5205
5206 pub fn ty(self) -> Option<&'hir Ty<'hir>> {
5208 match self {
5209 Node::Item(it) => match it.kind {
5210 ItemKind::TyAlias(_, _, ty)
5211 | ItemKind::Static(_, _, ty, _)
5212 | ItemKind::Const(_, _, ty, _) => Some(ty),
5213 ItemKind::Impl(impl_item) => Some(&impl_item.self_ty),
5214 _ => None,
5215 },
5216 Node::TraitItem(it) => match it.kind {
5217 TraitItemKind::Const(ty, _) => Some(ty),
5218 TraitItemKind::Type(_, ty) => ty,
5219 _ => None,
5220 },
5221 Node::ImplItem(it) => match it.kind {
5222 ImplItemKind::Const(ty, _) => Some(ty),
5223 ImplItemKind::Type(ty) => Some(ty),
5224 _ => None,
5225 },
5226 Node::ForeignItem(it) => match it.kind {
5227 ForeignItemKind::Static(ty, ..) => Some(ty),
5228 _ => None,
5229 },
5230 Node::GenericParam(param) => match param.kind {
5231 GenericParamKind::Lifetime { .. } => None,
5232 GenericParamKind::Type { default, .. } => default,
5233 GenericParamKind::Const { ty, .. } => Some(ty),
5234 },
5235 Node::Field(f) => Some(f.ty),
5236 _ => None,
5237 }
5238 }
5239
5240 pub fn alias_ty(self) -> Option<&'hir Ty<'hir>> {
5241 match self {
5242 Node::Item(Item { kind: ItemKind::TyAlias(_, _, ty), .. }) => Some(ty),
5243 _ => None,
5244 }
5245 }
5246
5247 #[inline]
5248 pub fn associated_body(&self) -> Option<(LocalDefId, BodyId)> {
5249 match self {
5250 Node::Item(Item {
5251 owner_id,
5252 kind:
5253 ItemKind::Const(.., ConstItemRhs::Body(body))
5254 | ItemKind::Static(.., body)
5255 | ItemKind::Fn { body, .. },
5256 ..
5257 })
5258 | Node::TraitItem(TraitItem {
5259 owner_id,
5260 kind:
5261 TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)))
5262 | TraitItemKind::Fn(_, TraitFn::Provided(body)),
5263 ..
5264 })
5265 | Node::ImplItem(ImplItem {
5266 owner_id,
5267 kind: ImplItemKind::Const(.., ConstItemRhs::Body(body)) | ImplItemKind::Fn(_, body),
5268 ..
5269 }) => Some((owner_id.def_id, *body)),
5270
5271 Node::Item(Item {
5272 owner_id, kind: ItemKind::GlobalAsm { asm: _, fake_body }, ..
5273 }) => Some((owner_id.def_id, *fake_body)),
5274
5275 Node::Expr(Expr { kind: ExprKind::Closure(Closure { def_id, body, .. }), .. }) => {
5276 Some((*def_id, *body))
5277 }
5278
5279 Node::AnonConst(constant) => Some((constant.def_id, constant.body)),
5280 Node::ConstBlock(constant) => Some((constant.def_id, constant.body)),
5281
5282 _ => None,
5283 }
5284 }
5285
5286 pub fn body_id(&self) -> Option<BodyId> {
5287 Some(self.associated_body()?.1)
5288 }
5289
5290 pub fn generics(self) -> Option<&'hir Generics<'hir>> {
5291 match self {
5292 Node::ForeignItem(ForeignItem {
5293 kind: ForeignItemKind::Fn(_, _, generics), ..
5294 })
5295 | Node::TraitItem(TraitItem { generics, .. })
5296 | Node::ImplItem(ImplItem { generics, .. }) => Some(generics),
5297 Node::Item(item) => item.kind.generics(),
5298 _ => None,
5299 }
5300 }
5301
5302 pub fn as_owner(self) -> Option<OwnerNode<'hir>> {
5303 match self {
5304 Node::Item(i) => Some(OwnerNode::Item(i)),
5305 Node::ForeignItem(i) => Some(OwnerNode::ForeignItem(i)),
5306 Node::TraitItem(i) => Some(OwnerNode::TraitItem(i)),
5307 Node::ImplItem(i) => Some(OwnerNode::ImplItem(i)),
5308 Node::Crate(i) => Some(OwnerNode::Crate(i)),
5309 Node::Synthetic => Some(OwnerNode::Synthetic),
5310 _ => None,
5311 }
5312 }
5313
5314 pub fn fn_kind(self) -> Option<FnKind<'hir>> {
5315 match self {
5316 Node::Item(i) => match i.kind {
5317 ItemKind::Fn { ident, sig, generics, .. } => {
5318 Some(FnKind::ItemFn(ident, generics, sig.header))
5319 }
5320 _ => None,
5321 },
5322 Node::TraitItem(ti) => match ti.kind {
5323 TraitItemKind::Fn(ref sig, _) => Some(FnKind::Method(ti.ident, sig)),
5324 _ => None,
5325 },
5326 Node::ImplItem(ii) => match ii.kind {
5327 ImplItemKind::Fn(ref sig, _) => Some(FnKind::Method(ii.ident, sig)),
5328 _ => None,
5329 },
5330 Node::Expr(e) => match e.kind {
5331 ExprKind::Closure { .. } => Some(FnKind::Closure),
5332 _ => None,
5333 },
5334 _ => None,
5335 }
5336 }
5337
5338 pub fn path(self) -> Option<&'hir QPath<'hir>> {
5340 match self {
5341 Node::Ty(Ty { kind: TyKind::Path(path), .. })
5342 | Node::Expr(Expr {
5343 kind: ExprKind::Path(path) | ExprKind::RawHandle(PlaceExpr { path, .. }),
5344 ..
5345 })
5346 | Node::PatExpr(PatExpr { kind: PatExprKind::Path(path), .. }) => Some(path),
5347 _ => None,
5348 }
5349 }
5350
5351 #[track_caller]
pub fn expect_param(&self) -> &'hir Param<'hir> {
let Node::Param(n) = self else { expect_failed("expect_param", self) };
n
}
#[track_caller]
pub fn expect_item(&self) -> &'hir Item<'hir> {
let Node::Item(n) = self else { expect_failed("expect_item", self) };
n
}
#[track_caller]
pub fn expect_foreign_item(&self) -> &'hir ForeignItem<'hir> {
let Node::ForeignItem(n) =
self else { expect_failed("expect_foreign_item", self) };
n
}
#[track_caller]
pub fn expect_trait_item(&self) -> &'hir TraitItem<'hir> {
let Node::TraitItem(n) =
self else { expect_failed("expect_trait_item", self) };
n
}
#[track_caller]
pub fn expect_impl_item(&self) -> &'hir ImplItem<'hir> {
let Node::ImplItem(n) =
self else { expect_failed("expect_impl_item", self) };
n
}
#[track_caller]
pub fn expect_variant(&self) -> &'hir Variant<'hir> {
let Node::Variant(n) =
self else { expect_failed("expect_variant", self) };
n
}
#[track_caller]
pub fn expect_field(&self) -> &'hir FieldDef<'hir> {
let Node::Field(n) = self else { expect_failed("expect_field", self) };
n
}
#[track_caller]
pub fn expect_anon_const(&self) -> &'hir AnonConst {
let Node::AnonConst(n) =
self else { expect_failed("expect_anon_const", self) };
n
}
#[track_caller]
pub fn expect_inline_const(&self) -> &'hir ConstBlock {
let Node::ConstBlock(n) =
self else { expect_failed("expect_inline_const", self) };
n
}
#[track_caller]
pub fn expect_expr(&self) -> &'hir Expr<'hir> {
let Node::Expr(n) = self else { expect_failed("expect_expr", self) };
n
}
#[track_caller]
pub fn expect_expr_field(&self) -> &'hir ExprField<'hir> {
let Node::ExprField(n) =
self else { expect_failed("expect_expr_field", self) };
n
}
#[track_caller]
pub fn expect_stmt(&self) -> &'hir Stmt<'hir> {
let Node::Stmt(n) = self else { expect_failed("expect_stmt", self) };
n
}
#[track_caller]
pub fn expect_path_segment(&self) -> &'hir PathSegment<'hir> {
let Node::PathSegment(n) =
self else { expect_failed("expect_path_segment", self) };
n
}
#[track_caller]
pub fn expect_ty(&self) -> &'hir Ty<'hir> {
let Node::Ty(n) = self else { expect_failed("expect_ty", self) };
n
}
#[track_caller]
pub fn expect_assoc_item_constraint(&self)
-> &'hir AssocItemConstraint<'hir> {
let Node::AssocItemConstraint(n) =
self else { expect_failed("expect_assoc_item_constraint", self) };
n
}
#[track_caller]
pub fn expect_trait_ref(&self) -> &'hir TraitRef<'hir> {
let Node::TraitRef(n) =
self else { expect_failed("expect_trait_ref", self) };
n
}
#[track_caller]
pub fn expect_opaque_ty(&self) -> &'hir OpaqueTy<'hir> {
let Node::OpaqueTy(n) =
self else { expect_failed("expect_opaque_ty", self) };
n
}
#[track_caller]
pub fn expect_pat(&self) -> &'hir Pat<'hir> {
let Node::Pat(n) = self else { expect_failed("expect_pat", self) };
n
}
#[track_caller]
pub fn expect_pat_field(&self) -> &'hir PatField<'hir> {
let Node::PatField(n) =
self else { expect_failed("expect_pat_field", self) };
n
}
#[track_caller]
pub fn expect_arm(&self) -> &'hir Arm<'hir> {
let Node::Arm(n) = self else { expect_failed("expect_arm", self) };
n
}
#[track_caller]
pub fn expect_block(&self) -> &'hir Block<'hir> {
let Node::Block(n) = self else { expect_failed("expect_block", self) };
n
}
#[track_caller]
pub fn expect_let_stmt(&self) -> &'hir LetStmt<'hir> {
let Node::LetStmt(n) =
self else { expect_failed("expect_let_stmt", self) };
n
}
#[track_caller]
pub fn expect_ctor(&self) -> &'hir VariantData<'hir> {
let Node::Ctor(n) = self else { expect_failed("expect_ctor", self) };
n
}
#[track_caller]
pub fn expect_lifetime(&self) -> &'hir Lifetime {
let Node::Lifetime(n) =
self else { expect_failed("expect_lifetime", self) };
n
}
#[track_caller]
pub fn expect_generic_param(&self) -> &'hir GenericParam<'hir> {
let Node::GenericParam(n) =
self else { expect_failed("expect_generic_param", self) };
n
}
#[track_caller]
pub fn expect_crate(&self) -> &'hir Mod<'hir> {
let Node::Crate(n) = self else { expect_failed("expect_crate", self) };
n
}
#[track_caller]
pub fn expect_infer(&self) -> &'hir InferArg {
let Node::Infer(n) = self else { expect_failed("expect_infer", self) };
n
}
#[track_caller]
pub fn expect_closure(&self) -> &'hir Closure<'hir> {
let Node::Expr(Expr { kind: ExprKind::Closure(n), .. }) =
self else { expect_failed("expect_closure", self) };
n
}expect_methods_self! {
5352 expect_param, &'hir Param<'hir>, Node::Param(n), n;
5353 expect_item, &'hir Item<'hir>, Node::Item(n), n;
5354 expect_foreign_item, &'hir ForeignItem<'hir>, Node::ForeignItem(n), n;
5355 expect_trait_item, &'hir TraitItem<'hir>, Node::TraitItem(n), n;
5356 expect_impl_item, &'hir ImplItem<'hir>, Node::ImplItem(n), n;
5357 expect_variant, &'hir Variant<'hir>, Node::Variant(n), n;
5358 expect_field, &'hir FieldDef<'hir>, Node::Field(n), n;
5359 expect_anon_const, &'hir AnonConst, Node::AnonConst(n), n;
5360 expect_inline_const, &'hir ConstBlock, Node::ConstBlock(n), n;
5361 expect_expr, &'hir Expr<'hir>, Node::Expr(n), n;
5362 expect_expr_field, &'hir ExprField<'hir>, Node::ExprField(n), n;
5363 expect_stmt, &'hir Stmt<'hir>, Node::Stmt(n), n;
5364 expect_path_segment, &'hir PathSegment<'hir>, Node::PathSegment(n), n;
5365 expect_ty, &'hir Ty<'hir>, Node::Ty(n), n;
5366 expect_assoc_item_constraint, &'hir AssocItemConstraint<'hir>, Node::AssocItemConstraint(n), n;
5367 expect_trait_ref, &'hir TraitRef<'hir>, Node::TraitRef(n), n;
5368 expect_opaque_ty, &'hir OpaqueTy<'hir>, Node::OpaqueTy(n), n;
5369 expect_pat, &'hir Pat<'hir>, Node::Pat(n), n;
5370 expect_pat_field, &'hir PatField<'hir>, Node::PatField(n), n;
5371 expect_arm, &'hir Arm<'hir>, Node::Arm(n), n;
5372 expect_block, &'hir Block<'hir>, Node::Block(n), n;
5373 expect_let_stmt, &'hir LetStmt<'hir>, Node::LetStmt(n), n;
5374 expect_ctor, &'hir VariantData<'hir>, Node::Ctor(n), n;
5375 expect_lifetime, &'hir Lifetime, Node::Lifetime(n), n;
5376 expect_generic_param, &'hir GenericParam<'hir>, Node::GenericParam(n), n;
5377 expect_crate, &'hir Mod<'hir>, Node::Crate(n), n;
5378 expect_infer, &'hir InferArg, Node::Infer(n), n;
5379 expect_closure, &'hir Closure<'hir>, Node::Expr(Expr { kind: ExprKind::Closure(n), .. }), n;
5380 }
5381}
5382
5383#[cfg(target_pointer_width = "64")]
5385mod size_asserts {
5386 use rustc_data_structures::static_assert_size;
5387
5388 use super::*;
5389 const _: [(); 48] = [(); ::std::mem::size_of::<Block<'_>>()];static_assert_size!(Block<'_>, 48);
5391 const _: [(); 24] = [(); ::std::mem::size_of::<Body<'_>>()];static_assert_size!(Body<'_>, 24);
5392 const _: [(); 64] = [(); ::std::mem::size_of::<Expr<'_>>()];static_assert_size!(Expr<'_>, 64);
5393 const _: [(); 48] = [(); ::std::mem::size_of::<ExprKind<'_>>()];static_assert_size!(ExprKind<'_>, 48);
5394 const _: [(); 40] = [(); ::std::mem::size_of::<FnDecl<'_>>()];static_assert_size!(FnDecl<'_>, 40);
5395 const _: [(); 88] = [(); ::std::mem::size_of::<ForeignItem<'_>>()];static_assert_size!(ForeignItem<'_>, 88);
5396 const _: [(); 56] = [(); ::std::mem::size_of::<ForeignItemKind<'_>>()];static_assert_size!(ForeignItemKind<'_>, 56);
5397 const _: [(); 16] = [(); ::std::mem::size_of::<GenericArg<'_>>()];static_assert_size!(GenericArg<'_>, 16);
5398 const _: [(); 64] = [(); ::std::mem::size_of::<GenericBound<'_>>()];static_assert_size!(GenericBound<'_>, 64);
5399 const _: [(); 56] = [(); ::std::mem::size_of::<Generics<'_>>()];static_assert_size!(Generics<'_>, 56);
5400 const _: [(); 48] = [(); ::std::mem::size_of::<Impl<'_>>()];static_assert_size!(Impl<'_>, 48);
5401 const _: [(); 88] = [(); ::std::mem::size_of::<ImplItem<'_>>()];static_assert_size!(ImplItem<'_>, 88);
5402 const _: [(); 40] = [(); ::std::mem::size_of::<ImplItemKind<'_>>()];static_assert_size!(ImplItemKind<'_>, 40);
5403 const _: [(); 88] = [(); ::std::mem::size_of::<Item<'_>>()];static_assert_size!(Item<'_>, 88);
5404 const _: [(); 64] = [(); ::std::mem::size_of::<ItemKind<'_>>()];static_assert_size!(ItemKind<'_>, 64);
5405 const _: [(); 64] = [(); ::std::mem::size_of::<LetStmt<'_>>()];static_assert_size!(LetStmt<'_>, 64);
5406 const _: [(); 32] = [(); ::std::mem::size_of::<Param<'_>>()];static_assert_size!(Param<'_>, 32);
5407 const _: [(); 80] = [(); ::std::mem::size_of::<Pat<'_>>()];static_assert_size!(Pat<'_>, 80);
5408 const _: [(); 56] = [(); ::std::mem::size_of::<PatKind<'_>>()];static_assert_size!(PatKind<'_>, 56);
5409 const _: [(); 40] = [(); ::std::mem::size_of::<Path<'_>>()];static_assert_size!(Path<'_>, 40);
5410 const _: [(); 48] = [(); ::std::mem::size_of::<PathSegment<'_>>()];static_assert_size!(PathSegment<'_>, 48);
5411 const _: [(); 48] = [(); ::std::mem::size_of::<PlaceExpr<'_>>()];static_assert_size!(PlaceExpr<'_>, 48);
5412 const _: [(); 20] = [(); ::std::mem::size_of::<PlaceExprKind>()];static_assert_size!(PlaceExprKind, 20);
5413 const _: [(); 24] = [(); ::std::mem::size_of::<QPath<'_>>()];static_assert_size!(QPath<'_>, 24);
5414 const _: [(); 12] = [(); ::std::mem::size_of::<Res>()];static_assert_size!(Res, 12);
5415 const _: [(); 32] = [(); ::std::mem::size_of::<Stmt<'_>>()];static_assert_size!(Stmt<'_>, 32);
5416 const _: [(); 16] = [(); ::std::mem::size_of::<StmtKind<'_>>()];static_assert_size!(StmtKind<'_>, 16);
5417 const _: [(); 48] = [(); ::std::mem::size_of::<TraitImplHeader<'_>>()];static_assert_size!(TraitImplHeader<'_>, 48);
5418 const _: [(); 88] = [(); ::std::mem::size_of::<TraitItem<'_>>()];static_assert_size!(TraitItem<'_>, 88);
5419 const _: [(); 48] = [(); ::std::mem::size_of::<TraitItemKind<'_>>()];static_assert_size!(TraitItemKind<'_>, 48);
5420 const _: [(); 48] = [(); ::std::mem::size_of::<Ty<'_>>()];static_assert_size!(Ty<'_>, 48);
5421 const _: [(); 32] = [(); ::std::mem::size_of::<TyKind<'_>>()];static_assert_size!(TyKind<'_>, 32);
5422 }
5424
5425#[cfg(test)]
5426mod tests;