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::InlineAsmRegOrRegClass;
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]
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]
fn clone(&self) -> AngleBrackets { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for AngleBrackets { }
#[automatically_derived]
impl ::core::cmp::PartialEq for AngleBrackets {
#[inline]
fn eq(&self, other: &AngleBrackets) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for AngleBrackets {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}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) {
::std::mem::discriminant(self).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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
LifetimeSource::Reference =>
::core::fmt::Formatter::write_str(f, "Reference"),
LifetimeSource::Path { angle_brackets: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Path",
"angle_brackets", &__self_0),
LifetimeSource::OutlivesBound =>
::core::fmt::Formatter::write_str(f, "OutlivesBound"),
LifetimeSource::PreciseCapturing =>
::core::fmt::Formatter::write_str(f, "PreciseCapturing"),
LifetimeSource::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]
fn clone(&self) -> LifetimeSource {
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: &LifetimeSource) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(LifetimeSource::Path { angle_brackets: __self_0 },
LifetimeSource::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) {
::std::mem::discriminant(self).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]
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]
fn clone(&self) -> LifetimeSyntax { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for LifetimeSyntax { }
#[automatically_derived]
impl ::core::cmp::PartialEq for LifetimeSyntax {
#[inline]
fn eq(&self, other: &LifetimeSyntax) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for LifetimeSyntax {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}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) {
::std::mem::discriminant(self).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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "Lifetime",
"hir_id", &self.hir_id, "ident", &self.ident, "kind", &self.kind,
"source", &self.source, "syntax", &&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]
fn clone(&self) -> Lifetime {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ParamName::Plain(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Plain",
&__self_0),
ParamName::Error(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Error",
&__self_0),
ParamName::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]
fn clone(&self) -> ParamName {
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) {
::std::mem::discriminant(self).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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
LifetimeKind::Param(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Param",
&__self_0),
LifetimeKind::ImplicitObjectLifetimeDefault =>
::core::fmt::Formatter::write_str(f,
"ImplicitObjectLifetimeDefault"),
LifetimeKind::Error(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Error",
&__self_0),
LifetimeKind::Infer =>
::core::fmt::Formatter::write_str(f, "Infer"),
LifetimeKind::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]
fn clone(&self) -> LifetimeKind {
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: &LifetimeKind) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(LifetimeKind::Param(__self_0), LifetimeKind::Param(__arg1_0))
=> __self_0 == __arg1_0,
(LifetimeKind::Error(__self_0), LifetimeKind::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) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state);
match self {
LifetimeKind::Param(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
LifetimeKind::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) {
::std::mem::discriminant(self).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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "Path", "span",
&self.span, "res", &self.res, "segments", &&self.segments)
}
}Debug, #[automatically_derived]
impl<'hir, R: ::core::clone::Clone> ::core::clone::Clone for Path<'hir, R> {
#[inline]
fn clone(&self) -> Path<'hir, R> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["ident", "hir_id", "res", "args", "infer_args",
"delegation_child_segment"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.ident, &self.hir_id, &self.res, &self.args,
&self.infer_args, &&self.delegation_child_segment];
::core::fmt::Formatter::debug_struct_fields_finish(f, "PathSegment",
names, values)
}
}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]
fn clone(&self) -> PathSegment<'hir> {
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]
fn clone(&self) -> ConstItemRhs<'hir> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ConstItemRhs::Body(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Body",
&__self_0),
ConstItemRhs::Direct(__self_0) =>
::core::fmt::Formatter::debug_tuple_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) {
::std::mem::discriminant(self).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]
fn clone(&self) -> ConstArg<'hir, Unambig> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "ConstArg",
"hir_id", &self.hir_id, "kind", &self.kind, "span", &&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]
fn clone(&self) -> ConstArgKind<'hir, Unambig> {
match self {
ConstArgKind::Tup(__self_0) =>
ConstArgKind::Tup(::core::clone::Clone::clone(__self_0)),
ConstArgKind::Path(__self_0) =>
ConstArgKind::Path(::core::clone::Clone::clone(__self_0)),
ConstArgKind::Anon(__self_0) =>
ConstArgKind::Anon(::core::clone::Clone::clone(__self_0)),
ConstArgKind::Struct(__self_0, __self_1) =>
ConstArgKind::Struct(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
ConstArgKind::TupleCall(__self_0, __self_1) =>
ConstArgKind::TupleCall(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
ConstArgKind::Array(__self_0) =>
ConstArgKind::Array(::core::clone::Clone::clone(__self_0)),
ConstArgKind::Error(__self_0) =>
ConstArgKind::Error(::core::clone::Clone::clone(__self_0)),
ConstArgKind::Infer(__self_0) =>
ConstArgKind::Infer(::core::clone::Clone::clone(__self_0)),
ConstArgKind::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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ConstArgKind::Tup(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Tup",
&__self_0),
ConstArgKind::Path(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Path",
&__self_0),
ConstArgKind::Anon(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Anon",
&__self_0),
ConstArgKind::Struct(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Struct",
__self_0, &__self_1),
ConstArgKind::TupleCall(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f,
"TupleCall", __self_0, &__self_1),
ConstArgKind::Array(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Array",
&__self_0),
ConstArgKind::Error(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Error",
&__self_0),
ConstArgKind::Infer(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Infer",
&__self_0),
ConstArgKind::Literal { lit: __self_0, negated: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Literal", "lit", __self_0, "negated", &__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) {
::std::mem::discriminant(self).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 [&'hir ConstArg<'hir>]),
512 Path(QPath<'hir>),
518 Anon(&'hir AnonConst),
519 Struct(QPath<'hir>, &'hir [&'hir ConstArgExprField<'hir>]),
521 TupleCall(QPath<'hir>, &'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]
fn clone(&self) -> ConstArgExprField<'hir> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"ConstArgExprField", "hir_id", &self.hir_id, "span", &self.span,
"field", &self.field, "expr", &&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]
fn clone(&self) -> ConstArgArrayExpr<'hir> {
let _: ::core::clone::AssertParamIsClone<Span>;
let _:
::core::clone::AssertParamIsClone<&'hir [&'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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"ConstArgArrayExpr", "span", &self.span, "elems", &&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 [&'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]
fn clone(&self) -> InferArgKind { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for InferArgKind { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for InferArgKind {
#[inline]
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: &InferArgKind) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for InferArgKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}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) {
::std::mem::discriminant(self).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]
fn clone(&self) -> InferArg {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "InferArg",
"hir_id", &self.hir_id, "span", &self.span, "kind", &&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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
GenericArg::Lifetime(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Lifetime", &__self_0),
GenericArg::Type(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Type",
&__self_0),
GenericArg::Const(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Const",
&__self_0),
GenericArg::Infer(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> GenericArg<'hir> {
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) {
::std::mem::discriminant(self).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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "GenericArgs",
"args", &self.args, "constraints", &self.constraints,
"parenthesized", &self.parenthesized, "span_ext", &&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]
fn clone(&self) -> GenericArgs<'hir> {
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]
fn clone(&self) -> GenericArgsParentheses { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for GenericArgsParentheses { }
#[automatically_derived]
impl ::core::cmp::PartialEq for GenericArgsParentheses {
#[inline]
fn eq(&self, other: &GenericArgsParentheses) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for GenericArgsParentheses {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for GenericArgsParentheses {
#[inline]
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) {
::std::mem::discriminant(self).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]
fn clone(&self) -> TraitBoundModifiers {
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: &TraitBoundModifiers) -> 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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TraitBoundModifiers", "constness", &self.constness, "polarity",
&&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]
fn clone(&self) -> GenericBound<'hir> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
GenericBound::Trait(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Trait",
&__self_0),
GenericBound::Outlives(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Outlives", &__self_0),
GenericBound::Use(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_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) {
::std::mem::discriminant(self).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]
fn clone(&self) -> MissingLifetimeKind { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for MissingLifetimeKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for MissingLifetimeKind {
#[inline]
fn eq(&self, other: &MissingLifetimeKind) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for MissingLifetimeKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for MissingLifetimeKind {
#[inline]
fn partial_cmp(&self, other: &MissingLifetimeKind)
-> ::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: &MissingLifetimeKind) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord, #[automatically_derived]
impl ::core::hash::Hash for MissingLifetimeKind {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state)
}
}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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
MissingLifetimeKind::Underscore => {}
MissingLifetimeKind::Ampersand => {}
MissingLifetimeKind::Comma => {}
MissingLifetimeKind::Brackets => {}
}
}
}
};StableHash, #[automatically_derived]
impl ::core::fmt::Debug for MissingLifetimeKind {
#[inline]
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]
fn clone(&self) -> LifetimeParamKind {
let _: ::core::clone::AssertParamIsClone<MissingLifetimeKind>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for LifetimeParamKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
LifetimeParamKind::Explicit =>
::core::fmt::Formatter::write_str(f, "Explicit"),
LifetimeParamKind::Elided(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Elided",
&__self_0),
LifetimeParamKind::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) {
::std::mem::discriminant(self).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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
GenericParamKind::Lifetime { kind: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Lifetime", "kind", &__self_0),
GenericParamKind::Type { default: __self_0, synthetic: __self_1 }
=>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Type",
"default", __self_0, "synthetic", &__self_1),
GenericParamKind::Const { ty: __self_0, default: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Const",
"ty", __self_0, "default", &__self_1),
}
}
}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]
fn clone(&self) -> GenericParamKind<'hir> {
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>>>;
*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) {
::std::mem::discriminant(self).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 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.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 },
852}
853
854#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for GenericParam<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["hir_id", "def_id", "name", "span", "pure_wrt_drop", "kind",
"colon_span", "source"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.hir_id, &self.def_id, &self.name, &self.span,
&self.pure_wrt_drop, &self.kind, &self.colon_span,
&&self.source];
::core::fmt::Formatter::debug_struct_fields_finish(f, "GenericParam",
names, values)
}
}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]
fn clone(&self) -> GenericParam<'hir> {
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)]
855pub struct GenericParam<'hir> {
856 #[stable_hash(ignore)]
857 pub hir_id: HirId,
858 pub def_id: LocalDefId,
859 pub name: ParamName,
860 pub span: Span,
861 pub pure_wrt_drop: bool,
862 pub kind: GenericParamKind<'hir>,
863 pub colon_span: Option<Span>,
864 pub source: GenericParamSource,
865}
866
867impl<'hir> GenericParam<'hir> {
868 pub fn is_impl_trait(&self) -> bool {
872 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
GenericParamKind::Type { synthetic: true, .. } => true,
_ => false,
}matches!(self.kind, GenericParamKind::Type { synthetic: true, .. })
873 }
874
875 pub fn is_elided_lifetime(&self) -> bool {
879 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
GenericParamKind::Lifetime { kind: LifetimeParamKind::Elided(_) } => true,
_ => false,
}matches!(self.kind, GenericParamKind::Lifetime { kind: LifetimeParamKind::Elided(_) })
880 }
881
882 pub fn is_lifetime(&self) -> bool {
883 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
GenericParamKind::Lifetime { .. } => true,
_ => false,
}matches!(self.kind, GenericParamKind::Lifetime { .. })
884 }
885}
886
887#[derive(#[automatically_derived]
impl ::core::fmt::Debug for GenericParamSource {
#[inline]
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]
fn clone(&self) -> GenericParamSource { *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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
GenericParamSource::Generics => {}
GenericParamSource::Binder => {}
}
}
}
};StableHash)]
894pub enum GenericParamSource {
895 Generics,
897 Binder,
899}
900
901#[derive(#[automatically_derived]
impl ::core::default::Default for GenericParamCount {
#[inline]
fn default() -> GenericParamCount {
GenericParamCount {
lifetimes: ::core::default::Default::default(),
types: ::core::default::Default::default(),
consts: ::core::default::Default::default(),
infer: ::core::default::Default::default(),
}
}
}Default)]
902pub struct GenericParamCount {
903 pub lifetimes: usize,
904 pub types: usize,
905 pub consts: usize,
906 pub infer: usize,
907}
908
909#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Generics<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "Generics",
"params", &self.params, "predicates", &self.predicates,
"has_where_clause_predicates", &self.has_where_clause_predicates,
"where_clause_span", &self.where_clause_span, "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]
fn clone(&self) -> Generics<'hir> {
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)]
912pub struct Generics<'hir> {
913 pub params: &'hir [GenericParam<'hir>],
914 pub predicates: &'hir [WherePredicate<'hir>],
915 pub has_where_clause_predicates: bool,
916 pub where_clause_span: Span,
917 pub span: Span,
918}
919
920impl<'hir> Generics<'hir> {
921 pub const fn empty() -> &'hir Generics<'hir> {
922 const NOPE: Generics<'_> = Generics {
923 params: &[],
924 predicates: &[],
925 has_where_clause_predicates: false,
926 where_clause_span: DUMMY_SP,
927 span: DUMMY_SP,
928 };
929 &NOPE
930 }
931
932 pub fn get_named(&self, name: Symbol) -> Option<&GenericParam<'hir>> {
933 self.params.iter().find(|¶m| name == param.name.ident().name)
934 }
935
936 pub fn span_for_lifetime_suggestion(&self) -> Option<Span> {
938 if let Some(first) = self.params.first()
939 && self.span.contains(first.span)
940 {
941 Some(first.span.shrink_to_lo())
944 } else {
945 None
946 }
947 }
948
949 pub fn span_for_param_suggestion(&self) -> Option<Span> {
951 self.params.iter().any(|p| self.span.contains(p.span)).then(|| {
952 self.span.with_lo(self.span.hi() - BytePos(1)).shrink_to_lo()
955 })
956 }
957
958 pub fn tail_span_for_predicate_suggestion(&self) -> Span {
961 let end = self.where_clause_span.shrink_to_hi();
962 if self.has_where_clause_predicates {
963 self.predicates
964 .iter()
965 .rfind(|&p| p.kind.in_where_clause())
966 .map_or(end, |p| p.span)
967 .shrink_to_hi()
968 .to(end)
969 } else {
970 end
971 }
972 }
973
974 pub fn add_where_or_trailing_comma(&self) -> &'static str {
975 if self.has_where_clause_predicates {
976 ","
977 } else if self.where_clause_span.is_empty() {
978 " where"
979 } else {
980 ""
982 }
983 }
984
985 pub fn bounds_for_param(
986 &self,
987 param_def_id: LocalDefId,
988 ) -> impl Iterator<Item = &WhereBoundPredicate<'hir>> {
989 self.predicates.iter().filter_map(move |pred| match pred.kind {
990 WherePredicateKind::BoundPredicate(bp)
991 if bp.is_param_bound(param_def_id.to_def_id()) =>
992 {
993 Some(bp)
994 }
995 _ => None,
996 })
997 }
998
999 pub fn outlives_for_param(
1000 &self,
1001 param_def_id: LocalDefId,
1002 ) -> impl Iterator<Item = &WhereRegionPredicate<'_>> {
1003 self.predicates.iter().filter_map(move |pred| match pred.kind {
1004 WherePredicateKind::RegionPredicate(rp) if rp.is_param_bound(param_def_id) => Some(rp),
1005 _ => None,
1006 })
1007 }
1008
1009 pub fn bounds_span_for_suggestions(
1020 &self,
1021 param_def_id: LocalDefId,
1022 ) -> Option<(Span, Option<Span>)> {
1023 self.bounds_for_param(param_def_id).flat_map(|bp| bp.bounds.iter().rev()).find_map(
1024 |bound| {
1025 let span_for_parentheses = if let Some(trait_ref) = bound.trait_ref()
1026 && let [.., segment] = trait_ref.path.segments
1027 && let Some(ret_ty) = segment.args().paren_sugar_output()
1028 && let ret_ty = ret_ty.peel_refs()
1029 && let TyKind::TraitObject(_, tagged_ptr) = ret_ty.kind
1030 && let TraitObjectSyntax::Dyn = tagged_ptr.tag()
1031 && ret_ty.span.can_be_used_for_suggestions()
1032 {
1033 Some(ret_ty.span)
1034 } else {
1035 None
1036 };
1037
1038 span_for_parentheses.map_or_else(
1039 || {
1040 let bs = bound.span();
1043 bs.from_expansion().not().then(|| (bs.shrink_to_hi(), None))
1048 },
1049 |span| Some((span.shrink_to_hi(), Some(span.shrink_to_lo()))),
1050 )
1051 },
1052 )
1053 }
1054
1055 pub fn span_for_predicate_removal(&self, pos: usize) -> Span {
1056 let predicate = &self.predicates[pos];
1057 let span = predicate.span;
1058
1059 if !predicate.kind.in_where_clause() {
1060 return span;
1063 }
1064
1065 if pos < self.predicates.len() - 1 {
1067 let next_pred = &self.predicates[pos + 1];
1068 if next_pred.kind.in_where_clause() {
1069 return span.until(next_pred.span);
1072 }
1073 }
1074
1075 if pos > 0 {
1076 let prev_pred = &self.predicates[pos - 1];
1077 if prev_pred.kind.in_where_clause() {
1078 return prev_pred.span.shrink_to_hi().to(span);
1081 }
1082 }
1083
1084 self.where_clause_span
1088 }
1089
1090 pub fn span_for_bound_removal(&self, predicate_pos: usize, bound_pos: usize) -> Span {
1091 let predicate = &self.predicates[predicate_pos];
1092 let bounds = predicate.kind.bounds();
1093
1094 if bounds.len() == 1 {
1095 return self.span_for_predicate_removal(predicate_pos);
1096 }
1097
1098 let bound_span = bounds[bound_pos].span();
1099 if bound_pos < bounds.len() - 1 {
1100 bound_span.to(bounds[bound_pos + 1].span().shrink_to_lo())
1106 } else {
1107 bound_span.with_lo(bounds[bound_pos - 1].span().hi())
1113 }
1114 }
1115
1116 pub fn span_for_param_removal(&self, param_index: usize) -> Span {
1139 if param_index >= self.params.len() {
1140 return self.span.shrink_to_hi();
1141 }
1142
1143 let is_param_explicit = |par: &&GenericParam<'_>| match par.kind {
1144 GenericParamKind::Type { .. }
1145 | GenericParamKind::Const { .. }
1146 | GenericParamKind::Lifetime { kind: LifetimeParamKind::Explicit } => true,
1147 _ => false,
1148 };
1149
1150 if let Some(next) = self.params[param_index + 1..].iter().find(is_param_explicit) {
1152 self.params[param_index].span.until(next.span)
1153 } else if let Some(prev) = self.params[..param_index].iter().rfind(is_param_explicit) {
1154 let mut prev_span = prev.span;
1155 if let Some(prev_bounds_span) = self.span_for_param_bounds(prev) {
1157 prev_span = prev_span.to(prev_bounds_span);
1158 }
1159
1160 prev_span.shrink_to_hi().to(
1162 if let Some(cur_bounds_span) = self.span_for_param_bounds(&self.params[param_index])
1163 {
1164 cur_bounds_span
1165 } else {
1166 self.params[param_index].span
1167 },
1168 )
1169 } else {
1170 self.span
1172 }
1173 }
1174
1175 fn span_for_param_bounds(&self, param: &GenericParam<'hir>) -> Option<Span> {
1186 self.predicates
1187 .iter()
1188 .find(|pred| {
1189 if let WherePredicateKind::BoundPredicate(WhereBoundPredicate {
1190 origin: PredicateOrigin::GenericParam,
1191 bounded_ty,
1192 ..
1193 }) = pred.kind
1194 {
1195 bounded_ty.span == param.span
1196 } else {
1197 false
1198 }
1199 })
1200 .map(|pred| pred.span)
1201 }
1202}
1203
1204#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WherePredicate<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"WherePredicate", "hir_id", &self.hir_id, "span", &self.span,
"kind", &&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]
fn clone(&self) -> WherePredicate<'hir> {
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)]
1206pub struct WherePredicate<'hir> {
1207 #[stable_hash(ignore)]
1208 pub hir_id: HirId,
1209 pub span: Span,
1210 pub kind: &'hir WherePredicateKind<'hir>,
1211}
1212
1213#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WherePredicateKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
WherePredicateKind::BoundPredicate(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"BoundPredicate", &__self_0),
WherePredicateKind::RegionPredicate(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> WherePredicateKind<'hir> {
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) {
::std::mem::discriminant(self).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)]
1215pub enum WherePredicateKind<'hir> {
1216 BoundPredicate(WhereBoundPredicate<'hir>),
1218 RegionPredicate(WhereRegionPredicate<'hir>),
1220}
1221
1222impl<'hir> WherePredicateKind<'hir> {
1223 pub fn in_where_clause(&self) -> bool {
1224 match self {
1225 WherePredicateKind::BoundPredicate(p) => p.origin == PredicateOrigin::WhereClause,
1226 WherePredicateKind::RegionPredicate(p) => p.in_where_clause,
1227 }
1228 }
1229
1230 pub fn bounds(&self) -> GenericBounds<'hir> {
1231 match self {
1232 WherePredicateKind::BoundPredicate(p) => p.bounds,
1233 WherePredicateKind::RegionPredicate(p) => p.bounds,
1234 }
1235 }
1236}
1237
1238#[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]
fn clone(&self) -> PredicateOrigin { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for PredicateOrigin {
#[inline]
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) {
::std::mem::discriminant(self).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: &PredicateOrigin) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for PredicateOrigin {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq)]
1239pub enum PredicateOrigin {
1240 WhereClause,
1241 GenericParam,
1242 ImplTrait,
1243}
1244
1245#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WhereBoundPredicate<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"WhereBoundPredicate", "origin", &self.origin,
"bound_generic_params", &self.bound_generic_params, "bounded_ty",
&self.bounded_ty, "bounds", &&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]
fn clone(&self) -> WhereBoundPredicate<'hir> {
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)]
1247pub struct WhereBoundPredicate<'hir> {
1248 pub origin: PredicateOrigin,
1250 pub bound_generic_params: &'hir [GenericParam<'hir>],
1252 pub bounded_ty: &'hir Ty<'hir>,
1254 pub bounds: GenericBounds<'hir>,
1256}
1257
1258impl<'hir> WhereBoundPredicate<'hir> {
1259 pub fn is_param_bound(&self, param_def_id: DefId) -> bool {
1261 self.bounded_ty.as_generic_param().is_some_and(|(def_id, _)| def_id == param_def_id)
1262 }
1263}
1264
1265#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WhereRegionPredicate<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"WhereRegionPredicate", "in_where_clause", &self.in_where_clause,
"lifetime", &self.lifetime, "bounds", &&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]
fn clone(&self) -> WhereRegionPredicate<'hir> {
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)]
1267pub struct WhereRegionPredicate<'hir> {
1268 pub in_where_clause: bool,
1269 pub lifetime: &'hir Lifetime,
1270 pub bounds: GenericBounds<'hir>,
1271}
1272
1273impl<'hir> WhereRegionPredicate<'hir> {
1274 fn is_param_bound(&self, param_def_id: LocalDefId) -> bool {
1276 self.lifetime.kind == LifetimeKind::Param(param_def_id)
1277 }
1278}
1279
1280#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WhereEqPredicate<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"WhereEqPredicate", "lhs_ty", &self.lhs_ty, "rhs_ty",
&&self.rhs_ty)
}
}Debug, #[automatically_derived]
#[doc(hidden)]
unsafe impl<'hir> ::core::clone::TrivialClone for WhereEqPredicate<'hir> { }
#[automatically_derived]
impl<'hir> ::core::clone::Clone for WhereEqPredicate<'hir> {
#[inline]
fn clone(&self) -> WhereEqPredicate<'hir> {
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
*self
}
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for WhereEqPredicate<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
WhereEqPredicate<'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 {
WhereEqPredicate {
lhs_ty: ref __binding_0, rhs_ty: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1282pub struct WhereEqPredicate<'hir> {
1283 pub lhs_ty: &'hir Ty<'hir>,
1284 pub rhs_ty: &'hir Ty<'hir>,
1285}
1286
1287#[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]
fn clone(&self) -> ParentedNode<'tcx> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "ParentedNode",
"parent", &self.parent, "node", &&self.node)
}
}Debug)]
1291pub struct ParentedNode<'tcx> {
1292 pub parent: ItemLocalId,
1293 pub node: Node<'tcx>,
1294}
1295
1296#[derive(#[automatically_derived]
impl<'tcx> ::core::fmt::Debug for AttributeMap<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "AttributeMap",
"map", &self.map, "define_opaque", &self.define_opaque,
"opt_hash", &&self.opt_hash)
}
}Debug)]
1298pub struct AttributeMap<'tcx> {
1299 pub map: SortedMap<ItemLocalId, &'tcx [Attribute]>,
1300 pub define_opaque: Option<&'tcx [(Span, LocalDefId)]>,
1302 pub opt_hash: Option<Fingerprint>,
1304}
1305
1306impl<'tcx> AttributeMap<'tcx> {
1307 pub const EMPTY: &'static AttributeMap<'static> = &AttributeMap {
1308 map: SortedMap::new(),
1309 opt_hash: Some(Fingerprint::ZERO),
1310 define_opaque: None,
1311 };
1312
1313 #[inline]
1314 pub fn get(&self, id: ItemLocalId) -> &'tcx [Attribute] {
1315 self.map.get(&id).copied().unwrap_or(&[])
1316 }
1317}
1318
1319pub struct OwnerNodes<'tcx> {
1323 pub opt_hash: Option<Fingerprint>,
1326 pub nodes: IndexVec<ItemLocalId, ParentedNode<'tcx>>,
1331 pub bodies: SortedMap<ItemLocalId, &'tcx Body<'tcx>>,
1333}
1334
1335impl<'tcx> OwnerNodes<'tcx> {
1336 pub fn node(&self) -> OwnerNode<'tcx> {
1337 self.nodes[ItemLocalId::ZERO].node.as_owner().unwrap()
1339 }
1340
1341 pub fn synthetic() -> OwnerNodes<'tcx> {
1343 OwnerNodes {
1344 opt_hash: Some(Fingerprint::ZERO),
1347 nodes: IndexVec::from_elem_n(
1348 ParentedNode { parent: ItemLocalId::INVALID, node: OwnerNode::Synthetic.into() },
1349 1,
1350 ),
1351 bodies: SortedMap::new(),
1352 }
1353 }
1354}
1355
1356impl fmt::Debug for OwnerNodes<'_> {
1357 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1358 f.debug_struct("OwnerNodes")
1359 .field("node", &self.nodes[ItemLocalId::ZERO])
1361 .field(
1362 "parents",
1363 &fmt::from_fn(|f| {
1364 f.debug_list()
1365 .entries(self.nodes.iter_enumerated().map(|(id, parented_node)| {
1366 fmt::from_fn(move |f| f.write_fmt(format_args!("({1:?}, {0:?})", parented_node.parent, id))write!(f, "({id:?}, {:?})", parented_node.parent))
1367 }))
1368 .finish()
1369 }),
1370 )
1371 .field("bodies", &self.bodies)
1372 .field("opt_hash", &self.opt_hash)
1373 .finish()
1374 }
1375}
1376
1377#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for OwnerInfo<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["nodes", "parenting", "attrs", "trait_map", "children",
"delayed_lints", "opt_hash"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.nodes, &self.parenting, &self.attrs, &self.trait_map,
&self.children, &self.delayed_lints, &&self.opt_hash];
::core::fmt::Formatter::debug_struct_fields_finish(f, "OwnerInfo",
names, values)
}
}Debug)]
1379pub struct OwnerInfo<'hir> {
1380 pub nodes: OwnerNodes<'hir>,
1382 pub parenting: LocalDefIdMap<ItemLocalId>,
1384 pub attrs: AttributeMap<'hir>,
1386 pub trait_map: ItemLocalMap<&'hir [TraitCandidate<'hir>]>,
1389 pub children: UnordMap<LocalDefId, MaybeOwner<'hir>>,
1391
1392 pub delayed_lints: Steal<DelayedLints>,
1398
1399 pub opt_hash: Option<Fingerprint>,
1401}
1402
1403impl<'tcx> OwnerInfo<'tcx> {
1404 #[inline]
1405 pub fn node(&self) -> OwnerNode<'tcx> {
1406 self.nodes.node()
1407 }
1408}
1409
1410#[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]
fn clone(&self) -> MaybeOwner<'tcx> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
MaybeOwner::Owner(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Owner",
&__self_0),
MaybeOwner::NonOwner(__self_0) =>
::core::fmt::Formatter::debug_tuple_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) {
::std::mem::discriminant(self).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)]
1411pub enum MaybeOwner<'tcx> {
1412 Owner(&'tcx OwnerInfo<'tcx>),
1413 NonOwner(HirId),
1414}
1415
1416impl<'tcx> MaybeOwner<'tcx> {
1417 #[inline]
1418 pub fn as_owner(self) -> Option<&'tcx OwnerInfo<'tcx>> {
1419 match self {
1420 MaybeOwner::Owner(i) => Some(i),
1421 MaybeOwner::NonOwner(_) => None,
1422 }
1423 }
1424
1425 #[inline]
1426 pub fn unwrap(self) -> &'tcx OwnerInfo<'tcx> {
1427 self.as_owner().unwrap_or_else(|| { ::core::panicking::panic_fmt(format_args!("Not a HIR owner")); }panic!("Not a HIR owner"))
1428 }
1429}
1430
1431#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Closure<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["def_id", "binder", "constness", "capture_clause",
"bound_generic_params", "fn_decl", "body", "fn_decl_span",
"fn_arg_span", "kind", "explicit_captures"];
let values: &[&dyn ::core::fmt::Debug] =
&[&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];
::core::fmt::Formatter::debug_struct_fields_finish(f, "Closure",
names, values)
}
}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]
fn clone(&self) -> Closure<'hir> {
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)]
1432pub struct Closure<'hir> {
1433 pub def_id: LocalDefId,
1434 pub binder: ClosureBinder,
1435 pub constness: Constness,
1436 pub capture_clause: CaptureBy,
1437 pub bound_generic_params: &'hir [GenericParam<'hir>],
1438 pub fn_decl: &'hir FnDecl<'hir>,
1439 pub body: BodyId,
1440 pub fn_decl_span: Span,
1442 pub fn_arg_span: Option<Span>,
1444 pub kind: ClosureKind,
1445 pub explicit_captures: &'hir [ExplicitCapture],
1446}
1447
1448#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ExplicitCapture {
#[inline]
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]
fn clone(&self) -> ExplicitCapture {
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)]
1451pub struct ExplicitCapture {
1452 pub var_hir_id: HirId,
1453}
1454
1455#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ClosureKind { }
#[automatically_derived]
impl ::core::clone::Clone for ClosureKind {
#[inline]
fn clone(&self) -> ClosureKind {
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: &ClosureKind) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(ClosureKind::Coroutine(__self_0),
ClosureKind::Coroutine(__arg1_0)) => __self_0 == __arg1_0,
(ClosureKind::CoroutineClosure(__self_0),
ClosureKind::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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ClosureKind::Closure =>
::core::fmt::Formatter::write_str(f, "Closure"),
ClosureKind::Coroutine(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Coroutine", &__self_0),
ClosureKind::CoroutineClosure(__self_0) =>
::core::fmt::Formatter::debug_tuple_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) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state);
match self {
ClosureKind::Coroutine(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
ClosureKind::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) {
::std::mem::discriminant(self).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)]
1456pub enum ClosureKind {
1457 Closure,
1459 Coroutine(CoroutineKind),
1464 CoroutineClosure(CoroutineDesugaring),
1469}
1470
1471#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Block<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["stmts", "expr", "hir_id", "rules", "span",
"targeted_by_break"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.stmts, &self.expr, &self.hir_id, &self.rules, &self.span,
&&self.targeted_by_break];
::core::fmt::Formatter::debug_struct_fields_finish(f, "Block", names,
values)
}
}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]
fn clone(&self) -> Block<'hir> {
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)]
1475pub struct Block<'hir> {
1476 pub stmts: &'hir [Stmt<'hir>],
1478 pub expr: Option<&'hir Expr<'hir>>,
1481 #[stable_hash(ignore)]
1482 pub hir_id: HirId,
1483 pub rules: BlockCheckMode,
1485 pub span: Span,
1487 pub targeted_by_break: bool,
1491}
1492
1493impl<'hir> Block<'hir> {
1494 pub fn innermost_block(&self) -> &Block<'hir> {
1495 let mut block = self;
1496 while let Some(Expr { kind: ExprKind::Block(inner_block, _), .. }) = block.expr {
1497 block = inner_block;
1498 }
1499 block
1500 }
1501}
1502
1503#[derive(#[automatically_derived]
impl ::core::fmt::Debug for TyFieldPath {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "TyFieldPath",
"variant", &self.variant, "field", &&self.field)
}
}Debug, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for TyFieldPath { }
#[automatically_derived]
impl ::core::clone::Clone for TyFieldPath {
#[inline]
fn clone(&self) -> TyFieldPath {
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)]
1504pub struct TyFieldPath {
1505 pub variant: Option<Ident>,
1506 pub field: Ident,
1507}
1508
1509#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TyPat<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "TyPat",
"hir_id", &self.hir_id, "kind", &self.kind, "span", &&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]
fn clone(&self) -> TyPat<'hir> {
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)]
1510pub struct TyPat<'hir> {
1511 #[stable_hash(ignore)]
1512 pub hir_id: HirId,
1513 pub kind: TyPatKind<'hir>,
1514 pub span: Span,
1515}
1516
1517#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Pat<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "Pat", "hir_id",
&self.hir_id, "kind", &self.kind, "span", &self.span,
"default_binding_modes", &&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]
fn clone(&self) -> Pat<'hir> {
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)]
1518pub struct Pat<'hir> {
1519 #[stable_hash(ignore)]
1520 pub hir_id: HirId,
1521 pub kind: PatKind<'hir>,
1522 pub span: Span,
1523 pub default_binding_modes: bool,
1526}
1527
1528impl<'hir> Pat<'hir> {
1529 fn walk_short_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool) -> bool {
1530 if !it(self) {
1531 return false;
1532 }
1533
1534 use PatKind::*;
1535 match self.kind {
1536 Missing => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
1537 Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Err(_) => true,
1538 Deref(s) | Ref(s, _, _) | Binding(.., Some(s)) | Guard(s, _) => s.walk_short_(it),
1539 Struct(_, fields, _) => fields.iter().all(|field| field.pat.walk_short_(it)),
1540 TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().all(|p| p.walk_short_(it)),
1541 Slice(before, slice, after) => {
1542 before.iter().chain(slice).chain(after.iter()).all(|p| p.walk_short_(it))
1543 }
1544 }
1545 }
1546
1547 pub fn walk_short(&self, mut it: impl FnMut(&Pat<'hir>) -> bool) -> bool {
1554 self.walk_short_(&mut it)
1555 }
1556
1557 fn walk_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool) {
1558 if !it(self) {
1559 return;
1560 }
1561
1562 use PatKind::*;
1563 match self.kind {
1564 Missing | Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Err(_) => {}
1565 Deref(s) | Ref(s, _, _) | Binding(.., Some(s)) | Guard(s, _) => s.walk_(it),
1566 Struct(_, fields, _) => fields.iter().for_each(|field| field.pat.walk_(it)),
1567 TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().for_each(|p| p.walk_(it)),
1568 Slice(before, slice, after) => {
1569 before.iter().chain(slice).chain(after.iter()).for_each(|p| p.walk_(it))
1570 }
1571 }
1572 }
1573
1574 pub fn walk(&self, mut it: impl FnMut(&Pat<'hir>) -> bool) {
1578 self.walk_(&mut it)
1579 }
1580
1581 pub fn walk_always(&self, mut it: impl FnMut(&Pat<'_>)) {
1585 self.walk(|p| {
1586 it(p);
1587 true
1588 })
1589 }
1590
1591 pub fn is_never_pattern(&self) -> bool {
1593 let mut is_never_pattern = false;
1594 self.walk(|pat| match &pat.kind {
1595 PatKind::Never => {
1596 is_never_pattern = true;
1597 false
1598 }
1599 PatKind::Or(s) => {
1600 is_never_pattern = s.iter().all(|p| p.is_never_pattern());
1601 false
1602 }
1603 _ => true,
1604 });
1605 is_never_pattern
1606 }
1607
1608 pub fn is_guaranteed_to_constitute_read_for_never(&self) -> bool {
1617 match self.kind {
1618 PatKind::Wild => false,
1620
1621 PatKind::Guard(pat, _) => pat.is_guaranteed_to_constitute_read_for_never(),
1624
1625 PatKind::Or(subpats) => {
1634 subpats.iter().all(|pat| pat.is_guaranteed_to_constitute_read_for_never())
1635 }
1636
1637 PatKind::Never => true,
1639
1640 PatKind::Missing
1643 | PatKind::Binding(_, _, _, _)
1644 | PatKind::Struct(_, _, _)
1645 | PatKind::TupleStruct(_, _, _)
1646 | PatKind::Tuple(_, _)
1647 | PatKind::Ref(_, _, _)
1648 | PatKind::Deref(_)
1649 | PatKind::Expr(_)
1650 | PatKind::Range(_, _, _)
1651 | PatKind::Slice(_, _, _)
1652 | PatKind::Err(_) => true,
1653 }
1654 }
1655}
1656
1657#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for PatField<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "PatField",
"hir_id", &self.hir_id, "ident", &self.ident, "pat", &self.pat,
"is_shorthand", &self.is_shorthand, "span", &&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]
fn clone(&self) -> PatField<'hir> {
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)]
1663pub struct PatField<'hir> {
1664 #[stable_hash(ignore)]
1665 pub hir_id: HirId,
1666 pub ident: Ident,
1668 pub pat: &'hir Pat<'hir>,
1670 pub is_shorthand: bool,
1671 pub span: Span,
1672}
1673
1674#[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]
fn clone(&self) -> RangeEnd { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for RangeEnd { }
#[automatically_derived]
impl ::core::cmp::PartialEq for RangeEnd {
#[inline]
fn eq(&self, other: &RangeEnd) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for RangeEnd {
#[inline]
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) {
::std::mem::discriminant(self).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) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state)
}
}Hash, #[automatically_derived]
impl ::core::cmp::Eq for RangeEnd {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}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)]
1675pub enum RangeEnd {
1676 Included,
1677 Excluded,
1678}
1679
1680impl fmt::Display for RangeEnd {
1681 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1682 f.write_str(match self {
1683 RangeEnd::Included => "..=",
1684 RangeEnd::Excluded => "..",
1685 })
1686 }
1687}
1688
1689#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for DotDotPos { }
#[automatically_derived]
impl ::core::clone::Clone for DotDotPos {
#[inline]
fn clone(&self) -> DotDotPos {
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: &DotDotPos) -> 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)]
1693pub struct DotDotPos(u32);
1694
1695impl DotDotPos {
1696 pub fn new(n: Option<usize>) -> Self {
1698 match n {
1699 Some(n) => {
1700 if !(n < u32::MAX as usize) {
::core::panicking::panic("assertion failed: n < u32::MAX as usize")
};assert!(n < u32::MAX as usize);
1701 Self(n as u32)
1702 }
1703 None => Self(u32::MAX),
1704 }
1705 }
1706
1707 pub fn as_opt_usize(&self) -> Option<usize> {
1708 if self.0 == u32::MAX { None } else { Some(self.0 as usize) }
1709 }
1710}
1711
1712impl fmt::Debug for DotDotPos {
1713 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1714 self.as_opt_usize().fmt(f)
1715 }
1716}
1717
1718#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for PatExpr<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "PatExpr",
"hir_id", &self.hir_id, "span", &self.span, "kind", &&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]
fn clone(&self) -> PatExpr<'hir> {
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)]
1719pub struct PatExpr<'hir> {
1720 #[stable_hash(ignore)]
1721 pub hir_id: HirId,
1722 pub span: Span,
1723 pub kind: PatExprKind<'hir>,
1724}
1725
1726#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for PatExprKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
PatExprKind::Lit { lit: __self_0, negated: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Lit",
"lit", __self_0, "negated", &__self_1),
PatExprKind::Path(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> PatExprKind<'hir> {
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) {
::std::mem::discriminant(self).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)]
1727pub enum PatExprKind<'hir> {
1728 Lit {
1729 lit: Lit,
1730 negated: bool,
1731 },
1732 Path(QPath<'hir>),
1734}
1735
1736#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TyPatKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
TyPatKind::Range(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Range",
__self_0, &__self_1),
TyPatKind::NotNull =>
::core::fmt::Formatter::write_str(f, "NotNull"),
TyPatKind::Or(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Or",
&__self_0),
TyPatKind::Err(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> TyPatKind<'hir> {
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) {
::std::mem::discriminant(self).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)]
1737pub enum TyPatKind<'hir> {
1738 Range(&'hir ConstArg<'hir>, &'hir ConstArg<'hir>),
1740
1741 NotNull,
1743
1744 Or(&'hir [TyPat<'hir>]),
1746
1747 Err(ErrorGuaranteed),
1749}
1750
1751#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for PatKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
PatKind::Missing =>
::core::fmt::Formatter::write_str(f, "Missing"),
PatKind::Wild => ::core::fmt::Formatter::write_str(f, "Wild"),
PatKind::Binding(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_tuple_field4_finish(f,
"Binding", __self_0, __self_1, __self_2, &__self_3),
PatKind::Struct(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Struct",
__self_0, __self_1, &__self_2),
PatKind::TupleStruct(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f,
"TupleStruct", __self_0, __self_1, &__self_2),
PatKind::Or(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Or",
&__self_0),
PatKind::Never => ::core::fmt::Formatter::write_str(f, "Never"),
PatKind::Tuple(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Tuple",
__self_0, &__self_1),
PatKind::Deref(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Deref",
&__self_0),
PatKind::Ref(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Ref",
__self_0, __self_1, &__self_2),
PatKind::Expr(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Expr",
&__self_0),
PatKind::Guard(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Guard",
__self_0, &__self_1),
PatKind::Range(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Range",
__self_0, __self_1, &__self_2),
PatKind::Slice(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Slice",
__self_0, __self_1, &__self_2),
PatKind::Err(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> PatKind<'hir> {
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) {
::std::mem::discriminant(self).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)]
1752pub enum PatKind<'hir> {
1753 Missing,
1755
1756 Wild,
1758
1759 Binding(BindingMode, HirId, Ident, Option<&'hir Pat<'hir>>),
1770
1771 Struct(QPath<'hir>, &'hir [PatField<'hir>], Option<Span>),
1774
1775 TupleStruct(QPath<'hir>, &'hir [Pat<'hir>], DotDotPos),
1779
1780 Or(&'hir [Pat<'hir>]),
1783
1784 Never,
1786
1787 Tuple(&'hir [Pat<'hir>], DotDotPos),
1791
1792 Deref(&'hir Pat<'hir>),
1794
1795 Ref(&'hir Pat<'hir>, Pinnedness, Mutability),
1797
1798 Expr(&'hir PatExpr<'hir>),
1800
1801 Guard(&'hir Pat<'hir>, &'hir Expr<'hir>),
1803
1804 Range(Option<&'hir PatExpr<'hir>>, Option<&'hir PatExpr<'hir>>, RangeEnd),
1806
1807 Slice(&'hir [Pat<'hir>], Option<&'hir Pat<'hir>>, &'hir [Pat<'hir>]),
1817
1818 Err(ErrorGuaranteed),
1820}
1821
1822#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Stmt<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "Stmt",
"hir_id", &self.hir_id, "kind", &self.kind, "span", &&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]
fn clone(&self) -> Stmt<'hir> {
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)]
1824pub struct Stmt<'hir> {
1825 #[stable_hash(ignore)]
1826 pub hir_id: HirId,
1827 pub kind: StmtKind<'hir>,
1828 pub span: Span,
1829}
1830
1831#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for StmtKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
StmtKind::Let(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Let",
&__self_0),
StmtKind::Item(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Item",
&__self_0),
StmtKind::Expr(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Expr",
&__self_0),
StmtKind::Semi(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> StmtKind<'hir> {
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) {
::std::mem::discriminant(self).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)]
1833pub enum StmtKind<'hir> {
1834 Let(&'hir LetStmt<'hir>),
1836
1837 Item(ItemId),
1839
1840 Expr(&'hir Expr<'hir>),
1842
1843 Semi(&'hir Expr<'hir>),
1845}
1846
1847#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for LetStmt<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["super_", "pat", "ty", "init", "els", "hir_id", "span",
"source"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.super_, &self.pat, &self.ty, &self.init, &self.els,
&self.hir_id, &self.span, &&self.source];
::core::fmt::Formatter::debug_struct_fields_finish(f, "LetStmt",
names, values)
}
}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]
fn clone(&self) -> LetStmt<'hir> {
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)]
1849pub struct LetStmt<'hir> {
1850 pub super_: Option<Span>,
1852 pub pat: &'hir Pat<'hir>,
1853 pub ty: Option<&'hir Ty<'hir>>,
1855 pub init: Option<&'hir Expr<'hir>>,
1857 pub els: Option<&'hir Block<'hir>>,
1859 #[stable_hash(ignore)]
1860 pub hir_id: HirId,
1861 pub span: Span,
1862 pub source: LocalSource,
1866}
1867
1868#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Arm<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "Arm", "hir_id",
&self.hir_id, "span", &self.span, "pat", &self.pat, "guard",
&self.guard, "body", &&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]
fn clone(&self) -> Arm<'hir> {
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)]
1871pub struct Arm<'hir> {
1872 #[stable_hash(ignore)]
1873 pub hir_id: HirId,
1874 pub span: Span,
1875 pub pat: &'hir Pat<'hir>,
1877 pub guard: Option<&'hir Expr<'hir>>,
1879 pub body: &'hir Expr<'hir>,
1881}
1882
1883#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for LetExpr<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "LetExpr",
"span", &self.span, "pat", &self.pat, "ty", &self.ty, "init",
&self.init, "recovered", &&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]
fn clone(&self) -> LetExpr<'hir> {
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)]
1889pub struct LetExpr<'hir> {
1890 pub span: Span,
1891 pub pat: &'hir Pat<'hir>,
1892 pub ty: Option<&'hir Ty<'hir>>,
1893 pub init: &'hir Expr<'hir>,
1894 pub recovered: ast::Recovered,
1897}
1898
1899#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ExprField<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "ExprField",
"hir_id", &self.hir_id, "ident", &self.ident, "expr", &self.expr,
"span", &self.span, "is_shorthand", &&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]
fn clone(&self) -> ExprField<'hir> {
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)]
1900pub struct ExprField<'hir> {
1901 #[stable_hash(ignore)]
1902 pub hir_id: HirId,
1903 pub ident: Ident,
1904 pub expr: &'hir Expr<'hir>,
1905 pub span: Span,
1906 pub is_shorthand: bool,
1907}
1908
1909#[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]
fn clone(&self) -> BlockCheckMode {
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: &BlockCheckMode) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(BlockCheckMode::UnsafeBlock(__self_0),
BlockCheckMode::UnsafeBlock(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for BlockCheckMode {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
BlockCheckMode::DefaultBlock =>
::core::fmt::Formatter::write_str(f, "DefaultBlock"),
BlockCheckMode::UnsafeBlock(__self_0) =>
::core::fmt::Formatter::debug_tuple_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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
BlockCheckMode::DefaultBlock => {}
BlockCheckMode::UnsafeBlock(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
1910pub enum BlockCheckMode {
1911 DefaultBlock,
1912 UnsafeBlock(UnsafeSource),
1913}
1914
1915#[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]
fn clone(&self) -> UnsafeSource { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for UnsafeSource { }
#[automatically_derived]
impl ::core::cmp::PartialEq for UnsafeSource {
#[inline]
fn eq(&self, other: &UnsafeSource) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for UnsafeSource {
#[inline]
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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
UnsafeSource::CompilerGenerated => {}
UnsafeSource::UserProvided => {}
}
}
}
};StableHash)]
1916pub enum UnsafeSource {
1917 CompilerGenerated,
1918 UserProvided,
1919}
1920
1921#[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]
fn clone(&self) -> BodyId {
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: &BodyId) -> 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]
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)]
1922pub struct BodyId {
1923 pub hir_id: HirId,
1924}
1925
1926#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Body<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "Body",
"params", &self.params, "value", &&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]
fn clone(&self) -> Body<'hir> {
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)]
1948pub struct Body<'hir> {
1949 pub params: &'hir [Param<'hir>],
1950 pub value: &'hir Expr<'hir>,
1951}
1952
1953impl<'hir> Body<'hir> {
1954 pub fn id(&self) -> BodyId {
1955 BodyId { hir_id: self.value.hir_id }
1956 }
1957}
1958
1959#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CoroutineKind { }
#[automatically_derived]
impl ::core::clone::Clone for CoroutineKind {
#[inline]
fn clone(&self) -> CoroutineKind {
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: &CoroutineKind) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(CoroutineKind::Desugared(__self_0, __self_1),
CoroutineKind::Desugared(__arg1_0, __arg1_1)) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(CoroutineKind::Coroutine(__self_0),
CoroutineKind::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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
CoroutineKind::Desugared(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f,
"Desugared", __self_0, &__self_1),
CoroutineKind::Coroutine(__self_0) =>
::core::fmt::Formatter::debug_tuple_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) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state);
match self {
CoroutineKind::Desugared(__self_0, __self_1) => {
::core::hash::Hash::hash(__self_0, state);
::core::hash::Hash::hash(__self_1, state)
}
CoroutineKind::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) {
::std::mem::discriminant(self).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)]
1961pub enum CoroutineKind {
1962 Desugared(CoroutineDesugaring, CoroutineSource),
1964
1965 Coroutine(Movability),
1967}
1968
1969impl CoroutineKind {
1970 pub fn movability(self) -> Movability {
1971 match self {
1972 CoroutineKind::Desugared(CoroutineDesugaring::Async, _)
1973 | CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, _) => Movability::Static,
1974 CoroutineKind::Desugared(CoroutineDesugaring::Gen, _) => Movability::Movable,
1975 CoroutineKind::Coroutine(mov) => mov,
1976 }
1977 }
1978
1979 pub fn is_fn_like(self) -> bool {
1980 #[allow(non_exhaustive_omitted_patterns)] match self {
CoroutineKind::Desugared(_, CoroutineSource::Fn) => true,
_ => false,
}matches!(self, CoroutineKind::Desugared(_, CoroutineSource::Fn))
1981 }
1982
1983 pub fn is_async_desugaring(self) -> bool {
1984 #[allow(non_exhaustive_omitted_patterns)] match self {
CoroutineKind::Desugared(CoroutineDesugaring::Async |
CoroutineDesugaring::AsyncGen, _) => true,
_ => false,
}matches!(
1985 self,
1986 CoroutineKind::Desugared(CoroutineDesugaring::Async | CoroutineDesugaring::AsyncGen, _)
1987 )
1988 }
1989
1990 pub fn to_plural_string(&self) -> String {
1991 match self {
1992 CoroutineKind::Desugared(d, CoroutineSource::Fn) => ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0:#}fn bodies", d))
})format!("{d:#}fn bodies"),
1993 CoroutineKind::Desugared(d, CoroutineSource::Block) => ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0:#}blocks", d))
})format!("{d:#}blocks"),
1994 CoroutineKind::Desugared(d, CoroutineSource::Closure) => ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0:#}closure bodies", d))
})format!("{d:#}closure bodies"),
1995 CoroutineKind::Coroutine(_) => "coroutines".to_string(),
1996 }
1997 }
1998}
1999
2000impl fmt::Display for CoroutineKind {
2001 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2002 match self {
2003 CoroutineKind::Desugared(d, k) => {
2004 d.fmt(f)?;
2005 k.fmt(f)
2006 }
2007 CoroutineKind::Coroutine(_) => f.write_str("coroutine"),
2008 }
2009 }
2010}
2011
2012#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CoroutineSource { }
#[automatically_derived]
impl ::core::clone::Clone for CoroutineSource {
#[inline]
fn clone(&self) -> CoroutineSource { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for CoroutineSource { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CoroutineSource {
#[inline]
fn eq(&self, other: &CoroutineSource) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CoroutineSource {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for CoroutineSource {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state)
}
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for CoroutineSource {
#[inline]
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) {
::std::mem::discriminant(self).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)]
2018pub enum CoroutineSource {
2019 Block,
2021
2022 Closure,
2024
2025 Fn,
2027}
2028
2029impl fmt::Display for CoroutineSource {
2030 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2031 match self {
2032 CoroutineSource::Block => "block",
2033 CoroutineSource::Closure => "closure body",
2034 CoroutineSource::Fn => "fn body",
2035 }
2036 .fmt(f)
2037 }
2038}
2039
2040#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CoroutineDesugaring { }
#[automatically_derived]
impl ::core::clone::Clone for CoroutineDesugaring {
#[inline]
fn clone(&self) -> CoroutineDesugaring { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for CoroutineDesugaring { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CoroutineDesugaring {
#[inline]
fn eq(&self, other: &CoroutineDesugaring) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CoroutineDesugaring {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for CoroutineDesugaring {
#[inline]
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) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, 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) {
::std::mem::discriminant(self).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)]
2041pub enum CoroutineDesugaring {
2042 Async,
2044
2045 Gen,
2047
2048 AsyncGen,
2051}
2052
2053impl fmt::Display for CoroutineDesugaring {
2054 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2055 match self {
2056 CoroutineDesugaring::Async => {
2057 if f.alternate() {
2058 f.write_str("`async` ")?;
2059 } else {
2060 f.write_str("async ")?
2061 }
2062 }
2063 CoroutineDesugaring::Gen => {
2064 if f.alternate() {
2065 f.write_str("`gen` ")?;
2066 } else {
2067 f.write_str("gen ")?
2068 }
2069 }
2070 CoroutineDesugaring::AsyncGen => {
2071 if f.alternate() {
2072 f.write_str("`async gen` ")?;
2073 } else {
2074 f.write_str("async gen ")?
2075 }
2076 }
2077 }
2078
2079 Ok(())
2080 }
2081}
2082
2083#[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]
fn clone(&self) -> BodyOwnerKind {
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Mutability>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for BodyOwnerKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
BodyOwnerKind::Fn => ::core::fmt::Formatter::write_str(f, "Fn"),
BodyOwnerKind::Closure =>
::core::fmt::Formatter::write_str(f, "Closure"),
BodyOwnerKind::Const { inline: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
"inline", &__self_0),
BodyOwnerKind::Static(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Static",
&__self_0),
BodyOwnerKind::GlobalAsm =>
::core::fmt::Formatter::write_str(f, "GlobalAsm"),
}
}
}Debug)]
2084pub enum BodyOwnerKind {
2085 Fn,
2087
2088 Closure,
2090
2091 Const { inline: bool },
2093
2094 Static(Mutability),
2096
2097 GlobalAsm,
2099}
2100
2101impl BodyOwnerKind {
2102 pub fn is_fn_or_closure(self) -> bool {
2103 match self {
2104 BodyOwnerKind::Fn | BodyOwnerKind::Closure => true,
2105 BodyOwnerKind::Const { .. } | BodyOwnerKind::Static(_) | BodyOwnerKind::GlobalAsm => {
2106 false
2107 }
2108 }
2109 }
2110}
2111
2112#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ConstContext { }
#[automatically_derived]
impl ::core::clone::Clone for ConstContext {
#[inline]
fn clone(&self) -> ConstContext {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ConstContext::ConstFn =>
::core::fmt::Formatter::write_str(f, "ConstFn"),
ConstContext::Static(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Static",
&__self_0),
ConstContext::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: &ConstContext) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(ConstContext::Static(__self_0),
ConstContext::Static(__arg1_0)) => __self_0 == __arg1_0,
(ConstContext::Const { allow_const_fn_promotion: __self_0 },
ConstContext::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)]
2114pub enum ConstContext {
2115 ConstFn,
2117
2118 Static(Mutability),
2120
2121 Const {
2128 allow_const_fn_promotion: bool,
2132 },
2133}
2134
2135impl ConstContext {
2136 pub fn keyword_name(self) -> &'static str {
2140 match self {
2141 Self::Const { .. } => "const",
2142 Self::Static(Mutability::Not) => "static",
2143 Self::Static(Mutability::Mut) => "static mut",
2144 Self::ConstFn => "const fn",
2145 }
2146 }
2147}
2148
2149impl fmt::Display for ConstContext {
2152 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2153 match *self {
2154 Self::Const { .. } => f.write_fmt(format_args!("constant"))write!(f, "constant"),
2155 Self::Static(_) => f.write_fmt(format_args!("static"))write!(f, "static"),
2156 Self::ConstFn => f.write_fmt(format_args!("constant function"))write!(f, "constant function"),
2157 }
2158 }
2159}
2160
2161impl IntoDiagArg for ConstContext {
2162 fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
2163 DiagArgValue::Str(Cow::Borrowed(match self {
2164 ConstContext::ConstFn => "constant function",
2165 ConstContext::Static(_) => "static",
2166 ConstContext::Const { .. } => "constant",
2167 }))
2168 }
2169}
2170
2171pub type Lit = Spanned<LitKind>;
2173
2174#[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]
fn clone(&self) -> AnonConst {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "AnonConst",
"hir_id", &self.hir_id, "def_id", &self.def_id, "body",
&self.body, "span", &&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)]
2183pub struct AnonConst {
2184 #[stable_hash(ignore)]
2185 pub hir_id: HirId,
2186 pub def_id: LocalDefId,
2187 pub body: BodyId,
2188 pub span: Span,
2189}
2190
2191#[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]
fn clone(&self) -> ConstBlock {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "ConstBlock",
"hir_id", &self.hir_id, "def_id", &self.def_id, "body",
&&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)]
2193pub struct ConstBlock {
2194 #[stable_hash(ignore)]
2195 pub hir_id: HirId,
2196 pub def_id: LocalDefId,
2197 pub body: BodyId,
2198}
2199
2200#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Expr<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "Expr",
"hir_id", &self.hir_id, "kind", &self.kind, "span", &&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]
fn clone(&self) -> Expr<'hir> {
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)]
2209pub struct Expr<'hir> {
2210 #[stable_hash(ignore)]
2211 pub hir_id: HirId,
2212 pub kind: ExprKind<'hir>,
2213 pub span: Span,
2214}
2215
2216impl Expr<'_> {
2217 pub fn precedence(&self, has_attr: &dyn Fn(HirId) -> bool) -> ExprPrecedence {
2218 let prefix_attrs_precedence = || -> ExprPrecedence {
2219 if has_attr(self.hir_id) { ExprPrecedence::Prefix } else { ExprPrecedence::Unambiguous }
2220 };
2221
2222 match &self.kind {
2223 ExprKind::Closure(closure) => match closure.fn_decl.output {
2224 FnRetTy::DefaultReturn(_) => ExprPrecedence::Jump,
2225 FnRetTy::Return(_) => prefix_attrs_precedence(),
2226 },
2227
2228 ExprKind::Break(..)
2229 | ExprKind::Ret(..)
2230 | ExprKind::Yield(..)
2231 | ExprKind::Become(..) => ExprPrecedence::Jump,
2232
2233 ExprKind::Binary(op, ..) => op.node.precedence(),
2235 ExprKind::Cast(..) => ExprPrecedence::Cast,
2236
2237 ExprKind::Assign(..) | ExprKind::AssignOp(..) => ExprPrecedence::Assign,
2238
2239 ExprKind::AddrOf(..) => ExprPrecedence::Prefix,
2241
2242 ExprKind::Let(..) | ExprKind::Unary(..) => ExprPrecedence::Prefix,
2247
2248 ExprKind::Array(_)
2250 | ExprKind::Block(..)
2251 | ExprKind::Call(..)
2252 | ExprKind::ConstBlock(_)
2253 | ExprKind::Continue(..)
2254 | ExprKind::Field(..)
2255 | ExprKind::If(..)
2256 | ExprKind::Index(..)
2257 | ExprKind::InlineAsm(..)
2258 | ExprKind::Lit(_)
2259 | ExprKind::Loop(..)
2260 | ExprKind::Match(..)
2261 | ExprKind::MethodCall(..)
2262 | ExprKind::OffsetOf(..)
2263 | ExprKind::Path(..)
2264 | ExprKind::Repeat(..)
2265 | ExprKind::Struct(..)
2266 | ExprKind::Tup(_)
2267 | ExprKind::Type(..)
2268 | ExprKind::UnsafeBinderCast(..)
2269 | ExprKind::Use(..)
2270 | ExprKind::Err(_) => prefix_attrs_precedence(),
2271
2272 ExprKind::DropTemps(expr, ..) => expr.precedence(has_attr),
2273 }
2274 }
2275
2276 pub fn is_syntactic_place_expr(&self) -> bool {
2281 self.is_place_expr(|_| true)
2282 }
2283
2284 pub fn is_place_expr(&self, mut allow_projections_from: impl FnMut(&Self) -> bool) -> bool {
2289 match self.kind {
2290 ExprKind::Path(QPath::Resolved(_, ref path)) => {
2291 #[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)
2292 }
2293
2294 ExprKind::Type(ref e, _) => e.is_place_expr(allow_projections_from),
2298
2299 ExprKind::UnsafeBinderCast(_, e, _) => e.is_place_expr(allow_projections_from),
2301
2302 ExprKind::Unary(UnOp::Deref, _) => true,
2303
2304 ExprKind::Field(ref base, _) | ExprKind::Index(ref base, _, _) => {
2305 allow_projections_from(base) || base.is_place_expr(allow_projections_from)
2306 }
2307
2308 ExprKind::Err(_guar)
2310 | ExprKind::Let(&LetExpr { recovered: ast::Recovered::Yes(_guar), .. }) => true,
2311
2312 ExprKind::Path(QPath::TypeRelative(..))
2315 | ExprKind::Call(..)
2316 | ExprKind::MethodCall(..)
2317 | ExprKind::Use(..)
2318 | ExprKind::Struct(..)
2319 | ExprKind::Tup(..)
2320 | ExprKind::If(..)
2321 | ExprKind::Match(..)
2322 | ExprKind::Closure { .. }
2323 | ExprKind::Block(..)
2324 | ExprKind::Repeat(..)
2325 | ExprKind::Array(..)
2326 | ExprKind::Break(..)
2327 | ExprKind::Continue(..)
2328 | ExprKind::Ret(..)
2329 | ExprKind::Become(..)
2330 | ExprKind::Let(..)
2331 | ExprKind::Loop(..)
2332 | ExprKind::Assign(..)
2333 | ExprKind::InlineAsm(..)
2334 | ExprKind::OffsetOf(..)
2335 | ExprKind::AssignOp(..)
2336 | ExprKind::Lit(_)
2337 | ExprKind::ConstBlock(..)
2338 | ExprKind::Unary(..)
2339 | ExprKind::AddrOf(..)
2340 | ExprKind::Binary(..)
2341 | ExprKind::Yield(..)
2342 | ExprKind::Cast(..)
2343 | ExprKind::DropTemps(..) => false,
2344 }
2345 }
2346
2347 pub fn range_span(&self) -> Option<Span> {
2350 is_range_literal(self).then(|| self.span.parent_callsite().unwrap())
2351 }
2352
2353 pub fn is_size_lit(&self) -> bool {
2356 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
ExprKind::Lit(Lit {
node: LitKind::Int(_,
LitIntType::Unsuffixed | LitIntType::Unsigned(UintTy::Usize)), ..
}) => true,
_ => false,
}matches!(
2357 self.kind,
2358 ExprKind::Lit(Lit {
2359 node: LitKind::Int(_, LitIntType::Unsuffixed | LitIntType::Unsigned(UintTy::Usize)),
2360 ..
2361 })
2362 )
2363 }
2364
2365 pub fn peel_drop_temps(&self) -> &Self {
2371 let mut expr = self;
2372 while let ExprKind::DropTemps(inner) = &expr.kind {
2373 expr = inner;
2374 }
2375 expr
2376 }
2377
2378 pub fn peel_blocks(&self) -> &Self {
2379 let mut expr = self;
2380 while let ExprKind::Block(Block { expr: Some(inner), .. }, _) = &expr.kind {
2381 expr = inner;
2382 }
2383 expr
2384 }
2385
2386 pub fn peel_borrows(&self) -> &Self {
2387 let mut expr = self;
2388 while let ExprKind::AddrOf(.., inner) = &expr.kind {
2389 expr = inner;
2390 }
2391 expr
2392 }
2393
2394 pub fn can_have_side_effects(&self) -> bool {
2395 match self.peel_drop_temps().kind {
2396 ExprKind::Path(_) | ExprKind::Lit(_) | ExprKind::OffsetOf(..) | ExprKind::Use(..) => {
2397 false
2398 }
2399 ExprKind::Type(base, _)
2400 | ExprKind::Unary(_, base)
2401 | ExprKind::Field(base, _)
2402 | ExprKind::Index(base, _, _)
2403 | ExprKind::AddrOf(.., base)
2404 | ExprKind::Cast(base, _)
2405 | ExprKind::UnsafeBinderCast(_, base, _) => {
2406 base.can_have_side_effects()
2410 }
2411 ExprKind::Binary(_, lhs, rhs) => {
2412 lhs.can_have_side_effects() || rhs.can_have_side_effects()
2416 }
2417 ExprKind::Struct(_, fields, init) => {
2418 let init_side_effects = match init {
2419 StructTailExpr::Base(init) => init.can_have_side_effects(),
2420 StructTailExpr::DefaultFields(_)
2421 | StructTailExpr::None
2422 | StructTailExpr::NoneWithError(_) => false,
2423 };
2424 fields.iter().map(|field| field.expr).any(|e| e.can_have_side_effects())
2425 || init_side_effects
2426 }
2427
2428 ExprKind::Array(args)
2429 | ExprKind::Tup(args)
2430 | ExprKind::Call(
2431 Expr {
2432 kind:
2433 ExprKind::Path(QPath::Resolved(
2434 None,
2435 Path { res: Res::Def(DefKind::Ctor(_, CtorKind::Fn), _), .. },
2436 )),
2437 ..
2438 },
2439 args,
2440 ) => args.iter().any(|arg| arg.can_have_side_effects()),
2441 ExprKind::Repeat(arg, _) => arg.can_have_side_effects(),
2442 ExprKind::If(..)
2443 | ExprKind::Match(..)
2444 | ExprKind::MethodCall(..)
2445 | ExprKind::Call(..)
2446 | ExprKind::Closure { .. }
2447 | ExprKind::Block(..)
2448 | ExprKind::Break(..)
2449 | ExprKind::Continue(..)
2450 | ExprKind::Ret(..)
2451 | ExprKind::Become(..)
2452 | ExprKind::Let(..)
2453 | ExprKind::Loop(..)
2454 | ExprKind::Assign(..)
2455 | ExprKind::InlineAsm(..)
2456 | ExprKind::AssignOp(..)
2457 | ExprKind::ConstBlock(..)
2458 | ExprKind::Yield(..)
2459 | ExprKind::DropTemps(..)
2460 | ExprKind::Err(_) => true,
2461 }
2462 }
2463
2464 pub fn is_approximately_pattern(&self) -> bool {
2466 match &self.kind {
2467 ExprKind::Array(_)
2468 | ExprKind::Call(..)
2469 | ExprKind::Tup(_)
2470 | ExprKind::Lit(_)
2471 | ExprKind::Path(_)
2472 | ExprKind::Struct(..) => true,
2473 _ => false,
2474 }
2475 }
2476
2477 pub fn equivalent_for_indexing(&self, other: &Expr<'_>) -> bool {
2482 match (self.kind, other.kind) {
2483 (ExprKind::Lit(lit1), ExprKind::Lit(lit2)) => lit1.node == lit2.node,
2484 (
2485 ExprKind::Path(QPath::Resolved(None, path1)),
2486 ExprKind::Path(QPath::Resolved(None, path2)),
2487 ) => path1.res == path2.res,
2488 (
2489 ExprKind::Struct(
2490 &QPath::Resolved(None, &Path { res: Res::Def(_, path1_def_id), .. }),
2491 args1,
2492 StructTailExpr::None,
2493 ),
2494 ExprKind::Struct(
2495 &QPath::Resolved(None, &Path { res: Res::Def(_, path2_def_id), .. }),
2496 args2,
2497 StructTailExpr::None,
2498 ),
2499 ) => {
2500 path2_def_id == path1_def_id
2501 && is_range_literal(self)
2502 && is_range_literal(other)
2503 && std::iter::zip(args1, args2)
2504 .all(|(a, b)| a.expr.equivalent_for_indexing(b.expr))
2505 }
2506 _ => false,
2507 }
2508 }
2509
2510 pub fn method_ident(&self) -> Option<Ident> {
2511 match self.kind {
2512 ExprKind::MethodCall(receiver_method, ..) => Some(receiver_method.ident),
2513 ExprKind::Unary(_, expr) | ExprKind::AddrOf(.., expr) => expr.method_ident(),
2514 _ => None,
2515 }
2516 }
2517}
2518
2519pub fn is_range_literal(expr: &Expr<'_>) -> bool {
2522 if let ExprKind::Struct(QPath::Resolved(None, path), _, StructTailExpr::None) = expr.kind
2523 && let [.., segment] = path.segments
2524 && let sym::RangeFrom
2525 | sym::RangeFull
2526 | sym::Range
2527 | sym::RangeToInclusive
2528 | sym::RangeTo
2529 | sym::RangeFromCopy
2530 | sym::RangeCopy
2531 | sym::RangeInclusiveCopy
2532 | sym::RangeToInclusiveCopy = segment.ident.name
2533 && expr.span.is_desugaring(DesugaringKind::RangeExpr)
2534 {
2535 true
2536 } else if let ExprKind::Call(func, _) = &expr.kind
2537 && let ExprKind::Path(QPath::Resolved(None, path)) = func.kind
2538 && let [.., segment] = path.segments
2539 && let sym::range_inclusive_new = segment.ident.name
2540 && expr.span.is_desugaring(DesugaringKind::RangeExpr)
2541 {
2542 true
2543 } else {
2544 false
2545 }
2546}
2547
2548pub fn expr_needs_parens(expr: &Expr<'_>) -> bool {
2555 match expr.kind {
2556 ExprKind::Cast(_, _) | ExprKind::Binary(_, _, _) => true,
2558 _ if is_range_literal(expr) => true,
2560 _ => false,
2561 }
2562}
2563
2564#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ExprKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ExprKind::ConstBlock(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ConstBlock", &__self_0),
ExprKind::Array(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Array",
&__self_0),
ExprKind::Call(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Call",
__self_0, &__self_1),
ExprKind::MethodCall(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_tuple_field4_finish(f,
"MethodCall", __self_0, __self_1, __self_2, &__self_3),
ExprKind::Use(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Use",
__self_0, &__self_1),
ExprKind::Tup(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Tup",
&__self_0),
ExprKind::Binary(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Binary",
__self_0, __self_1, &__self_2),
ExprKind::Unary(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Unary",
__self_0, &__self_1),
ExprKind::Lit(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Lit",
&__self_0),
ExprKind::Cast(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Cast",
__self_0, &__self_1),
ExprKind::Type(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Type",
__self_0, &__self_1),
ExprKind::DropTemps(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"DropTemps", &__self_0),
ExprKind::Let(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Let",
&__self_0),
ExprKind::If(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "If",
__self_0, __self_1, &__self_2),
ExprKind::Loop(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_tuple_field4_finish(f, "Loop",
__self_0, __self_1, __self_2, &__self_3),
ExprKind::Match(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Match",
__self_0, __self_1, &__self_2),
ExprKind::Closure(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Closure", &__self_0),
ExprKind::Block(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Block",
__self_0, &__self_1),
ExprKind::Assign(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Assign",
__self_0, __self_1, &__self_2),
ExprKind::AssignOp(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f,
"AssignOp", __self_0, __self_1, &__self_2),
ExprKind::Field(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Field",
__self_0, &__self_1),
ExprKind::Index(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Index",
__self_0, __self_1, &__self_2),
ExprKind::Path(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Path",
&__self_0),
ExprKind::AddrOf(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "AddrOf",
__self_0, __self_1, &__self_2),
ExprKind::Break(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Break",
__self_0, &__self_1),
ExprKind::Continue(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Continue", &__self_0),
ExprKind::Ret(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ret",
&__self_0),
ExprKind::Become(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Become",
&__self_0),
ExprKind::InlineAsm(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"InlineAsm", &__self_0),
ExprKind::OffsetOf(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f,
"OffsetOf", __self_0, &__self_1),
ExprKind::Struct(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Struct",
__self_0, __self_1, &__self_2),
ExprKind::Repeat(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Repeat",
__self_0, &__self_1),
ExprKind::Yield(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Yield",
__self_0, &__self_1),
ExprKind::UnsafeBinderCast(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f,
"UnsafeBinderCast", __self_0, __self_1, &__self_2),
ExprKind::Err(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> ExprKind<'hir> {
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 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) {
::std::mem::discriminant(self).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::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)]
2565pub enum ExprKind<'hir> {
2566 ConstBlock(ConstBlock),
2568 Array(&'hir [Expr<'hir>]),
2570 Call(&'hir Expr<'hir>, &'hir [Expr<'hir>]),
2577 MethodCall(&'hir PathSegment<'hir>, &'hir Expr<'hir>, &'hir [Expr<'hir>], Span),
2594 Use(&'hir Expr<'hir>, Span),
2596 Tup(&'hir [Expr<'hir>]),
2598 Binary(BinOp, &'hir Expr<'hir>, &'hir Expr<'hir>),
2600 Unary(UnOp, &'hir Expr<'hir>),
2602 Lit(Lit),
2604 Cast(&'hir Expr<'hir>, &'hir Ty<'hir>),
2606 Type(&'hir Expr<'hir>, &'hir Ty<'hir>),
2608 DropTemps(&'hir Expr<'hir>),
2614 Let(&'hir LetExpr<'hir>),
2619 If(&'hir Expr<'hir>, &'hir Expr<'hir>, Option<&'hir Expr<'hir>>),
2628 Loop(&'hir Block<'hir>, Option<Label>, LoopSource, Span),
2634 Match(&'hir Expr<'hir>, &'hir [Arm<'hir>], MatchSource),
2637 Closure(&'hir Closure<'hir>),
2644 Block(&'hir Block<'hir>, Option<Label>),
2646
2647 Assign(&'hir Expr<'hir>, &'hir Expr<'hir>, Span),
2649 AssignOp(AssignOp, &'hir Expr<'hir>, &'hir Expr<'hir>),
2653 Field(&'hir Expr<'hir>, Ident),
2655 Index(&'hir Expr<'hir>, &'hir Expr<'hir>, Span),
2659
2660 Path(QPath<'hir>),
2662
2663 AddrOf(BorrowKind, Mutability, &'hir Expr<'hir>),
2665 Break(Destination, Option<&'hir Expr<'hir>>),
2667 Continue(Destination),
2669 Ret(Option<&'hir Expr<'hir>>),
2671 Become(&'hir Expr<'hir>),
2673
2674 InlineAsm(&'hir InlineAsm<'hir>),
2676
2677 OffsetOf(&'hir Ty<'hir>, &'hir [Ident]),
2679
2680 Struct(&'hir QPath<'hir>, &'hir [ExprField<'hir>], StructTailExpr<'hir>),
2685
2686 Repeat(&'hir Expr<'hir>, &'hir ConstArg<'hir>),
2691
2692 Yield(&'hir Expr<'hir>, YieldSource),
2694
2695 UnsafeBinderCast(UnsafeBinderCastKind, &'hir Expr<'hir>, Option<&'hir Ty<'hir>>),
2698
2699 Err(rustc_span::ErrorGuaranteed),
2701}
2702
2703#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for StructTailExpr<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
StructTailExpr::None =>
::core::fmt::Formatter::write_str(f, "None"),
StructTailExpr::Base(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Base",
&__self_0),
StructTailExpr::DefaultFields(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"DefaultFields", &__self_0),
StructTailExpr::NoneWithError(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> StructTailExpr<'hir> {
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) {
::std::mem::discriminant(self).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)]
2704pub enum StructTailExpr<'hir> {
2705 None,
2707 Base(&'hir Expr<'hir>),
2710 DefaultFields(Span),
2714 NoneWithError(ErrorGuaranteed),
2720}
2721
2722#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for QPath<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
QPath::Resolved(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f,
"Resolved", __self_0, &__self_1),
QPath::TypeRelative(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> QPath<'hir> {
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) {
::std::mem::discriminant(self).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)]
2728pub enum QPath<'hir> {
2729 Resolved(Option<&'hir Ty<'hir>>, &'hir Path<'hir>),
2736
2737 TypeRelative(&'hir Ty<'hir>, &'hir PathSegment<'hir>),
2744}
2745
2746impl<'hir> QPath<'hir> {
2747 pub fn span(&self) -> Span {
2749 match *self {
2750 QPath::Resolved(_, path) => path.span,
2751 QPath::TypeRelative(qself, ps) => qself.span.to(ps.ident.span),
2752 }
2753 }
2754
2755 pub fn qself_span(&self) -> Span {
2758 match *self {
2759 QPath::Resolved(_, path) => path.span,
2760 QPath::TypeRelative(qself, _) => qself.span,
2761 }
2762 }
2763}
2764
2765#[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]
fn clone(&self) -> LocalSource { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for LocalSource {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
LocalSource::Normal => "Normal",
LocalSource::AsyncFn => "AsyncFn",
LocalSource::AwaitDesugar => "AwaitDesugar",
LocalSource::AssignDesugar => "AssignDesugar",
LocalSource::Contract => "Contract",
})
}
}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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
LocalSource::Normal => {}
LocalSource::AsyncFn => {}
LocalSource::AwaitDesugar => {}
LocalSource::AssignDesugar => {}
LocalSource::Contract => {}
}
}
}
};StableHash)]
2767pub enum LocalSource {
2768 Normal,
2770 AsyncFn,
2781 AwaitDesugar,
2783 AssignDesugar,
2785 Contract,
2787}
2788
2789#[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]
fn clone(&self) -> MatchSource {
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: &MatchSource) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(MatchSource::TryDesugar(__self_0),
MatchSource::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) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state);
match self {
MatchSource::TryDesugar(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
_ => {}
}
}
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for MatchSource {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
MatchSource::Normal =>
::core::fmt::Formatter::write_str(f, "Normal"),
MatchSource::Postfix =>
::core::fmt::Formatter::write_str(f, "Postfix"),
MatchSource::ForLoopDesugar =>
::core::fmt::Formatter::write_str(f, "ForLoopDesugar"),
MatchSource::TryDesugar(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TryDesugar", &__self_0),
MatchSource::AwaitDesugar =>
::core::fmt::Formatter::write_str(f, "AwaitDesugar"),
MatchSource::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) {
::std::mem::discriminant(self).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)]
2791pub enum MatchSource {
2792 Normal,
2794 Postfix,
2796 ForLoopDesugar,
2798 TryDesugar(HirId),
2800 AwaitDesugar,
2802 FormatArgs,
2804}
2805
2806impl MatchSource {
2807 #[inline]
2808 pub const fn name(self) -> &'static str {
2809 use MatchSource::*;
2810 match self {
2811 Normal => "match",
2812 Postfix => ".match",
2813 ForLoopDesugar => "for",
2814 TryDesugar(_) => "?",
2815 AwaitDesugar => ".await",
2816 FormatArgs => "format_args!()",
2817 }
2818 }
2819}
2820
2821#[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]
fn clone(&self) -> LoopSource { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for LoopSource { }
#[automatically_derived]
impl ::core::cmp::PartialEq for LoopSource {
#[inline]
fn eq(&self, other: &LoopSource) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for LoopSource {
#[inline]
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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
LoopSource::Loop => {}
LoopSource::While => {}
LoopSource::ForLoop => {}
}
}
}
};StableHash)]
2823pub enum LoopSource {
2824 Loop,
2826 While,
2828 ForLoop,
2830}
2831
2832impl LoopSource {
2833 pub fn name(self) -> &'static str {
2834 match self {
2835 LoopSource::Loop => "loop",
2836 LoopSource::While => "while",
2837 LoopSource::ForLoop => "for",
2838 }
2839 }
2840}
2841
2842#[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]
fn clone(&self) -> LoopIdError { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for LoopIdError {
#[inline]
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: &LoopIdError) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
LoopIdError::OutsideLoopScope => {}
LoopIdError::UnlabeledCfInWhileCondition => {}
LoopIdError::UnresolvedLabel => {}
}
}
}
};StableHash)]
2843pub enum LoopIdError {
2844 OutsideLoopScope,
2845 UnlabeledCfInWhileCondition,
2846 UnresolvedLabel,
2847}
2848
2849impl fmt::Display for LoopIdError {
2850 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2851 f.write_str(match self {
2852 LoopIdError::OutsideLoopScope => "not inside loop scope",
2853 LoopIdError::UnlabeledCfInWhileCondition => {
2854 "unlabeled control flow (break or continue) in while condition"
2855 }
2856 LoopIdError::UnresolvedLabel => "label not found",
2857 })
2858 }
2859}
2860
2861#[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]
fn clone(&self) -> Destination {
let _: ::core::clone::AssertParamIsClone<Option<Label>>;
let _: ::core::clone::AssertParamIsClone<Result<HirId, LoopIdError>>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Destination {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "Destination",
"label", &self.label, "target_id", &&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: &Destination) -> 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)]
2862pub struct Destination {
2863 pub label: Option<Label>,
2865
2866 pub target_id: Result<HirId, LoopIdError>,
2869}
2870
2871#[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]
fn clone(&self) -> YieldSource {
let _: ::core::clone::AssertParamIsClone<Option<HirId>>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for YieldSource {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
YieldSource::Await { expr: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Await",
"expr", &__self_0),
YieldSource::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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
YieldSource::Await { expr: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
YieldSource::Yield => {}
}
}
}
};StableHash)]
2873pub enum YieldSource {
2874 Await { expr: Option<HirId> },
2876 Yield,
2878}
2879
2880impl fmt::Display for YieldSource {
2881 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2882 f.write_str(match self {
2883 YieldSource::Await { .. } => "`await`",
2884 YieldSource::Yield => "`yield`",
2885 })
2886 }
2887}
2888
2889#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for MutTy<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "MutTy", "ty",
&self.ty, "mutbl", &&self.mutbl)
}
}Debug, #[automatically_derived]
#[doc(hidden)]
unsafe impl<'hir> ::core::clone::TrivialClone for MutTy<'hir> { }
#[automatically_derived]
impl<'hir> ::core::clone::Clone for MutTy<'hir> {
#[inline]
fn clone(&self) -> MutTy<'hir> {
let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
let _: ::core::clone::AssertParamIsClone<Mutability>;
*self
}
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for MutTy<'hir> { }Copy, const _: () =
{
impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
MutTy<'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 {
MutTy { ty: ref __binding_0, mutbl: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
2892pub struct MutTy<'hir> {
2893 pub ty: &'hir Ty<'hir>,
2894 pub mutbl: Mutability,
2895}
2896
2897#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FnSig<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "FnSig",
"header", &self.header, "decl", &self.decl, "span", &&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]
fn clone(&self) -> FnSig<'hir> {
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)]
2900pub struct FnSig<'hir> {
2901 pub header: FnHeader,
2902 pub decl: &'hir FnDecl<'hir>,
2903 pub span: Span,
2904}
2905
2906#[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]
fn clone(&self) -> TraitItemId {
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: &TraitItemId) -> 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]
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)]
2910pub struct TraitItemId {
2911 pub owner_id: OwnerId,
2912}
2913
2914impl TraitItemId {
2915 #[inline]
2916 pub fn hir_id(&self) -> HirId {
2917 HirId::make_owner(self.owner_id.def_id)
2919 }
2920}
2921
2922#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitItem<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["ident", "owner_id", "generics", "kind", "span", "defaultness"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.ident, &self.owner_id, &self.generics, &self.kind,
&self.span, &&self.defaultness];
::core::fmt::Formatter::debug_struct_fields_finish(f, "TraitItem",
names, values)
}
}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]
fn clone(&self) -> TraitItem<'hir> {
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)]
2927pub struct TraitItem<'hir> {
2928 pub ident: Ident,
2929 pub owner_id: OwnerId,
2930 pub generics: &'hir Generics<'hir>,
2931 pub kind: TraitItemKind<'hir>,
2932 pub span: Span,
2933 pub defaultness: Defaultness,
2934}
2935
2936macro_rules! expect_methods_self_kind {
2937 ( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
2938 $(
2939 #[track_caller]
2940 pub fn $name(&self) -> $ret_ty {
2941 let $pat = &self.kind else { expect_failed(stringify!($name), self) };
2942 $ret_val
2943 }
2944 )*
2945 }
2946}
2947
2948macro_rules! expect_methods_self {
2949 ( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
2950 $(
2951 #[track_caller]
2952 pub fn $name(&self) -> $ret_ty {
2953 let $pat = self else { expect_failed(stringify!($name), self) };
2954 $ret_val
2955 }
2956 )*
2957 }
2958}
2959
2960#[track_caller]
2961fn expect_failed<T: fmt::Debug>(ident: &'static str, found: T) -> ! {
2962 {
::core::panicking::panic_fmt(format_args!("{0}: found {1:?}", ident,
found));
}panic!("{ident}: found {found:?}")
2963}
2964
2965impl<'hir> TraitItem<'hir> {
2966 #[inline]
2967 pub fn hir_id(&self) -> HirId {
2968 HirId::make_owner(self.owner_id.def_id)
2970 }
2971
2972 pub fn trait_item_id(&self) -> TraitItemId {
2973 TraitItemId { owner_id: self.owner_id }
2974 }
2975
2976 #[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! {
2977 expect_const, (&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>),
2978 TraitItemKind::Const(ty, rhs), (ty, *rhs);
2979
2980 expect_fn, (&FnSig<'hir>, &TraitFn<'hir>),
2981 TraitItemKind::Fn(ty, trfn), (ty, trfn);
2982
2983 expect_type, (GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
2984 TraitItemKind::Type(bounds, ty), (bounds, *ty);
2985 }
2986}
2987
2988#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitFn<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
TraitFn::Required(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Required", &__self_0),
TraitFn::Provided(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> TraitFn<'hir> {
let _: ::core::clone::AssertParamIsClone<&'hir [Option<Ident>]>;
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) {
::std::mem::discriminant(self).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)]
2990pub enum TraitFn<'hir> {
2991 Required(&'hir [Option<Ident>]),
2993
2994 Provided(BodyId),
2996}
2997
2998#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitItemKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
TraitItemKind::Const(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Const",
__self_0, &__self_1),
TraitItemKind::Fn(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Fn",
__self_0, &__self_1),
TraitItemKind::Type(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> TraitItemKind<'hir> {
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) {
::std::mem::discriminant(self).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)]
3000pub enum TraitItemKind<'hir> {
3001 Const(&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>),
3003 Fn(FnSig<'hir>, TraitFn<'hir>),
3005 Type(GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
3008}
3009
3010#[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]
fn clone(&self) -> ImplItemId {
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: &ImplItemId) -> 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]
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)]
3014pub struct ImplItemId {
3015 pub owner_id: OwnerId,
3016}
3017
3018impl ImplItemId {
3019 #[inline]
3020 pub fn hir_id(&self) -> HirId {
3021 HirId::make_owner(self.owner_id.def_id)
3023 }
3024}
3025
3026#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ImplItem<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["ident", "owner_id", "generics", "kind", "impl_kind", "span"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.ident, &self.owner_id, &self.generics, &self.kind,
&self.impl_kind, &&self.span];
::core::fmt::Formatter::debug_struct_fields_finish(f, "ImplItem",
names, values)
}
}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]
fn clone(&self) -> ImplItem<'hir> {
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)]
3030pub struct ImplItem<'hir> {
3031 pub ident: Ident,
3032 pub owner_id: OwnerId,
3033 pub generics: &'hir Generics<'hir>,
3034 pub kind: ImplItemKind<'hir>,
3035 pub impl_kind: ImplItemImplKind,
3036 pub span: Span,
3037}
3038
3039#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ImplItemImplKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ImplItemImplKind::Inherent { vis_span: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Inherent", "vis_span", &__self_0),
ImplItemImplKind::Trait {
defaultness: __self_0, trait_item_def_id: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Trait",
"defaultness", __self_0, "trait_item_def_id", &__self_1),
}
}
}Debug, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ImplItemImplKind { }
#[automatically_derived]
impl ::core::clone::Clone for ImplItemImplKind {
#[inline]
fn clone(&self) -> ImplItemImplKind {
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) {
::std::mem::discriminant(self).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)]
3040pub enum ImplItemImplKind {
3041 Inherent {
3042 vis_span: Span,
3043 },
3044 Trait {
3045 defaultness: Defaultness,
3046 trait_item_def_id: Result<DefId, ErrorGuaranteed>,
3048 },
3049}
3050
3051impl<'hir> ImplItem<'hir> {
3052 #[inline]
3053 pub fn hir_id(&self) -> HirId {
3054 HirId::make_owner(self.owner_id.def_id)
3056 }
3057
3058 pub fn impl_item_id(&self) -> ImplItemId {
3059 ImplItemId { owner_id: self.owner_id }
3060 }
3061
3062 pub fn vis_span(&self) -> Option<Span> {
3063 match self.impl_kind {
3064 ImplItemImplKind::Trait { .. } => None,
3065 ImplItemImplKind::Inherent { vis_span, .. } => Some(vis_span),
3066 }
3067 }
3068
3069 #[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! {
3070 expect_const, (&'hir Ty<'hir>, ConstItemRhs<'hir>), ImplItemKind::Const(ty, rhs), (ty, *rhs);
3071 expect_fn, (&FnSig<'hir>, BodyId), ImplItemKind::Fn(ty, body), (ty, *body);
3072 expect_type, &'hir Ty<'hir>, ImplItemKind::Type(ty), ty;
3073 }
3074}
3075
3076#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ImplItemKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ImplItemKind::Const(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Const",
__self_0, &__self_1),
ImplItemKind::Fn(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Fn",
__self_0, &__self_1),
ImplItemKind::Type(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> ImplItemKind<'hir> {
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) {
::std::mem::discriminant(self).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)]
3078pub enum ImplItemKind<'hir> {
3079 Const(&'hir Ty<'hir>, ConstItemRhs<'hir>),
3082 Fn(FnSig<'hir>, BodyId),
3084 Type(&'hir Ty<'hir>),
3086}
3087
3088#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for AssocItemConstraint<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"AssocItemConstraint", "hir_id", &self.hir_id, "ident",
&self.ident, "gen_args", &self.gen_args, "kind", &self.kind,
"span", &&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]
fn clone(&self) -> AssocItemConstraint<'hir> {
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)]
3099pub struct AssocItemConstraint<'hir> {
3100 #[stable_hash(ignore)]
3101 pub hir_id: HirId,
3102 pub ident: Ident,
3103 pub gen_args: &'hir GenericArgs<'hir>,
3104 pub kind: AssocItemConstraintKind<'hir>,
3105 pub span: Span,
3106}
3107
3108impl<'hir> AssocItemConstraint<'hir> {
3109 pub fn ty(self) -> Option<&'hir Ty<'hir>> {
3111 match self.kind {
3112 AssocItemConstraintKind::Equality { term: Term::Ty(ty) } => Some(ty),
3113 _ => None,
3114 }
3115 }
3116
3117 pub fn ct(self) -> Option<&'hir ConstArg<'hir>> {
3119 match self.kind {
3120 AssocItemConstraintKind::Equality { term: Term::Const(ct) } => Some(ct),
3121 _ => None,
3122 }
3123 }
3124}
3125
3126#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Term<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Term::Ty(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ty",
&__self_0),
Term::Const(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> Term<'hir> {
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) {
::std::mem::discriminant(self).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)]
3127pub enum Term<'hir> {
3128 Ty(&'hir Ty<'hir>),
3129 Const(&'hir ConstArg<'hir>),
3130}
3131
3132impl<'hir> From<&'hir Ty<'hir>> for Term<'hir> {
3133 fn from(ty: &'hir Ty<'hir>) -> Self {
3134 Term::Ty(ty)
3135 }
3136}
3137
3138impl<'hir> From<&'hir ConstArg<'hir>> for Term<'hir> {
3139 fn from(c: &'hir ConstArg<'hir>) -> Self {
3140 Term::Const(c)
3141 }
3142}
3143
3144#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for AssocItemConstraintKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
AssocItemConstraintKind::Equality { term: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Equality", "term", &__self_0),
AssocItemConstraintKind::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]
fn clone(&self) -> AssocItemConstraintKind<'hir> {
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) {
::std::mem::discriminant(self).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)]
3146pub enum AssocItemConstraintKind<'hir> {
3147 Equality { term: Term<'hir> },
3154 Bound { bounds: &'hir [GenericBound<'hir>] },
3156}
3157
3158impl<'hir> AssocItemConstraintKind<'hir> {
3159 pub fn descr(&self) -> &'static str {
3160 match self {
3161 AssocItemConstraintKind::Equality { .. } => "binding",
3162 AssocItemConstraintKind::Bound { .. } => "constraint",
3163 }
3164 }
3165}
3166
3167#[derive(#[automatically_derived]
impl ::core::fmt::Debug for AmbigArg {
#[inline]
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]
fn clone(&self) -> AmbigArg { *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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {}
}
}
};StableHash)]
3171pub enum AmbigArg {}
3172
3173#[derive(#[automatically_derived]
impl<'hir, Unambig: ::core::fmt::Debug> ::core::fmt::Debug for
Ty<'hir, Unambig> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "Ty", "hir_id",
&self.hir_id, "span", &self.span, "kind", &&self.kind)
}
}Debug, #[automatically_derived]
impl<'hir, Unambig: ::core::clone::Clone> ::core::clone::Clone for
Ty<'hir, Unambig> {
#[inline]
fn clone(&self) -> Ty<'hir, Unambig> {
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)]
3178#[repr(C)]
3179pub struct Ty<'hir, Unambig = ()> {
3180 #[stable_hash(ignore)]
3181 pub hir_id: HirId,
3182 pub span: Span,
3183 pub kind: TyKind<'hir, Unambig>,
3184}
3185
3186impl<'hir> Ty<'hir, AmbigArg> {
3187 pub fn as_unambig_ty(&self) -> &Ty<'hir> {
3198 let ptr = self as *const Ty<'hir, AmbigArg> as *const Ty<'hir, ()>;
3201 unsafe { &*ptr }
3202 }
3203}
3204
3205impl<'hir> Ty<'hir> {
3206 pub fn try_as_ambig_ty(&self) -> Option<&Ty<'hir, AmbigArg>> {
3212 if let TyKind::Infer(()) = self.kind {
3213 return None;
3214 }
3215
3216 let ptr = self as *const Ty<'hir> as *const Ty<'hir, AmbigArg>;
3220 Some(unsafe { &*ptr })
3221 }
3222}
3223
3224impl<'hir> Ty<'hir, AmbigArg> {
3225 pub fn peel_refs(&self) -> &Ty<'hir> {
3226 let mut final_ty = self.as_unambig_ty();
3227 while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
3228 final_ty = ty;
3229 }
3230 final_ty
3231 }
3232}
3233
3234impl<'hir> Ty<'hir> {
3235 pub fn peel_refs(&self) -> &Self {
3236 let mut final_ty = self;
3237 while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
3238 final_ty = ty;
3239 }
3240 final_ty
3241 }
3242
3243 pub fn as_generic_param(&self) -> Option<(DefId, Ident)> {
3245 let TyKind::Path(QPath::Resolved(None, path)) = self.kind else {
3246 return None;
3247 };
3248 let [segment] = &path.segments else {
3249 return None;
3250 };
3251 match path.res {
3252 Res::Def(DefKind::TyParam, def_id) | Res::SelfTyParam { trait_: def_id } => {
3253 Some((def_id, segment.ident))
3254 }
3255 _ => None,
3256 }
3257 }
3258
3259 pub fn find_self_aliases(&self) -> Vec<Span> {
3260 use crate::intravisit::Visitor;
3261 struct MyVisitor(Vec<Span>);
3262 impl<'v> Visitor<'v> for MyVisitor {
3263 fn visit_ty(&mut self, t: &'v Ty<'v, AmbigArg>) {
3264 if #[allow(non_exhaustive_omitted_patterns)] match &t.kind {
TyKind::Path(QPath::Resolved(_, Path {
res: crate::def::Res::SelfTyAlias { .. }, .. })) => true,
_ => false,
}matches!(
3265 &t.kind,
3266 TyKind::Path(QPath::Resolved(
3267 _,
3268 Path { res: crate::def::Res::SelfTyAlias { .. }, .. },
3269 ))
3270 ) {
3271 self.0.push(t.span);
3272 return;
3273 }
3274 crate::intravisit::walk_ty(self, t);
3275 }
3276 }
3277
3278 let mut my_visitor = MyVisitor(::alloc::vec::Vec::new()vec![]);
3279 my_visitor.visit_ty_unambig(self);
3280 my_visitor.0
3281 }
3282
3283 pub fn is_suggestable_infer_ty(&self) -> bool {
3286 fn are_suggestable_generic_args(generic_args: &[GenericArg<'_>]) -> bool {
3287 generic_args.iter().any(|arg| match arg {
3288 GenericArg::Type(ty) => ty.as_unambig_ty().is_suggestable_infer_ty(),
3289 GenericArg::Infer(_) => true,
3290 _ => false,
3291 })
3292 }
3293 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_hir/src/hir.rs:3293",
"rustc_hir::hir", ::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_hir/src/hir.rs"),
::tracing_core::__macro_support::Option::Some(3293u32),
::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);
3294 match &self.kind {
3295 TyKind::Infer(()) => true,
3296 TyKind::Slice(ty) => ty.is_suggestable_infer_ty(),
3297 TyKind::Array(ty, length) => {
3298 ty.is_suggestable_infer_ty() || #[allow(non_exhaustive_omitted_patterns)] match length.kind {
ConstArgKind::Infer(..) => true,
_ => false,
}matches!(length.kind, ConstArgKind::Infer(..))
3299 }
3300 TyKind::Tup(tys) => tys.iter().any(Self::is_suggestable_infer_ty),
3301 TyKind::Ptr(mut_ty) | TyKind::Ref(_, mut_ty) => mut_ty.ty.is_suggestable_infer_ty(),
3302 TyKind::Path(QPath::TypeRelative(ty, segment)) => {
3303 ty.is_suggestable_infer_ty() || are_suggestable_generic_args(segment.args().args)
3304 }
3305 TyKind::Path(QPath::Resolved(ty_opt, Path { segments, .. })) => {
3306 ty_opt.is_some_and(Self::is_suggestable_infer_ty)
3307 || segments
3308 .iter()
3309 .any(|segment| are_suggestable_generic_args(segment.args().args))
3310 }
3311 _ => false,
3312 }
3313 }
3314}
3315
3316#[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]
fn clone(&self) -> PrimTy {
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: &PrimTy) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(PrimTy::Int(__self_0), PrimTy::Int(__arg1_0)) =>
__self_0 == __arg1_0,
(PrimTy::Uint(__self_0), PrimTy::Uint(__arg1_0)) =>
__self_0 == __arg1_0,
(PrimTy::Float(__self_0), PrimTy::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) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state);
match self {
PrimTy::Int(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
PrimTy::Uint(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
PrimTy::Float(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
_ => {}
}
}
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for PrimTy {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
PrimTy::Int(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Int",
&__self_0),
PrimTy::Uint(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Uint",
&__self_0),
PrimTy::Float(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Float",
&__self_0),
PrimTy::Str => ::core::fmt::Formatter::write_str(f, "Str"),
PrimTy::Bool => ::core::fmt::Formatter::write_str(f, "Bool"),
PrimTy::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) {
::std::mem::discriminant(self).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)]
3318pub enum PrimTy {
3319 Int(IntTy),
3320 Uint(UintTy),
3321 Float(FloatTy),
3322 Str,
3323 Bool,
3324 Char,
3325}
3326
3327impl PrimTy {
3328 pub const ALL: [Self; 19] = [
3330 Self::Int(IntTy::I8),
3332 Self::Int(IntTy::I16),
3333 Self::Int(IntTy::I32),
3334 Self::Int(IntTy::I64),
3335 Self::Int(IntTy::I128),
3336 Self::Int(IntTy::Isize),
3337 Self::Uint(UintTy::U8),
3338 Self::Uint(UintTy::U16),
3339 Self::Uint(UintTy::U32),
3340 Self::Uint(UintTy::U64),
3341 Self::Uint(UintTy::U128),
3342 Self::Uint(UintTy::Usize),
3343 Self::Float(FloatTy::F16),
3344 Self::Float(FloatTy::F32),
3345 Self::Float(FloatTy::F64),
3346 Self::Float(FloatTy::F128),
3347 Self::Bool,
3348 Self::Char,
3349 Self::Str,
3350 ];
3351
3352 pub fn name_str(self) -> &'static str {
3356 match self {
3357 PrimTy::Int(i) => i.name_str(),
3358 PrimTy::Uint(u) => u.name_str(),
3359 PrimTy::Float(f) => f.name_str(),
3360 PrimTy::Str => "str",
3361 PrimTy::Bool => "bool",
3362 PrimTy::Char => "char",
3363 }
3364 }
3365
3366 pub fn name(self) -> Symbol {
3367 match self {
3368 PrimTy::Int(i) => i.name(),
3369 PrimTy::Uint(u) => u.name(),
3370 PrimTy::Float(f) => f.name(),
3371 PrimTy::Str => sym::str,
3372 PrimTy::Bool => sym::bool,
3373 PrimTy::Char => sym::char,
3374 }
3375 }
3376
3377 pub fn from_name(name: Symbol) -> Option<Self> {
3380 let ty = match name {
3381 sym::i8 => Self::Int(IntTy::I8),
3383 sym::i16 => Self::Int(IntTy::I16),
3384 sym::i32 => Self::Int(IntTy::I32),
3385 sym::i64 => Self::Int(IntTy::I64),
3386 sym::i128 => Self::Int(IntTy::I128),
3387 sym::isize => Self::Int(IntTy::Isize),
3388 sym::u8 => Self::Uint(UintTy::U8),
3389 sym::u16 => Self::Uint(UintTy::U16),
3390 sym::u32 => Self::Uint(UintTy::U32),
3391 sym::u64 => Self::Uint(UintTy::U64),
3392 sym::u128 => Self::Uint(UintTy::U128),
3393 sym::usize => Self::Uint(UintTy::Usize),
3394 sym::f16 => Self::Float(FloatTy::F16),
3395 sym::f32 => Self::Float(FloatTy::F32),
3396 sym::f64 => Self::Float(FloatTy::F64),
3397 sym::f128 => Self::Float(FloatTy::F128),
3398 sym::bool => Self::Bool,
3399 sym::char => Self::Char,
3400 sym::str => Self::Str,
3401 _ => return None,
3402 };
3403 Some(ty)
3404 }
3405}
3406
3407#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FnPtrTy<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "FnPtrTy",
"safety", &self.safety, "abi", &self.abi, "generic_params",
&self.generic_params, "decl", &self.decl, "param_idents",
&&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]
fn clone(&self) -> FnPtrTy<'hir> {
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)]
3408pub struct FnPtrTy<'hir> {
3409 pub safety: Safety,
3410 pub abi: ExternAbi,
3411 pub generic_params: &'hir [GenericParam<'hir>],
3412 pub decl: &'hir FnDecl<'hir>,
3413 pub param_idents: &'hir [Option<Ident>],
3416}
3417
3418#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for UnsafeBinderTy<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"UnsafeBinderTy", "generic_params", &self.generic_params,
"inner_ty", &&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]
fn clone(&self) -> UnsafeBinderTy<'hir> {
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)]
3419pub struct UnsafeBinderTy<'hir> {
3420 pub generic_params: &'hir [GenericParam<'hir>],
3421 pub inner_ty: &'hir Ty<'hir>,
3422}
3423
3424#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for OpaqueTy<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "OpaqueTy",
"hir_id", &self.hir_id, "def_id", &self.def_id, "bounds",
&self.bounds, "origin", &self.origin, "span", &&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]
fn clone(&self) -> OpaqueTy<'hir> {
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)]
3425pub struct OpaqueTy<'hir> {
3426 #[stable_hash(ignore)]
3427 pub hir_id: HirId,
3428 pub def_id: LocalDefId,
3429 pub bounds: GenericBounds<'hir>,
3430 pub origin: OpaqueTyOrigin<LocalDefId>,
3431 pub span: Span,
3432}
3433
3434#[derive(#[automatically_derived]
impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug> ::core::fmt::Debug for
PreciseCapturingArgKind<T, U> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
PreciseCapturingArgKind::Lifetime(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Lifetime", &__self_0),
PreciseCapturingArgKind::Param(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> PreciseCapturingArgKind<T, U> {
match self {
PreciseCapturingArgKind::Lifetime(__self_0) =>
PreciseCapturingArgKind::Lifetime(::core::clone::Clone::clone(__self_0)),
PreciseCapturingArgKind::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) {
::std::mem::discriminant(self).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)]
3435pub enum PreciseCapturingArgKind<T, U> {
3436 Lifetime(T),
3437 Param(U),
3439}
3440
3441pub type PreciseCapturingArg<'hir> =
3442 PreciseCapturingArgKind<&'hir Lifetime, PreciseCapturingNonLifetimeArg>;
3443
3444impl PreciseCapturingArg<'_> {
3445 pub fn hir_id(self) -> HirId {
3446 match self {
3447 PreciseCapturingArg::Lifetime(lt) => lt.hir_id,
3448 PreciseCapturingArg::Param(param) => param.hir_id,
3449 }
3450 }
3451
3452 pub fn name(self) -> Symbol {
3453 match self {
3454 PreciseCapturingArg::Lifetime(lt) => lt.ident.name,
3455 PreciseCapturingArg::Param(param) => param.ident.name,
3456 }
3457 }
3458}
3459
3460#[derive(#[automatically_derived]
impl ::core::fmt::Debug for PreciseCapturingNonLifetimeArg {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"PreciseCapturingNonLifetimeArg", "hir_id", &self.hir_id, "ident",
&self.ident, "res", &&self.res)
}
}Debug, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for PreciseCapturingNonLifetimeArg { }
#[automatically_derived]
impl ::core::clone::Clone for PreciseCapturingNonLifetimeArg {
#[inline]
fn clone(&self) -> PreciseCapturingNonLifetimeArg {
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)]
3465pub struct PreciseCapturingNonLifetimeArg {
3466 #[stable_hash(ignore)]
3467 pub hir_id: HirId,
3468 pub ident: Ident,
3469 pub res: Res,
3470}
3471
3472#[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]
fn clone(&self) -> RpitContext { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for RpitContext { }
#[automatically_derived]
impl ::core::cmp::PartialEq for RpitContext {
#[inline]
fn eq(&self, other: &RpitContext) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for RpitContext {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for RpitContext {
#[inline]
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)]
3473#[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) {
::std::mem::discriminant(self).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)]
3474pub enum RpitContext {
3475 Trait,
3476 TraitImpl,
3477}
3478
3479#[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]
fn clone(&self) -> OpaqueTyOrigin<D> {
match self {
OpaqueTyOrigin::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),
},
OpaqueTyOrigin::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),
},
OpaqueTyOrigin::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: &OpaqueTyOrigin<D>) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(OpaqueTyOrigin::FnReturn {
parent: __self_0, in_trait_or_impl: __self_1 },
OpaqueTyOrigin::FnReturn {
parent: __arg1_0, in_trait_or_impl: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(OpaqueTyOrigin::AsyncFn {
parent: __self_0, in_trait_or_impl: __self_1 },
OpaqueTyOrigin::AsyncFn {
parent: __arg1_0, in_trait_or_impl: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(OpaqueTyOrigin::TyAlias {
parent: __self_0, in_assoc_ty: __self_1 },
OpaqueTyOrigin::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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
OpaqueTyOrigin::FnReturn {
parent: __self_0, in_trait_or_impl: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"FnReturn", "parent", __self_0, "in_trait_or_impl",
&__self_1),
OpaqueTyOrigin::AsyncFn {
parent: __self_0, in_trait_or_impl: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"AsyncFn", "parent", __self_0, "in_trait_or_impl",
&__self_1),
OpaqueTyOrigin::TyAlias { parent: __self_0, in_assoc_ty: __self_1
} =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TyAlias", "parent", __self_0, "in_assoc_ty", &__self_1),
}
}
}Debug)]
3481#[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) {
::std::mem::discriminant(self).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)]
3482pub enum OpaqueTyOrigin<D> {
3483 FnReturn {
3485 parent: D,
3487 in_trait_or_impl: Option<RpitContext>,
3489 },
3490 AsyncFn {
3492 parent: D,
3494 in_trait_or_impl: Option<RpitContext>,
3496 },
3497 TyAlias {
3499 parent: D,
3501 in_assoc_ty: bool,
3503 },
3504}
3505
3506#[derive(#[automatically_derived]
impl ::core::fmt::Debug for DelegationSelfTyPropagationKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
DelegationSelfTyPropagationKind::SelfTy(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "SelfTy",
&__self_0),
DelegationSelfTyPropagationKind::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]
fn clone(&self) -> DelegationSelfTyPropagationKind {
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: &DelegationSelfTyPropagationKind) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(DelegationSelfTyPropagationKind::SelfTy(__self_0),
DelegationSelfTyPropagationKind::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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
DelegationSelfTyPropagationKind::SelfTy(ref __binding_0) =>
{
{ __binding_0.stable_hash(__hcx, __hasher); }
}
DelegationSelfTyPropagationKind::SelfParam => {}
}
}
}
};StableHash)]
3507pub enum DelegationSelfTyPropagationKind {
3508 SelfTy(HirId ),
3511 SelfParam,
3514}
3515
3516#[derive(#[automatically_derived]
impl ::core::fmt::Debug for DelegationInfo {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["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"];
let values: &[&dyn ::core::fmt::Debug] =
&[&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];
::core::fmt::Formatter::debug_struct_fields_finish(f,
"DelegationInfo", names, values)
}
}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)]
3517pub struct DelegationInfo {
3518 pub call_expr_id: HirId,
3519 pub call_path_res: DefId,
3520
3521 pub child_seg_id: HirId,
3524
3525 pub parent_seg_id_for_sig: Option<HirId>,
3531 pub child_seg_id_for_sig: Option<HirId>,
3532
3533 pub self_ty_propagation_kind: Option<DelegationSelfTyPropagationKind>,
3534 pub group_id: Option<(LocalExpnId, bool )>,
3535
3536 pub arguments_to_map: FxIndexSet<usize>,
3537}
3538
3539#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for InferDelegationSig<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
InferDelegationSig::Input(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Input",
&__self_0),
InferDelegationSig::Output(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> InferDelegationSig<'hir> {
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) {
::std::mem::discriminant(self).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)]
3540pub enum InferDelegationSig<'hir> {
3541 Input(usize),
3542 Output(&'hir DelegationInfo),
3544}
3545
3546#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for InferDelegation<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
InferDelegation::DefId(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "DefId",
&__self_0),
InferDelegation::Sig(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> InferDelegation<'hir> {
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) {
::std::mem::discriminant(self).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)]
3547pub enum InferDelegation<'hir> {
3548 DefId(DefId),
3551 Sig(DefId, InferDelegationSig<'hir>),
3553}
3554
3555#[repr(u8, C)]
3561#[derive(#[automatically_derived]
impl<'hir, Unambig: ::core::fmt::Debug> ::core::fmt::Debug for
TyKind<'hir, Unambig> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
TyKind::InferDelegation(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"InferDelegation", &__self_0),
TyKind::Slice(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Slice",
&__self_0),
TyKind::Array(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Array",
__self_0, &__self_1),
TyKind::Ptr(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ptr",
&__self_0),
TyKind::Ref(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Ref",
__self_0, &__self_1),
TyKind::FnPtr(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "FnPtr",
&__self_0),
TyKind::UnsafeBinder(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"UnsafeBinder", &__self_0),
TyKind::Never => ::core::fmt::Formatter::write_str(f, "Never"),
TyKind::Tup(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Tup",
&__self_0),
TyKind::Path(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Path",
&__self_0),
TyKind::OpaqueDef(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"OpaqueDef", &__self_0),
TyKind::TraitAscription(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TraitAscription", &__self_0),
TyKind::TraitObject(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f,
"TraitObject", __self_0, &__self_1),
TyKind::Err(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Err",
&__self_0),
TyKind::Pat(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Pat",
__self_0, &__self_1),
TyKind::FieldOf(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f,
"FieldOf", __self_0, &__self_1),
TyKind::View(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "View",
__self_0, &__self_1),
TyKind::Infer(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Infer",
&__self_0),
}
}
}Debug, #[automatically_derived]
impl<'hir, Unambig: ::core::clone::Clone> ::core::clone::Clone for
TyKind<'hir, Unambig> {
#[inline]
fn clone(&self) -> TyKind<'hir, Unambig> {
match self {
TyKind::InferDelegation(__self_0) =>
TyKind::InferDelegation(::core::clone::Clone::clone(__self_0)),
TyKind::Slice(__self_0) =>
TyKind::Slice(::core::clone::Clone::clone(__self_0)),
TyKind::Array(__self_0, __self_1) =>
TyKind::Array(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
TyKind::Ptr(__self_0) =>
TyKind::Ptr(::core::clone::Clone::clone(__self_0)),
TyKind::Ref(__self_0, __self_1) =>
TyKind::Ref(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
TyKind::FnPtr(__self_0) =>
TyKind::FnPtr(::core::clone::Clone::clone(__self_0)),
TyKind::UnsafeBinder(__self_0) =>
TyKind::UnsafeBinder(::core::clone::Clone::clone(__self_0)),
TyKind::Never => TyKind::Never,
TyKind::Tup(__self_0) =>
TyKind::Tup(::core::clone::Clone::clone(__self_0)),
TyKind::Path(__self_0) =>
TyKind::Path(::core::clone::Clone::clone(__self_0)),
TyKind::OpaqueDef(__self_0) =>
TyKind::OpaqueDef(::core::clone::Clone::clone(__self_0)),
TyKind::TraitAscription(__self_0) =>
TyKind::TraitAscription(::core::clone::Clone::clone(__self_0)),
TyKind::TraitObject(__self_0, __self_1) =>
TyKind::TraitObject(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
TyKind::Err(__self_0) =>
TyKind::Err(::core::clone::Clone::clone(__self_0)),
TyKind::Pat(__self_0, __self_1) =>
TyKind::Pat(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
TyKind::FieldOf(__self_0, __self_1) =>
TyKind::FieldOf(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
TyKind::View(__self_0, __self_1) =>
TyKind::View(::core::clone::Clone::clone(__self_0),
::core::clone::Clone::clone(__self_1)),
TyKind::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) {
::std::mem::discriminant(self).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) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
TyKind::Ref(ref __binding_0, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.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)]
3562pub enum TyKind<'hir, Unambig = ()> {
3563 InferDelegation(InferDelegation<'hir>),
3565 Slice(&'hir Ty<'hir>),
3567 Array(&'hir Ty<'hir>, &'hir ConstArg<'hir>),
3569 Ptr(MutTy<'hir>),
3571 Ref(&'hir Lifetime, MutTy<'hir>),
3573 FnPtr(&'hir FnPtrTy<'hir>),
3575 UnsafeBinder(&'hir UnsafeBinderTy<'hir>),
3577 Never,
3579 Tup(&'hir [Ty<'hir>]),
3581 Path(QPath<'hir>),
3586 OpaqueDef(&'hir OpaqueTy<'hir>),
3588 TraitAscription(GenericBounds<'hir>),
3590 TraitObject(&'hir [PolyTraitRef<'hir>], TaggedRef<'hir, Lifetime, TraitObjectSyntax>),
3596 Err(rustc_span::ErrorGuaranteed),
3598 Pat(&'hir Ty<'hir>, &'hir TyPat<'hir>),
3600 FieldOf(&'hir Ty<'hir>, &'hir TyFieldPath),
3604 View(&'hir Ty<'hir>, &'hir [Ident]),
3606 Infer(Unambig),
3612}
3613
3614#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for InlineAsmOperand<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
InlineAsmOperand::In { reg: __self_0, expr: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "In",
"reg", __self_0, "expr", &__self_1),
InlineAsmOperand::Out {
reg: __self_0, late: __self_1, expr: __self_2 } =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Out",
"reg", __self_0, "late", __self_1, "expr", &__self_2),
InlineAsmOperand::InOut {
reg: __self_0, late: __self_1, expr: __self_2 } =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "InOut",
"reg", __self_0, "late", __self_1, "expr", &__self_2),
InlineAsmOperand::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", __self_0, "late", __self_1, "in_expr",
__self_2, "out_expr", &__self_3),
InlineAsmOperand::Const { anon_const: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
"anon_const", &__self_0),
InlineAsmOperand::SymFn { expr: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "SymFn",
"expr", &__self_0),
InlineAsmOperand::SymStatic { path: __self_0, def_id: __self_1 }
=>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"SymStatic", "path", __self_0, "def_id", &__self_1),
InlineAsmOperand::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]
fn clone(&self) -> InlineAsmOperand<'hir> {
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) {
::std::mem::discriminant(self).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)]
3615pub enum InlineAsmOperand<'hir> {
3616 In {
3617 reg: InlineAsmRegOrRegClass,
3618 expr: &'hir Expr<'hir>,
3619 },
3620 Out {
3621 reg: InlineAsmRegOrRegClass,
3622 late: bool,
3623 expr: Option<&'hir Expr<'hir>>,
3624 },
3625 InOut {
3626 reg: InlineAsmRegOrRegClass,
3627 late: bool,
3628 expr: &'hir Expr<'hir>,
3629 },
3630 SplitInOut {
3631 reg: InlineAsmRegOrRegClass,
3632 late: bool,
3633 in_expr: &'hir Expr<'hir>,
3634 out_expr: Option<&'hir Expr<'hir>>,
3635 },
3636 Const {
3637 anon_const: ConstBlock,
3638 },
3639 SymFn {
3640 expr: &'hir Expr<'hir>,
3641 },
3642 SymStatic {
3643 path: QPath<'hir>,
3644 def_id: DefId,
3645 },
3646 Label {
3647 block: &'hir Block<'hir>,
3648 },
3649}
3650
3651impl<'hir> InlineAsmOperand<'hir> {
3652 pub fn reg(&self) -> Option<InlineAsmRegOrRegClass> {
3653 match *self {
3654 Self::In { reg, .. }
3655 | Self::Out { reg, .. }
3656 | Self::InOut { reg, .. }
3657 | Self::SplitInOut { reg, .. } => Some(reg),
3658 Self::Const { .. }
3659 | Self::SymFn { .. }
3660 | Self::SymStatic { .. }
3661 | Self::Label { .. } => None,
3662 }
3663 }
3664
3665 pub fn is_clobber(&self) -> bool {
3666 #[allow(non_exhaustive_omitted_patterns)] match self {
InlineAsmOperand::Out {
reg: InlineAsmRegOrRegClass::Reg(_), late: _, expr: None } => true,
_ => false,
}matches!(
3667 self,
3668 InlineAsmOperand::Out { reg: InlineAsmRegOrRegClass::Reg(_), late: _, expr: None }
3669 )
3670 }
3671}
3672
3673#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for InlineAsm<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["asm_macro", "template", "template_strs", "operands", "options",
"line_spans"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.asm_macro, &self.template, &self.template_strs,
&self.operands, &self.options, &&self.line_spans];
::core::fmt::Formatter::debug_struct_fields_finish(f, "InlineAsm",
names, values)
}
}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]
fn clone(&self) -> InlineAsm<'hir> {
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)]
3674pub struct InlineAsm<'hir> {
3675 pub asm_macro: ast::AsmMacro,
3676 pub template: &'hir [InlineAsmTemplatePiece],
3677 pub template_strs: &'hir [(Symbol, Option<Symbol>, Span)],
3678 pub operands: &'hir [(InlineAsmOperand<'hir>, Span)],
3679 pub options: InlineAsmOptions,
3680 pub line_spans: &'hir [Span],
3681}
3682
3683impl InlineAsm<'_> {
3684 pub fn contains_label(&self) -> bool {
3685 self.operands.iter().any(|x| #[allow(non_exhaustive_omitted_patterns)] match x.0 {
InlineAsmOperand::Label { .. } => true,
_ => false,
}matches!(x.0, InlineAsmOperand::Label { .. }))
3686 }
3687}
3688
3689#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Param<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "Param",
"hir_id", &self.hir_id, "pat", &self.pat, "ty_span",
&self.ty_span, "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]
fn clone(&self) -> Param<'hir> {
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)]
3691pub struct Param<'hir> {
3692 #[stable_hash(ignore)]
3693 pub hir_id: HirId,
3694 pub pat: &'hir Pat<'hir>,
3695 pub ty_span: Span,
3696 pub span: Span,
3697}
3698
3699#[derive(#[automatically_derived]
impl ::core::fmt::Debug for SplattedArgIndexError {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
SplattedArgIndexError::InvalidIndex { splatted_arg_index: __self_0
} =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"InvalidIndex", "splatted_arg_index", &__self_0),
SplattedArgIndexError::OutOfBounds {
splatted_arg_index: __self_0, args_len: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"OutOfBounds", "splatted_arg_index", __self_0, "args_len",
&__self_1),
}
}
}Debug, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for SplattedArgIndexError { }
#[automatically_derived]
impl ::core::clone::Clone for SplattedArgIndexError {
#[inline]
fn clone(&self) -> SplattedArgIndexError {
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: &SplattedArgIndexError) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(SplattedArgIndexError::InvalidIndex {
splatted_arg_index: __self_0 },
SplattedArgIndexError::InvalidIndex {
splatted_arg_index: __arg1_0 }) => __self_0 == __arg1_0,
(SplattedArgIndexError::OutOfBounds {
splatted_arg_index: __self_0, args_len: __self_1 },
SplattedArgIndexError::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)]
3701pub enum SplattedArgIndexError {
3702 InvalidIndex { splatted_arg_index: u8 },
3706
3707 OutOfBounds { splatted_arg_index: u8, args_len: u16 },
3709}
3710
3711#[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]
fn clone(&self) -> FnDeclFlags {
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: &FnDeclFlags) -> 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: &FnDeclFlags)
-> ::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: &FnDeclFlags) -> ::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)]
3713#[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)]
3714pub struct FnDeclFlags {
3715 flags: u8,
3717
3718 splatted: u8,
3722}
3723
3724impl fmt::Debug for FnDeclFlags {
3725 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3726 let mut f = f.debug_tuple("FnDeclFlags");
3727 f.field(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("ImplicitSelfKind({0:?})",
self.implicit_self()))
})format!("ImplicitSelfKind({:?})", self.implicit_self()));
3728
3729 if self.lifetime_elision_allowed() {
3730 f.field(&"LifetimeElisionAllowed");
3731 } else {
3732 f.field(&"NoLifetimeElision");
3733 }
3734
3735 if self.c_variadic() {
3736 f.field(&"CVariadic");
3737 }
3738
3739 if let Some(index) = self.splatted() {
3740 f.field(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Splatted({0})", index))
})format!("Splatted({})", index));
3741 }
3742
3743 f.finish()
3744 }
3745}
3746
3747impl FnDeclFlags {
3748 const IMPLICIT_SELF_MASK: u8 = 0b111;
3750
3751 const C_VARIADIC_FLAG: u8 = 1 << 3;
3753
3754 const LIFETIME_ELISION_ALLOWED_FLAG: u8 = 1 << 4;
3756
3757 const NO_SPLATTED_ARG_INDEX: u8 = u8::MAX;
3760
3761 pub fn default() -> Self {
3766 Self { flags: 0, splatted: 0 }
3767 .set_implicit_self(ImplicitSelfKind::None)
3768 .set_lifetime_elision_allowed(false)
3769 .set_c_variadic(false)
3770 .set_no_splatted_args()
3771 }
3772
3773 #[must_use = "this method does not modify the receiver"]
3775 pub fn set_implicit_self(mut self, implicit_self: ImplicitSelfKind) -> Self {
3776 self.flags &= !Self::IMPLICIT_SELF_MASK;
3777
3778 match implicit_self {
3779 ImplicitSelfKind::None => self.flags |= 0,
3780 ImplicitSelfKind::Imm => self.flags |= 1,
3781 ImplicitSelfKind::Mut => self.flags |= 2,
3782 ImplicitSelfKind::RefImm => self.flags |= 3,
3783 ImplicitSelfKind::RefMut => self.flags |= 4,
3784 }
3785
3786 self
3787 }
3788
3789 #[must_use = "this method does not modify the receiver"]
3791 pub fn set_c_variadic(mut self, c_variadic: bool) -> Self {
3792 if c_variadic {
3793 self.flags |= Self::C_VARIADIC_FLAG;
3794 } else {
3795 self.flags &= !Self::C_VARIADIC_FLAG;
3796 }
3797
3798 self
3799 }
3800
3801 #[must_use = "this method does not modify the receiver"]
3803 pub fn set_lifetime_elision_allowed(mut self, allowed: bool) -> Self {
3804 if allowed {
3805 self.flags |= Self::LIFETIME_ELISION_ALLOWED_FLAG;
3806 } else {
3807 self.flags &= !Self::LIFETIME_ELISION_ALLOWED_FLAG;
3808 }
3809
3810 self
3811 }
3812
3813 #[must_use = "this method does not modify the receiver"]
3816 pub fn set_splatted(
3817 mut self,
3818 splatted: Option<u8>,
3819 args_len: usize,
3820 ) -> Result<Self, SplattedArgIndexError> {
3821 if let Some(splatted_arg_index) = splatted {
3822 if splatted_arg_index == Self::NO_SPLATTED_ARG_INDEX {
3823 return Err(SplattedArgIndexError::InvalidIndex { splatted_arg_index });
3826 } else if usize::from(splatted_arg_index) >= args_len {
3827 return Err(SplattedArgIndexError::OutOfBounds {
3828 splatted_arg_index,
3829 args_len: args_len as u16,
3830 });
3831 }
3832
3833 self.splatted = splatted_arg_index;
3834 } else {
3835 self.splatted = Self::NO_SPLATTED_ARG_INDEX;
3836 }
3837
3838 Ok(self)
3839 }
3840
3841 #[must_use = "this method does not modify the receiver"]
3843 pub fn set_no_splatted_args(mut self) -> Self {
3844 self.splatted = Self::NO_SPLATTED_ARG_INDEX;
3845
3846 self
3847 }
3848
3849 pub fn implicit_self(self) -> ImplicitSelfKind {
3851 match self.flags & Self::IMPLICIT_SELF_MASK {
3852 0 => ImplicitSelfKind::None,
3853 1 => ImplicitSelfKind::Imm,
3854 2 => ImplicitSelfKind::Mut,
3855 3 => ImplicitSelfKind::RefImm,
3856 4 => ImplicitSelfKind::RefMut,
3857 _ => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
3858 }
3859 }
3860
3861 pub fn c_variadic(self) -> bool {
3863 self.flags & Self::C_VARIADIC_FLAG != 0
3864 }
3865
3866 pub fn lifetime_elision_allowed(self) -> bool {
3868 self.flags & Self::LIFETIME_ELISION_ALLOWED_FLAG != 0
3869 }
3870
3871 pub fn splatted(self) -> Option<u8> {
3873 if self.splatted == Self::NO_SPLATTED_ARG_INDEX { None } else { Some(self.splatted) }
3874 }
3875}
3876
3877#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FnDecl<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "FnDecl",
"inputs", &self.inputs, "output", &self.output, "fn_decl_kind",
&&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]
fn clone(&self) -> FnDecl<'hir> {
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)]
3879pub struct FnDecl<'hir> {
3880 pub inputs: &'hir [Ty<'hir>],
3884 pub output: FnRetTy<'hir>,
3885 pub fn_decl_kind: FnDeclFlags,
3887}
3888
3889impl<'hir> FnDecl<'hir> {
3890 pub fn opt_delegation_sig_id(&self) -> Option<DefId> {
3891 if let FnRetTy::Return(ty) = self.output
3892 && let TyKind::InferDelegation(InferDelegation::Sig(sig_id, _)) = ty.kind
3893 {
3894 return Some(sig_id);
3895 }
3896 None
3897 }
3898
3899 pub fn opt_delegation_info(&self) -> Option<&'hir DelegationInfo> {
3900 if let FnRetTy::Return(ty) = self.output
3901 && let TyKind::InferDelegation(InferDelegation::Sig(_, kind)) = ty.kind
3902 && let InferDelegationSig::Output(generics) = kind
3903 {
3904 return Some(generics);
3905 }
3906
3907 None
3908 }
3909
3910 pub fn implicit_self(&self) -> ImplicitSelfKind {
3911 self.fn_decl_kind.implicit_self()
3912 }
3913
3914 pub fn c_variadic(&self) -> bool {
3915 self.fn_decl_kind.c_variadic()
3916 }
3917
3918 pub fn lifetime_elision_allowed(&self) -> bool {
3919 self.fn_decl_kind.lifetime_elision_allowed()
3920 }
3921
3922 pub fn splatted(&self) -> Option<u8> {
3923 self.fn_decl_kind.splatted()
3924 }
3925
3926 pub fn dummy(span: Span) -> Self {
3927 Self {
3928 inputs: &[],
3929 output: FnRetTy::DefaultReturn(span),
3930 fn_decl_kind: FnDeclFlags::default().set_lifetime_elision_allowed(true),
3931 }
3932 }
3933}
3934
3935#[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]
fn clone(&self) -> ImplicitSelfKind { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for ImplicitSelfKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for ImplicitSelfKind {
#[inline]
fn eq(&self, other: &ImplicitSelfKind) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ImplicitSelfKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
ImplicitSelfKind::Imm => "Imm",
ImplicitSelfKind::Mut => "Mut",
ImplicitSelfKind::RefImm => "RefImm",
ImplicitSelfKind::RefMut => "RefMut",
ImplicitSelfKind::None => "None",
})
}
}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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
ImplicitSelfKind::Imm => {}
ImplicitSelfKind::Mut => {}
ImplicitSelfKind::RefImm => {}
ImplicitSelfKind::RefMut => {}
ImplicitSelfKind::None => {}
}
}
}
};StableHash)]
3937pub enum ImplicitSelfKind {
3938 Imm,
3940 Mut,
3942 RefImm,
3944 RefMut,
3946 None,
3949}
3950
3951impl ImplicitSelfKind {
3952 pub fn has_implicit_self(&self) -> bool {
3954 !#[allow(non_exhaustive_omitted_patterns)] match *self {
ImplicitSelfKind::None => true,
_ => false,
}matches!(*self, ImplicitSelfKind::None)
3955 }
3956}
3957
3958#[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]
fn clone(&self) -> IsAsync {
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: &IsAsync) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(IsAsync::Async(__self_0), IsAsync::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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
IsAsync::Async(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Async",
&__self_0),
IsAsync::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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
IsAsync::Async(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
IsAsync::NotAsync => {}
}
}
}
};StableHash)]
3959pub enum IsAsync {
3960 Async(Span),
3961 NotAsync,
3962}
3963
3964impl IsAsync {
3965 pub fn is_async(self) -> bool {
3966 #[allow(non_exhaustive_omitted_patterns)] match self {
IsAsync::Async(_) => true,
_ => false,
}matches!(self, IsAsync::Async(_))
3967 }
3968}
3969
3970#[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]
fn clone(&self) -> Defaultness {
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: &Defaultness) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(Defaultness::Default { has_value: __self_0 },
Defaultness::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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Defaultness::Default { has_value: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Default", "has_value", &__self_0),
Defaultness::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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
Defaultness::Default { has_value: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Defaultness::Final => {}
}
}
}
};StableHash)]
3971#[derive(#[automatically_derived]
impl ::core::default::Default for Defaultness {
#[inline]
fn default() -> Defaultness { Self::Final }
}Default)]
3972pub enum Defaultness {
3973 Default {
3974 has_value: bool,
3975 },
3976 #[default]
3977 Final,
3978}
3979
3980impl Defaultness {
3981 pub fn has_value(&self) -> bool {
3982 match *self {
3983 Defaultness::Default { has_value } => has_value,
3984 Defaultness::Final => true,
3985 }
3986 }
3987
3988 pub fn is_final(&self) -> bool {
3989 *self == Defaultness::Final
3990 }
3991
3992 pub fn is_default(&self) -> bool {
3993 #[allow(non_exhaustive_omitted_patterns)] match *self {
Defaultness::Default { .. } => true,
_ => false,
}matches!(*self, Defaultness::Default { .. })
3994 }
3995}
3996
3997#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FnRetTy<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
FnRetTy::DefaultReturn(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"DefaultReturn", &__self_0),
FnRetTy::Return(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> FnRetTy<'hir> {
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) {
::std::mem::discriminant(self).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)]
3998pub enum FnRetTy<'hir> {
3999 DefaultReturn(Span),
4005 Return(&'hir Ty<'hir>),
4007}
4008
4009impl<'hir> FnRetTy<'hir> {
4010 #[inline]
4011 pub fn span(&self) -> Span {
4012 match *self {
4013 Self::DefaultReturn(span) => span,
4014 Self::Return(ref ty) => ty.span,
4015 }
4016 }
4017
4018 pub fn is_suggestable_infer_ty(&self) -> Option<&'hir Ty<'hir>> {
4019 if let Self::Return(ty) = self
4020 && ty.is_suggestable_infer_ty()
4021 {
4022 return Some(*ty);
4023 }
4024 None
4025 }
4026}
4027
4028#[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]
fn clone(&self) -> ClosureBinder {
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ClosureBinder {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ClosureBinder::Default =>
::core::fmt::Formatter::write_str(f, "Default"),
ClosureBinder::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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
ClosureBinder::Default => {}
ClosureBinder::For { span: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4030pub enum ClosureBinder {
4031 Default,
4033 For { span: Span },
4037}
4038
4039#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Mod<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "Mod", "spans",
&self.spans, "item_ids", &&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]
fn clone(&self) -> Mod<'hir> {
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)]
4040pub struct Mod<'hir> {
4041 pub spans: ModSpans,
4042 pub item_ids: &'hir [ItemId],
4043}
4044
4045#[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]
fn clone(&self) -> ModSpans {
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ModSpans {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "ModSpans",
"inner_span", &self.inner_span, "inject_use_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)]
4046pub struct ModSpans {
4047 pub inner_span: Span,
4051 pub inject_use_span: Span,
4052}
4053
4054#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for EnumDef<'hir> {
#[inline]
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]
fn clone(&self) -> EnumDef<'hir> {
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)]
4055pub struct EnumDef<'hir> {
4056 pub variants: &'hir [Variant<'hir>],
4057}
4058
4059#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Variant<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["ident", "hir_id", "def_id", "data", "disr_expr", "span"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.ident, &self.hir_id, &self.def_id, &self.data,
&self.disr_expr, &&self.span];
::core::fmt::Formatter::debug_struct_fields_finish(f, "Variant",
names, values)
}
}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]
fn clone(&self) -> Variant<'hir> {
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)]
4060pub struct Variant<'hir> {
4061 pub ident: Ident,
4063 #[stable_hash(ignore)]
4065 pub hir_id: HirId,
4066 pub def_id: LocalDefId,
4067 pub data: VariantData<'hir>,
4069 pub disr_expr: Option<&'hir AnonConst>,
4071 pub span: Span,
4073}
4074
4075#[derive(#[automatically_derived]
impl ::core::marker::Copy for UseKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for UseKind { }
#[automatically_derived]
impl ::core::clone::Clone for UseKind {
#[inline]
fn clone(&self) -> UseKind {
let _: ::core::clone::AssertParamIsClone<Ident>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for UseKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for UseKind {
#[inline]
fn eq(&self, other: &UseKind) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(UseKind::Single(__self_0), UseKind::Single(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for UseKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
UseKind::Single(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Single",
&__self_0),
UseKind::Glob => ::core::fmt::Formatter::write_str(f, "Glob"),
UseKind::ListStem =>
::core::fmt::Formatter::write_str(f, "ListStem"),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for UseKind {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
UseKind::Single(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
UseKind::Glob => {}
UseKind::ListStem => {}
}
}
}
};StableHash)]
4076pub enum UseKind {
4077 Single(Ident),
4084
4085 Glob,
4087
4088 ListStem,
4092}
4093
4094#[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]
fn clone(&self) -> TraitRef<'hir> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "TraitRef",
"path", &self.path, "hir_ref_id", &&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)]
4101pub struct TraitRef<'hir> {
4102 pub path: &'hir Path<'hir>,
4103 #[stable_hash(ignore)]
4105 pub hir_ref_id: HirId,
4106}
4107
4108impl TraitRef<'_> {
4109 pub fn trait_def_id(&self) -> Option<DefId> {
4111 match self.path.res {
4112 Res::Def(DefKind::Trait | DefKind::TraitAlias, did) => Some(did),
4113 Res::Err => None,
4114 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"),
4115 }
4116 }
4117}
4118
4119#[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]
fn clone(&self) -> PolyTraitRef<'hir> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "PolyTraitRef",
"bound_generic_params", &self.bound_generic_params, "modifiers",
&self.modifiers, "trait_ref", &self.trait_ref, "span",
&&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)]
4120pub struct PolyTraitRef<'hir> {
4121 pub bound_generic_params: &'hir [GenericParam<'hir>],
4123
4124 pub modifiers: TraitBoundModifiers,
4128
4129 pub trait_ref: TraitRef<'hir>,
4131
4132 pub span: Span,
4133}
4134
4135#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FieldDef<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["span", "vis_span", "mut_restriction", "ident", "hir_id",
"def_id", "ty", "safety", "default"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.span, &self.vis_span, &self.mut_restriction, &self.ident,
&self.hir_id, &self.def_id, &self.ty, &self.safety,
&&self.default];
::core::fmt::Formatter::debug_struct_fields_finish(f, "FieldDef",
names, values)
}
}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]
fn clone(&self) -> FieldDef<'hir> {
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)]
4136pub struct FieldDef<'hir> {
4137 pub span: Span,
4138 pub vis_span: Span,
4139 pub mut_restriction: &'hir MutRestriction<'hir>,
4140 pub ident: Ident,
4141 #[stable_hash(ignore)]
4142 pub hir_id: HirId,
4143 pub def_id: LocalDefId,
4144 pub ty: &'hir Ty<'hir>,
4145 pub safety: Safety,
4146 pub default: Option<&'hir AnonConst>,
4147}
4148
4149impl FieldDef<'_> {
4150 pub fn is_positional(&self) -> bool {
4152 self.ident.as_str().as_bytes()[0].is_ascii_digit()
4153 }
4154}
4155
4156#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for VariantData<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
VariantData::Struct { fields: __self_0, recovered: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Struct", "fields", __self_0, "recovered", &__self_1),
VariantData::Tuple(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Tuple",
__self_0, __self_1, &__self_2),
VariantData::Unit(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> VariantData<'hir> {
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) {
::std::mem::discriminant(self).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)]
4158pub enum VariantData<'hir> {
4159 Struct { fields: &'hir [FieldDef<'hir>], recovered: ast::Recovered },
4163 Tuple(&'hir [FieldDef<'hir>], #[stable_hash(ignore)] HirId, LocalDefId),
4167 Unit(#[stable_hash(ignore)] HirId, LocalDefId),
4171}
4172
4173impl<'hir> VariantData<'hir> {
4174 pub fn fields(&self) -> &'hir [FieldDef<'hir>] {
4176 match *self {
4177 VariantData::Struct { fields, .. } | VariantData::Tuple(fields, ..) => fields,
4178 _ => &[],
4179 }
4180 }
4181
4182 pub fn ctor(&self) -> Option<(CtorKind, HirId, LocalDefId)> {
4183 match *self {
4184 VariantData::Tuple(_, hir_id, def_id) => Some((CtorKind::Fn, hir_id, def_id)),
4185 VariantData::Unit(hir_id, def_id) => Some((CtorKind::Const, hir_id, def_id)),
4186 VariantData::Struct { .. } => None,
4187 }
4188 }
4189
4190 #[inline]
4191 pub fn ctor_kind(&self) -> Option<CtorKind> {
4192 self.ctor().map(|(kind, ..)| kind)
4193 }
4194
4195 #[inline]
4197 pub fn ctor_hir_id(&self) -> Option<HirId> {
4198 self.ctor().map(|(_, hir_id, _)| hir_id)
4199 }
4200
4201 #[inline]
4203 pub fn ctor_def_id(&self) -> Option<LocalDefId> {
4204 self.ctor().map(|(.., def_id)| def_id)
4205 }
4206}
4207
4208#[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]
fn clone(&self) -> ItemId {
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: &ItemId) -> 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]
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)]
4212pub struct ItemId {
4213 pub owner_id: OwnerId,
4214}
4215
4216impl ItemId {
4217 #[inline]
4218 pub fn hir_id(&self) -> HirId {
4219 HirId::make_owner(self.owner_id.def_id)
4221 }
4222}
4223
4224#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Item<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "Item",
"owner_id", &self.owner_id, "kind", &self.kind, "span",
&self.span, "vis_span", &self.vis_span, "eii", &&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]
fn clone(&self) -> Item<'hir> {
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)]
4233pub struct Item<'hir> {
4234 pub owner_id: OwnerId,
4235 pub kind: ItemKind<'hir>,
4236 pub span: Span,
4237 pub vis_span: Span,
4238 pub eii: bool,
4241}
4242
4243impl<'hir> Item<'hir> {
4244 #[inline]
4245 pub fn hir_id(&self) -> HirId {
4246 HirId::make_owner(self.owner_id.def_id)
4248 }
4249
4250 #[inline]
4251 pub fn item_id(&self) -> ItemId {
4252 ItemId { owner_id: self.owner_id }
4253 }
4254
4255 pub fn is_adt(&self) -> bool {
4258 #[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(..))
4259 }
4260
4261 pub fn is_struct_or_union(&self) -> bool {
4263 #[allow(non_exhaustive_omitted_patterns)] match self.kind {
ItemKind::Struct(..) | ItemKind::Union(..) => true,
_ => false,
}matches!(self.kind, ItemKind::Struct(..) | ItemKind::Union(..))
4264 }
4265
4266 #[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) -> (&'hir UsePath<'hir>, UseKind) {
let ItemKind::Use(p, uk) =
&self.kind else { expect_failed("expect_use", self) };
(p, *uk)
}
#[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! {
4267 expect_extern_crate, (Option<Symbol>, Ident),
4268 ItemKind::ExternCrate(s, ident), (*s, *ident);
4269
4270 expect_use, (&'hir UsePath<'hir>, UseKind), ItemKind::Use(p, uk), (p, *uk);
4271
4272 expect_static, (Mutability, Ident, &'hir Ty<'hir>, BodyId),
4273 ItemKind::Static(mutbl, ident, ty, body), (*mutbl, *ident, ty, *body);
4274
4275 expect_const, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, ConstItemRhs<'hir>),
4276 ItemKind::Const(ident, generics, ty, rhs), (*ident, generics, ty, *rhs);
4277
4278 expect_fn, (Ident, &FnSig<'hir>, &'hir Generics<'hir>, BodyId),
4279 ItemKind::Fn { ident, sig, generics, body, .. }, (*ident, sig, generics, *body);
4280
4281 expect_macro, (Ident, &ast::MacroDef, MacroKinds),
4282 ItemKind::Macro(ident, def, mk), (*ident, def, *mk);
4283
4284 expect_mod, (Ident, &'hir Mod<'hir>), ItemKind::Mod(ident, m), (*ident, m);
4285
4286 expect_foreign_mod, (ExternAbi, &'hir [ForeignItemId]),
4287 ItemKind::ForeignMod { abi, items }, (*abi, items);
4288
4289 expect_global_asm, &'hir InlineAsm<'hir>, ItemKind::GlobalAsm { asm, .. }, asm;
4290
4291 expect_ty_alias, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
4292 ItemKind::TyAlias(ident, generics, ty), (*ident, generics, ty);
4293
4294 expect_enum, (Ident, &'hir Generics<'hir>, &EnumDef<'hir>),
4295 ItemKind::Enum(ident, generics, def), (*ident, generics, def);
4296
4297 expect_struct, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
4298 ItemKind::Struct(ident, generics, data), (*ident, generics, data);
4299
4300 expect_union, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
4301 ItemKind::Union(ident, generics, data), (*ident, generics, data);
4302
4303 expect_trait,
4304 (
4305 &'hir ImplRestriction<'hir>,
4306 Constness,
4307 IsAuto,
4308 Safety,
4309 Ident,
4310 &'hir Generics<'hir>,
4311 GenericBounds<'hir>,
4312 &'hir [TraitItemId]
4313 ),
4314 ItemKind::Trait { impl_restriction, constness, is_auto, safety, ident, generics, bounds, items },
4315 (impl_restriction, *constness, *is_auto, *safety, *ident, generics, bounds, items);
4316
4317 expect_trait_alias, (Constness, Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
4318 ItemKind::TraitAlias(constness, ident, generics, bounds), (*constness, *ident, generics, bounds);
4319
4320 expect_impl, &Impl<'hir>, ItemKind::Impl(imp), imp;
4321
4322 expect_test_binder_constraints, (&'hir Generics<'hir>, &'hir TestBinderBody<'hir>),
4323 ItemKind::TestBinderConstraints { generics, body }, (generics, body);
4324 }
4325}
4326
4327#[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]
fn clone(&self) -> Safety { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Safety { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Safety {
#[inline]
fn eq(&self, other: &Safety) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Safety {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for Safety {
#[inline]
fn partial_cmp(&self, other: &Safety)
-> ::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: &Safety) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord, #[automatically_derived]
impl ::core::hash::Hash for Safety {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state)
}
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for Safety {
#[inline]
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)]
4328#[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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self { Safety::Unsafe => {} Safety::Safe => {} }
}
}
};StableHash, #[automatically_derived]
impl ::core::default::Default for Safety {
#[inline]
fn default() -> Safety { Self::Unsafe }
}Default)]
4329pub enum Safety {
4330 #[default]
4335 Unsafe,
4336 Safe,
4337}
4338
4339impl Safety {
4340 pub fn prefix_str(self) -> &'static str {
4341 match self {
4342 Self::Unsafe => "unsafe ",
4343 Self::Safe => "",
4344 }
4345 }
4346
4347 #[inline]
4348 pub fn is_unsafe(self) -> bool {
4349 !self.is_safe()
4350 }
4351
4352 #[inline]
4353 pub fn is_safe(self) -> bool {
4354 match self {
4355 Self::Unsafe => false,
4356 Self::Safe => true,
4357 }
4358 }
4359}
4360
4361impl fmt::Display for Safety {
4362 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4363 f.write_str(match *self {
4364 Self::Unsafe => "unsafe",
4365 Self::Safe => "safe",
4366 })
4367 }
4368}
4369
4370#[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]
fn clone(&self) -> Constness {
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: &Constness) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(Constness::Const { always: __self_0 }, Constness::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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Constness::Const { always: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
"always", &__self_0),
Constness::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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
Constness::Const { always: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Constness::NotConst => {}
}
}
}
};StableHash)]
4371pub enum Constness {
4372 Const { always: bool },
4373 NotConst,
4374}
4375
4376impl Default for Constness {
4379 fn default() -> Self {
4380 Self::Const { always: false }
4381 }
4382}
4383
4384impl fmt::Display for Constness {
4385 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4386 f.write_str(match *self {
4387 Self::Const { always: true } => "comptime",
4388 Self::Const { always: false } => "const",
4389 Self::NotConst => "non-const",
4390 })
4391 }
4392}
4393
4394#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ImplRestriction<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"ImplRestriction", "kind", &self.kind, "span", &&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]
fn clone(&self) -> ImplRestriction<'hir> {
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)]
4395pub struct ImplRestriction<'hir> {
4396 pub kind: RestrictionKind<'hir>,
4397 pub span: Span,
4398}
4399
4400#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for MutRestriction<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"MutRestriction", "kind", &self.kind, "span", &&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]
fn clone(&self) -> MutRestriction<'hir> {
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)]
4401pub struct MutRestriction<'hir> {
4402 pub kind: RestrictionKind<'hir>,
4403 pub span: Span,
4404}
4405
4406#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for RestrictionKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
RestrictionKind::Unrestricted =>
::core::fmt::Formatter::write_str(f, "Unrestricted"),
RestrictionKind::Restricted(__self_0) =>
::core::fmt::Formatter::debug_tuple_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]
fn clone(&self) -> RestrictionKind<'hir> {
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) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
RestrictionKind::Unrestricted => {}
RestrictionKind::Restricted(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
4407pub enum RestrictionKind<'hir> {
4408 Unrestricted,
4410 Restricted(&'hir Path<'hir, DefId>),
4414}
4415
4416#[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]
fn clone(&self) -> HeaderSafety {
let _: ::core::clone::AssertParamIsClone<Safety>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for HeaderSafety {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
HeaderSafety::SafeTargetFeatures =>
::core::fmt::Formatter::write_str(f, "SafeTargetFeatures"),
HeaderSafety::Normal(__self_0) =>
::core::fmt::Formatter::debug_tuple_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) {
::std::mem::discriminant(self).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: &HeaderSafety) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(HeaderSafety::Normal(__self_0),
HeaderSafety::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)]
4421pub enum HeaderSafety {
4422 SafeTargetFeatures,
4428 Normal(Safety),
4429}
4430
4431impl From<Safety> for HeaderSafety {
4432 fn from(v: Safety) -> Self {
4433 Self::Normal(v)
4434 }
4435}
4436
4437#[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]
fn clone(&self) -> FnHeader {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "FnHeader",
"safety", &self.safety, "constness", &self.constness, "asyncness",
&self.asyncness, "abi", &&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)]
4438pub struct FnHeader {
4439 pub safety: HeaderSafety,
4440 pub constness: Constness,
4441 pub asyncness: IsAsync,
4442 pub abi: ExternAbi,
4443}
4444
4445impl FnHeader {
4446 pub fn is_async(&self) -> bool {
4447 #[allow(non_exhaustive_omitted_patterns)] match self.asyncness {
IsAsync::Async(_) => true,
_ => false,
}matches!(self.asyncness, IsAsync::Async(_))
4448 }
4449
4450 pub fn is_unsafe(&self) -> bool {
4451 self.safety().is_unsafe()
4452 }
4453
4454 pub fn is_safe(&self) -> bool {
4455 self.safety().is_safe()
4456 }
4457
4458 pub fn safety(&self) -> Safety {
4459 match self.safety {
4460 HeaderSafety::SafeTargetFeatures => Safety::Unsafe,
4461 HeaderSafety::Normal(safety) => safety,
4462 }
4463 }
4464}
4465
4466#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TestBinderBody<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"TestBinderBody", "foralls", &self.foralls, "exists",
&self.exists, "constraints", &self.constraints, "predicates",
&&self.predicates)
}
}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]
fn clone(&self) -> TestBinderBody<'hir> {
let _:
::core::clone::AssertParamIsClone<&'hir [TestBinderForall<'hir>]>;
let _:
::core::clone::AssertParamIsClone<&'hir [TestBinderExists<'hir>]>;
let _: ::core::clone::AssertParamIsClone<TestBinderConstraint<'hir>>;
let _:
::core::clone::AssertParamIsClone<&'hir [WherePredicate<'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 {
foralls: ref __binding_0,
exists: ref __binding_1,
constraints: ref __binding_2,
predicates: 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)]
4467pub struct TestBinderBody<'hir> {
4468 pub foralls: &'hir [TestBinderForall<'hir>],
4469 pub exists: &'hir [TestBinderExists<'hir>],
4470 pub constraints: TestBinderConstraint<'hir>,
4472 pub predicates: &'hir [WherePredicate<'hir>],
4474}
4475
4476#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TestBinderForall<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"TestBinderForall", "span", &self.span, "hir_id", &self.hir_id,
"generics", &self.generics, "body", &self.body, "assert_on_exit",
&&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]
fn clone(&self) -> TestBinderForall<'hir> {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<HirId>;
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,
hir_id: ref __binding_1,
generics: ref __binding_2,
body: ref __binding_3,
assert_on_exit: 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)]
4477pub struct TestBinderForall<'hir> {
4478 pub span: Span,
4479 pub hir_id: HirId,
4480 pub generics: &'hir Generics<'hir>,
4481 pub body: &'hir TestBinderBody<'hir>,
4482 pub assert_on_exit: Option<&'hir TestBinderConstraint<'hir>>,
4483}
4484
4485#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TestBinderExists<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"TestBinderExists", "span", &self.span, "hir_id", &self.hir_id,
"params", &self.params, "body", &&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]
fn clone(&self) -> TestBinderExists<'hir> {
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<HirId>;
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,
hir_id: ref __binding_1,
params: ref __binding_2,
body: 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)]
4486pub struct TestBinderExists<'hir> {
4487 pub span: Span,
4488 pub hir_id: HirId,
4489 pub params: &'hir [GenericParam<'hir>],
4490 pub body: &'hir TestBinderBody<'hir>,
4491}
4492
4493#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TestBinderConstraint<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
TestBinderConstraint::And { items: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "And",
"items", &__self_0),
TestBinderConstraint::Or { items: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f, "Or",
"items", &__self_0),
TestBinderConstraint::Lifetime { lhs: __self_0, rhs: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Lifetime", "lhs", __self_0, "rhs", &__self_1),
TestBinderConstraint::PlaceholderOutlives {
lhs: __self_0, rhs: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"PlaceholderOutlives", "lhs", __self_0, "rhs", &__self_1),
TestBinderConstraint::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]
fn clone(&self) -> TestBinderConstraint<'hir> {
let _:
::core::clone::AssertParamIsClone<&'hir [TestBinderConstraint<'hir>]>;
let _:
::core::clone::AssertParamIsClone<&'hir [TestBinderConstraint<'hir>]>;
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) {
::std::mem::discriminant(self).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::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)]
4494pub enum TestBinderConstraint<'hir> {
4495 And { items: &'hir [TestBinderConstraint<'hir>] },
4496 Or { items: &'hir [TestBinderConstraint<'hir>] },
4497 Lifetime { lhs: &'hir Lifetime, rhs: &'hir Lifetime },
4498 PlaceholderOutlives { lhs: &'hir Ty<'hir>, rhs: &'hir Lifetime },
4499 AliasOutlives { bound_type_constraint: &'hir TestBinderBoundTypeConstraint<'hir> },
4500}
4501
4502#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TestBinderBoundTypeConstraint<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"TestBinderBoundTypeConstraint", "span", &self.span, "hir_id",
&self.hir_id, "params", &self.params, "lhs", &self.lhs, "rhs",
&&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]
fn clone(&self) -> TestBinderBoundTypeConstraint<'hir> {
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)]
4503pub struct TestBinderBoundTypeConstraint<'hir> {
4504 pub span: Span,
4505 pub hir_id: HirId,
4506 pub params: &'hir [GenericParam<'hir>],
4507 pub lhs: &'hir Ty<'hir>,
4508 pub rhs: &'hir Lifetime,
4509}
4510
4511#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ItemKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ItemKind::ExternCrate(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f,
"ExternCrate", __self_0, &__self_1),
ItemKind::Use(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Use",
__self_0, &__self_1),
ItemKind::Static(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_tuple_field4_finish(f, "Static",
__self_0, __self_1, __self_2, &__self_3),
ItemKind::Const(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_tuple_field4_finish(f, "Const",
__self_0, __self_1, __self_2, &__self_3),
ItemKind::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", __self_0, "ident", __self_1, "generics", __self_2,
"body", __self_3, "has_body", &__self_4),
ItemKind::Macro(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Macro",
__self_0, __self_1, &__self_2),
ItemKind::Mod(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f, "Mod",
__self_0, &__self_1),
ItemKind::ForeignMod { abi: __self_0, items: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"ForeignMod", "abi", __self_0, "items", &__self_1),
ItemKind::GlobalAsm { asm: __self_0, fake_body: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"GlobalAsm", "asm", __self_0, "fake_body", &__self_1),
ItemKind::TyAlias(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f,
"TyAlias", __self_0, __self_1, &__self_2),
ItemKind::Enum(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Enum",
__self_0, __self_1, &__self_2),
ItemKind::Struct(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Struct",
__self_0, __self_1, &__self_2),
ItemKind::Union(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Union",
__self_0, __self_1, &__self_2),
ItemKind::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 } => {
let names: &'static _ =
&["impl_restriction", "constness", "is_auto", "safety",
"ident", "generics", "bounds", "items"];
let values: &[&dyn ::core::fmt::Debug] =
&[__self_0, __self_1, __self_2, __self_3, __self_4,
__self_5, __self_6, &__self_7];
::core::fmt::Formatter::debug_struct_fields_finish(f, "Trait",
names, values)
}
ItemKind::TraitAlias(__self_0, __self_1, __self_2, __self_3) =>
::core::fmt::Formatter::debug_tuple_field4_finish(f,
"TraitAlias", __self_0, __self_1, __self_2, &__self_3),
ItemKind::Impl(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Impl",
&__self_0),
ItemKind::TestBinderConstraints {
generics: __self_0, body: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"TestBinderConstraints", "generics", __self_0, "body",
&__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]
fn clone(&self) -> ItemKind<'hir> {
let _: ::core::clone::AssertParamIsClone<Option<Symbol>>;
let _: ::core::clone::AssertParamIsClone<Ident>;
let _: ::core::clone::AssertParamIsClone<&'hir UsePath<'hir>>;
let _: ::core::clone::AssertParamIsClone<UseKind>;
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) {
::std::mem::discriminant(self).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, ref __binding_1) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.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)]
4512pub enum ItemKind<'hir> {
4513 ExternCrate(Option<Symbol>, Ident),
4517
4518 Use(&'hir UsePath<'hir>, UseKind),
4524
4525 Static(Mutability, Ident, &'hir Ty<'hir>, BodyId),
4527 Const(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, ConstItemRhs<'hir>),
4529 Fn {
4531 sig: FnSig<'hir>,
4532 ident: Ident,
4533 generics: &'hir Generics<'hir>,
4534 body: BodyId,
4535 has_body: bool,
4539 },
4540 Macro(Ident, &'hir ast::MacroDef, MacroKinds),
4542 Mod(Ident, &'hir Mod<'hir>),
4544 ForeignMod {
4546 abi: ExternAbi,
4547 items: &'hir [ForeignItemId],
4548 },
4549 GlobalAsm {
4551 asm: &'hir InlineAsm<'hir>,
4552 fake_body: BodyId,
4558 },
4559 TyAlias(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
4561 Enum(Ident, &'hir Generics<'hir>, EnumDef<'hir>),
4563 Struct(Ident, &'hir Generics<'hir>, VariantData<'hir>),
4565 Union(Ident, &'hir Generics<'hir>, VariantData<'hir>),
4567 Trait {
4569 impl_restriction: &'hir ImplRestriction<'hir>,
4570 constness: Constness,
4571 is_auto: IsAuto,
4572 safety: Safety,
4573 ident: Ident,
4574 generics: &'hir Generics<'hir>,
4575 bounds: GenericBounds<'hir>,
4576 items: &'hir [TraitItemId],
4577 },
4578 TraitAlias(Constness, Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
4580
4581 Impl(Impl<'hir>),
4583
4584 TestBinderConstraints {
4585 generics: &'hir Generics<'hir>,
4586 body: &'hir TestBinderBody<'hir>,
4587 },
4588}
4589
4590#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Impl<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "Impl",
"generics", &self.generics, "of_trait", &self.of_trait, "self_ty",
&self.self_ty, "items", &self.items, "constness",
&&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]
fn clone(&self) -> Impl<'hir> {
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)]
4595pub struct Impl<'hir> {
4596 pub generics: &'hir Generics<'hir>,
4597 pub of_trait: Option<&'hir TraitImplHeader<'hir>>,
4598 pub self_ty: &'hir Ty<'hir>,
4599 pub items: &'hir [ImplItemId],
4600 pub constness: Constness,
4601}
4602
4603#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitImplHeader<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"TraitImplHeader", "safety", &self.safety, "polarity",
&self.polarity, "defaultness", &self.defaultness,
"defaultness_span", &self.defaultness_span, "trait_ref",
&&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]
fn clone(&self) -> TraitImplHeader<'hir> {
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)]
4604pub struct TraitImplHeader<'hir> {
4605 pub safety: Safety,
4606 pub polarity: ImplPolarity,
4607 pub defaultness: Defaultness,
4608 pub defaultness_span: Option<Span>,
4611 pub trait_ref: TraitRef<'hir>,
4612}
4613
4614impl ItemKind<'_> {
4615 pub fn ident(&self) -> Option<Ident> {
4616 match *self {
4617 ItemKind::ExternCrate(_, ident)
4618 | ItemKind::Use(_, UseKind::Single(ident))
4619 | ItemKind::Static(_, ident, ..)
4620 | ItemKind::Const(ident, ..)
4621 | ItemKind::Fn { ident, .. }
4622 | ItemKind::Macro(ident, ..)
4623 | ItemKind::Mod(ident, ..)
4624 | ItemKind::TyAlias(ident, ..)
4625 | ItemKind::Enum(ident, ..)
4626 | ItemKind::Struct(ident, ..)
4627 | ItemKind::Union(ident, ..)
4628 | ItemKind::Trait { ident, .. }
4629 | ItemKind::TraitAlias(_, ident, ..) => Some(ident),
4630
4631 ItemKind::Use(_, UseKind::Glob | UseKind::ListStem)
4632 | ItemKind::ForeignMod { .. }
4633 | ItemKind::GlobalAsm { .. }
4634 | ItemKind::Impl(_)
4635 | ItemKind::TestBinderConstraints { .. } => None,
4636 }
4637 }
4638
4639 pub fn generics(&self) -> Option<&Generics<'_>> {
4640 Some(match self {
4641 ItemKind::Fn { generics, .. }
4642 | ItemKind::TyAlias(_, generics, _)
4643 | ItemKind::Const(_, generics, _, _)
4644 | ItemKind::Enum(_, generics, _)
4645 | ItemKind::Struct(_, generics, _)
4646 | ItemKind::Union(_, generics, _)
4647 | ItemKind::Trait { generics, .. }
4648 | ItemKind::TraitAlias(_, _, generics, _)
4649 | ItemKind::Impl(Impl { generics, .. })
4650 | ItemKind::TestBinderConstraints { generics, .. } => generics,
4651 _ => return None,
4652 })
4653 }
4654
4655 pub fn recovered(&self) -> bool {
4656 match self {
4657 ItemKind::Struct(
4658 _,
4659 _,
4660 VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
4661 ) => true,
4662 ItemKind::Union(
4663 _,
4664 _,
4665 VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
4666 ) => true,
4667 ItemKind::Enum(_, _, def) => def.variants.iter().any(|v| match v.data {
4668 VariantData::Struct { recovered: ast::Recovered::Yes(_), .. } => true,
4669 _ => false,
4670 }),
4671 _ => false,
4672 }
4673 }
4674}
4675
4676#[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]
fn clone(&self) -> ForeignItemId {
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: &ForeignItemId) -> 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]
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)]
4680pub struct ForeignItemId {
4681 pub owner_id: OwnerId,
4682}
4683
4684impl ForeignItemId {
4685 #[inline]
4686 pub fn hir_id(&self) -> HirId {
4687 HirId::make_owner(self.owner_id.def_id)
4689 }
4690}
4691
4692#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ForeignItem<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "ForeignItem",
"ident", &self.ident, "kind", &self.kind, "owner_id",
&self.owner_id, "span", &self.span, "vis_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]
fn clone(&self) -> ForeignItem<'hir> {
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)]
4693pub struct ForeignItem<'hir> {
4694 pub ident: Ident,
4695 pub kind: ForeignItemKind<'hir>,
4696 pub owner_id: OwnerId,
4697 pub span: Span,
4698 pub vis_span: Span,
4699}
4700
4701impl ForeignItem<'_> {
4702 #[inline]
4703 pub fn hir_id(&self) -> HirId {
4704 HirId::make_owner(self.owner_id.def_id)
4706 }
4707
4708 pub fn foreign_item_id(&self) -> ForeignItemId {
4709 ForeignItemId { owner_id: self.owner_id }
4710 }
4711}
4712
4713#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ForeignItemKind<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ForeignItemKind::Fn(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Fn",
__self_0, __self_1, &__self_2),
ForeignItemKind::Static(__self_0, __self_1, __self_2) =>
::core::fmt::Formatter::debug_tuple_field3_finish(f, "Static",
__self_0, __self_1, &__self_2),
ForeignItemKind::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]
fn clone(&self) -> ForeignItemKind<'hir> {
let _: ::core::clone::AssertParamIsClone<FnSig<'hir>>;
let _: ::core::clone::AssertParamIsClone<&'hir [Option<Ident>]>;
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) {
::std::mem::discriminant(self).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)]
4715pub enum ForeignItemKind<'hir> {
4716 Fn(FnSig<'hir>, &'hir [Option<Ident>], &'hir Generics<'hir>),
4723 Static(&'hir Ty<'hir>, Mutability, Safety),
4725 Type,
4727}
4728
4729#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Upvar {
#[inline]
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]
fn clone(&self) -> Upvar {
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)]
4731pub struct Upvar {
4732 pub span: Span,
4734}
4735
4736#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitCandidate<'hir> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"TraitCandidate", "def_id", &self.def_id, "import_ids",
&self.import_ids, "lint_ambiguous", &&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]
fn clone(&self) -> TraitCandidate<'hir> {
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)]
4740pub struct TraitCandidate<'hir> {
4741 pub def_id: DefId,
4742 pub import_ids: &'hir [LocalDefId],
4743 pub lint_ambiguous: bool,
4748}
4749
4750#[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]
fn clone(&self) -> OwnerNode<'hir> {
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
OwnerNode::Item(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Item",
&__self_0),
OwnerNode::ForeignItem(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ForeignItem", &__self_0),
OwnerNode::TraitItem(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TraitItem", &__self_0),
OwnerNode::ImplItem(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ImplItem", &__self_0),
OwnerNode::Crate(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Crate",
&__self_0),
OwnerNode::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) {
::std::mem::discriminant(self).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)]
4751pub enum OwnerNode<'hir> {
4752 Item(&'hir Item<'hir>),
4753 ForeignItem(&'hir ForeignItem<'hir>),
4754 TraitItem(&'hir TraitItem<'hir>),
4755 ImplItem(&'hir ImplItem<'hir>),
4756 Crate(&'hir Mod<'hir>),
4757 Synthetic,
4758}
4759
4760impl<'hir> OwnerNode<'hir> {
4761 pub fn span(&self) -> Span {
4762 match self {
4763 OwnerNode::Item(Item { span, .. })
4764 | OwnerNode::ForeignItem(ForeignItem { span, .. })
4765 | OwnerNode::ImplItem(ImplItem { span, .. })
4766 | OwnerNode::TraitItem(TraitItem { span, .. }) => *span,
4767 OwnerNode::Crate(Mod { spans: ModSpans { inner_span, .. }, .. }) => *inner_span,
4768 OwnerNode::Synthetic => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
4769 }
4770 }
4771
4772 pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
4773 match self {
4774 OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
4775 | OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
4776 | OwnerNode::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
4777 | OwnerNode::ForeignItem(ForeignItem {
4778 kind: ForeignItemKind::Fn(fn_sig, _, _), ..
4779 }) => Some(fn_sig),
4780 _ => None,
4781 }
4782 }
4783
4784 pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
4785 match self {
4786 OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
4787 | OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
4788 | OwnerNode::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
4789 | OwnerNode::ForeignItem(ForeignItem {
4790 kind: ForeignItemKind::Fn(fn_sig, _, _), ..
4791 }) => Some(fn_sig.decl),
4792 _ => None,
4793 }
4794 }
4795
4796 pub fn body_id(&self) -> Option<BodyId> {
4797 match self {
4798 OwnerNode::Item(Item {
4799 kind:
4800 ItemKind::Static(_, _, _, body)
4801 | ItemKind::Const(.., ConstItemRhs::Body(body))
4802 | ItemKind::Fn { body, .. },
4803 ..
4804 })
4805 | OwnerNode::TraitItem(TraitItem {
4806 kind:
4807 TraitItemKind::Fn(_, TraitFn::Provided(body))
4808 | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body))),
4809 ..
4810 })
4811 | OwnerNode::ImplItem(ImplItem {
4812 kind: ImplItemKind::Fn(_, body) | ImplItemKind::Const(_, ConstItemRhs::Body(body)),
4813 ..
4814 }) => Some(*body),
4815 _ => None,
4816 }
4817 }
4818
4819 pub fn generics(self) -> Option<&'hir Generics<'hir>> {
4820 Node::generics(self.into())
4821 }
4822
4823 pub fn def_id(self) -> OwnerId {
4824 match self {
4825 OwnerNode::Item(Item { owner_id, .. })
4826 | OwnerNode::TraitItem(TraitItem { owner_id, .. })
4827 | OwnerNode::ImplItem(ImplItem { owner_id, .. })
4828 | OwnerNode::ForeignItem(ForeignItem { owner_id, .. }) => *owner_id,
4829 OwnerNode::Crate(..) => rustc_hir_id::CRATE_HIR_ID.owner,
4830 OwnerNode::Synthetic => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
4831 }
4832 }
4833
4834 pub fn is_impl_block(&self) -> bool {
4836 #[allow(non_exhaustive_omitted_patterns)] match self {
OwnerNode::Item(Item { kind: ItemKind::Impl(_), .. }) => true,
_ => false,
}matches!(self, OwnerNode::Item(Item { kind: ItemKind::Impl(_), .. }))
4837 }
4838
4839 #[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! {
4840 expect_item, &'hir Item<'hir>, OwnerNode::Item(n), n;
4841 expect_foreign_item, &'hir ForeignItem<'hir>, OwnerNode::ForeignItem(n), n;
4842 expect_impl_item, &'hir ImplItem<'hir>, OwnerNode::ImplItem(n), n;
4843 expect_trait_item, &'hir TraitItem<'hir>, OwnerNode::TraitItem(n), n;
4844 }
4845}
4846
4847impl<'hir> From<&'hir Item<'hir>> for OwnerNode<'hir> {
4848 fn from(val: &'hir Item<'hir>) -> Self {
4849 OwnerNode::Item(val)
4850 }
4851}
4852
4853impl<'hir> From<&'hir ForeignItem<'hir>> for OwnerNode<'hir> {
4854 fn from(val: &'hir ForeignItem<'hir>) -> Self {
4855 OwnerNode::ForeignItem(val)
4856 }
4857}
4858
4859impl<'hir> From<&'hir ImplItem<'hir>> for OwnerNode<'hir> {
4860 fn from(val: &'hir ImplItem<'hir>) -> Self {
4861 OwnerNode::ImplItem(val)
4862 }
4863}
4864
4865impl<'hir> From<&'hir TraitItem<'hir>> for OwnerNode<'hir> {
4866 fn from(val: &'hir TraitItem<'hir>) -> Self {
4867 OwnerNode::TraitItem(val)
4868 }
4869}
4870
4871impl<'hir> From<OwnerNode<'hir>> for Node<'hir> {
4872 fn from(val: OwnerNode<'hir>) -> Self {
4873 match val {
4874 OwnerNode::Item(n) => Node::Item(n),
4875 OwnerNode::ForeignItem(n) => Node::ForeignItem(n),
4876 OwnerNode::ImplItem(n) => Node::ImplItem(n),
4877 OwnerNode::TraitItem(n) => Node::TraitItem(n),
4878 OwnerNode::Crate(n) => Node::Crate(n),
4879 OwnerNode::Synthetic => Node::Synthetic,
4880 }
4881 }
4882}
4883
4884#[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]
fn clone(&self) -> Node<'hir> {
let _: ::core::clone::AssertParamIsClone<&'hir Param<'hir>>;
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 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 TestBinderForall<'hir>>;
let _:
::core::clone::AssertParamIsClone<&'hir TestBinderExists<'hir>>;
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]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Node::Param(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Param",
&__self_0),
Node::Item(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Item",
&__self_0),
Node::ForeignItem(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ForeignItem", &__self_0),
Node::TraitItem(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TraitItem", &__self_0),
Node::ImplItem(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ImplItem", &__self_0),
Node::Variant(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Variant", &__self_0),
Node::Field(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Field",
&__self_0),
Node::AnonConst(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"AnonConst", &__self_0),
Node::ConstBlock(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ConstBlock", &__self_0),
Node::ConstArg(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ConstArg", &__self_0),
Node::Expr(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Expr",
&__self_0),
Node::ExprField(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ExprField", &__self_0),
Node::ConstArgExprField(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ConstArgExprField", &__self_0),
Node::Stmt(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Stmt",
&__self_0),
Node::PathSegment(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"PathSegment", &__self_0),
Node::Ty(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ty",
&__self_0),
Node::AssocItemConstraint(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"AssocItemConstraint", &__self_0),
Node::TraitRef(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TraitRef", &__self_0),
Node::OpaqueTy(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"OpaqueTy", &__self_0),
Node::TyPat(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "TyPat",
&__self_0),
Node::Pat(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Pat",
&__self_0),
Node::PatField(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"PatField", &__self_0),
Node::PatExpr(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"PatExpr", &__self_0),
Node::Arm(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Arm",
&__self_0),
Node::Block(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Block",
&__self_0),
Node::LetStmt(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"LetStmt", &__self_0),
Node::Ctor(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ctor",
&__self_0),
Node::Lifetime(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Lifetime", &__self_0),
Node::GenericParam(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"GenericParam", &__self_0),
Node::Crate(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Crate",
&__self_0),
Node::Infer(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Infer",
&__self_0),
Node::WherePredicate(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"WherePredicate", &__self_0),
Node::PreciseCapturingNonLifetimeArg(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"PreciseCapturingNonLifetimeArg", &__self_0),
Node::TestBinderForall(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TestBinderForall", &__self_0),
Node::TestBinderExists(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TestBinderExists", &__self_0),
Node::TestBinderBoundTypeConstraint(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TestBinderBoundTypeConstraint", &__self_0),
Node::Synthetic =>
::core::fmt::Formatter::write_str(f, "Synthetic"),
Node::Err(__self_0) =>
::core::fmt::Formatter::debug_tuple_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) {
::std::mem::discriminant(self).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::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::TestBinderForall(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Node::TestBinderExists(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)]
4885pub enum Node<'hir> {
4886 Param(&'hir Param<'hir>),
4887 Item(&'hir Item<'hir>),
4888 ForeignItem(&'hir ForeignItem<'hir>),
4889 TraitItem(&'hir TraitItem<'hir>),
4890 ImplItem(&'hir ImplItem<'hir>),
4891 Variant(&'hir Variant<'hir>),
4892 Field(&'hir FieldDef<'hir>),
4893 AnonConst(&'hir AnonConst),
4894 ConstBlock(&'hir ConstBlock),
4895 ConstArg(&'hir ConstArg<'hir>),
4896 Expr(&'hir Expr<'hir>),
4897 ExprField(&'hir ExprField<'hir>),
4898 ConstArgExprField(&'hir ConstArgExprField<'hir>),
4899 Stmt(&'hir Stmt<'hir>),
4900 PathSegment(&'hir PathSegment<'hir>),
4901 Ty(&'hir Ty<'hir>),
4902 AssocItemConstraint(&'hir AssocItemConstraint<'hir>),
4903 TraitRef(&'hir TraitRef<'hir>),
4904 OpaqueTy(&'hir OpaqueTy<'hir>),
4905 TyPat(&'hir TyPat<'hir>),
4906 Pat(&'hir Pat<'hir>),
4907 PatField(&'hir PatField<'hir>),
4908 PatExpr(&'hir PatExpr<'hir>),
4912 Arm(&'hir Arm<'hir>),
4913 Block(&'hir Block<'hir>),
4914 LetStmt(&'hir LetStmt<'hir>),
4915 Ctor(&'hir VariantData<'hir>),
4918 Lifetime(&'hir Lifetime),
4919 GenericParam(&'hir GenericParam<'hir>),
4920 Crate(&'hir Mod<'hir>),
4921 Infer(&'hir InferArg),
4922 WherePredicate(&'hir WherePredicate<'hir>),
4923 PreciseCapturingNonLifetimeArg(&'hir PreciseCapturingNonLifetimeArg),
4924 TestBinderForall(&'hir TestBinderForall<'hir>),
4925 TestBinderExists(&'hir TestBinderExists<'hir>),
4926 TestBinderBoundTypeConstraint(&'hir TestBinderBoundTypeConstraint<'hir>),
4927 Synthetic,
4929 Err(Span),
4930}
4931
4932impl<'hir> Node<'hir> {
4933 pub fn ident(&self) -> Option<Ident> {
4948 match self {
4949 Node::Item(item) => item.kind.ident(),
4950 Node::TraitItem(TraitItem { ident, .. })
4951 | Node::ImplItem(ImplItem { ident, .. })
4952 | Node::ForeignItem(ForeignItem { ident, .. })
4953 | Node::Field(FieldDef { ident, .. })
4954 | Node::Variant(Variant { ident, .. })
4955 | Node::PathSegment(PathSegment { ident, .. }) => Some(*ident),
4956 Node::Lifetime(lt) => Some(lt.ident),
4957 Node::GenericParam(p) => Some(p.name.ident()),
4958 Node::AssocItemConstraint(c) => Some(c.ident),
4959 Node::PatField(f) => Some(f.ident),
4960 Node::ExprField(f) => Some(f.ident),
4961 Node::ConstArgExprField(f) => Some(f.field),
4962 Node::PreciseCapturingNonLifetimeArg(a) => Some(a.ident),
4963 Node::Param(..)
4964 | Node::AnonConst(..)
4965 | Node::ConstBlock(..)
4966 | Node::ConstArg(..)
4967 | Node::Expr(..)
4968 | Node::Stmt(..)
4969 | Node::Block(..)
4970 | Node::Ctor(..)
4971 | Node::Pat(..)
4972 | Node::TyPat(..)
4973 | Node::PatExpr(..)
4974 | Node::Arm(..)
4975 | Node::LetStmt(..)
4976 | Node::Crate(..)
4977 | Node::Ty(..)
4978 | Node::TraitRef(..)
4979 | Node::OpaqueTy(..)
4980 | Node::Infer(..)
4981 | Node::WherePredicate(..)
4982 | Node::TestBinderForall(..)
4983 | Node::TestBinderExists(..)
4984 | Node::TestBinderBoundTypeConstraint(..)
4985 | Node::Synthetic
4986 | Node::Err(..) => None,
4987 }
4988 }
4989
4990 pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
4991 match self {
4992 Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
4993 | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
4994 | Node::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
4995 | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_sig, _, _), .. }) => {
4996 Some(fn_sig.decl)
4997 }
4998 Node::Expr(Expr { kind: ExprKind::Closure(Closure { fn_decl, .. }), .. }) => {
4999 Some(fn_decl)
5000 }
5001 _ => None,
5002 }
5003 }
5004
5005 pub fn impl_block_of_trait(self, trait_def_id: DefId) -> Option<&'hir Impl<'hir>> {
5007 if let Node::Item(Item { kind: ItemKind::Impl(impl_block), .. }) = self
5008 && let Some(of_trait) = impl_block.of_trait
5009 && let Some(trait_id) = of_trait.trait_ref.trait_def_id()
5010 && trait_id == trait_def_id
5011 {
5012 Some(impl_block)
5013 } else {
5014 None
5015 }
5016 }
5017
5018 pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
5019 match self {
5020 Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
5021 | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
5022 | Node::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
5023 | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_sig, _, _), .. }) => {
5024 Some(fn_sig)
5025 }
5026 _ => None,
5027 }
5028 }
5029
5030 pub fn ty(self) -> Option<&'hir Ty<'hir>> {
5032 match self {
5033 Node::Item(it) => match it.kind {
5034 ItemKind::TyAlias(_, _, ty)
5035 | ItemKind::Static(_, _, ty, _)
5036 | ItemKind::Const(_, _, ty, _) => Some(ty),
5037 ItemKind::Impl(impl_item) => Some(&impl_item.self_ty),
5038 _ => None,
5039 },
5040 Node::TraitItem(it) => match it.kind {
5041 TraitItemKind::Const(ty, _) => Some(ty),
5042 TraitItemKind::Type(_, ty) => ty,
5043 _ => None,
5044 },
5045 Node::ImplItem(it) => match it.kind {
5046 ImplItemKind::Const(ty, _) => Some(ty),
5047 ImplItemKind::Type(ty) => Some(ty),
5048 _ => None,
5049 },
5050 Node::ForeignItem(it) => match it.kind {
5051 ForeignItemKind::Static(ty, ..) => Some(ty),
5052 _ => None,
5053 },
5054 Node::GenericParam(param) => match param.kind {
5055 GenericParamKind::Lifetime { .. } => None,
5056 GenericParamKind::Type { default, .. } => default,
5057 GenericParamKind::Const { ty, .. } => Some(ty),
5058 },
5059 Node::Field(f) => Some(f.ty),
5060 _ => None,
5061 }
5062 }
5063
5064 pub fn alias_ty(self) -> Option<&'hir Ty<'hir>> {
5065 match self {
5066 Node::Item(Item { kind: ItemKind::TyAlias(_, _, ty), .. }) => Some(ty),
5067 _ => None,
5068 }
5069 }
5070
5071 #[inline]
5072 pub fn associated_body(&self) -> Option<(LocalDefId, BodyId)> {
5073 match self {
5074 Node::Item(Item {
5075 owner_id,
5076 kind:
5077 ItemKind::Const(.., ConstItemRhs::Body(body))
5078 | ItemKind::Static(.., body)
5079 | ItemKind::Fn { body, .. },
5080 ..
5081 })
5082 | Node::TraitItem(TraitItem {
5083 owner_id,
5084 kind:
5085 TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)))
5086 | TraitItemKind::Fn(_, TraitFn::Provided(body)),
5087 ..
5088 })
5089 | Node::ImplItem(ImplItem {
5090 owner_id,
5091 kind: ImplItemKind::Const(.., ConstItemRhs::Body(body)) | ImplItemKind::Fn(_, body),
5092 ..
5093 }) => Some((owner_id.def_id, *body)),
5094
5095 Node::Item(Item {
5096 owner_id, kind: ItemKind::GlobalAsm { asm: _, fake_body }, ..
5097 }) => Some((owner_id.def_id, *fake_body)),
5098
5099 Node::Expr(Expr { kind: ExprKind::Closure(Closure { def_id, body, .. }), .. }) => {
5100 Some((*def_id, *body))
5101 }
5102
5103 Node::AnonConst(constant) => Some((constant.def_id, constant.body)),
5104 Node::ConstBlock(constant) => Some((constant.def_id, constant.body)),
5105
5106 _ => None,
5107 }
5108 }
5109
5110 pub fn body_id(&self) -> Option<BodyId> {
5111 Some(self.associated_body()?.1)
5112 }
5113
5114 pub fn generics(self) -> Option<&'hir Generics<'hir>> {
5115 match self {
5116 Node::ForeignItem(ForeignItem {
5117 kind: ForeignItemKind::Fn(_, _, generics), ..
5118 })
5119 | Node::TraitItem(TraitItem { generics, .. })
5120 | Node::ImplItem(ImplItem { generics, .. }) => Some(generics),
5121 Node::Item(item) => item.kind.generics(),
5122 _ => None,
5123 }
5124 }
5125
5126 pub fn as_owner(self) -> Option<OwnerNode<'hir>> {
5127 match self {
5128 Node::Item(i) => Some(OwnerNode::Item(i)),
5129 Node::ForeignItem(i) => Some(OwnerNode::ForeignItem(i)),
5130 Node::TraitItem(i) => Some(OwnerNode::TraitItem(i)),
5131 Node::ImplItem(i) => Some(OwnerNode::ImplItem(i)),
5132 Node::Crate(i) => Some(OwnerNode::Crate(i)),
5133 Node::Synthetic => Some(OwnerNode::Synthetic),
5134 _ => None,
5135 }
5136 }
5137
5138 pub fn fn_kind(self) -> Option<FnKind<'hir>> {
5139 match self {
5140 Node::Item(i) => match i.kind {
5141 ItemKind::Fn { ident, sig, generics, .. } => {
5142 Some(FnKind::ItemFn(ident, generics, sig.header))
5143 }
5144 _ => None,
5145 },
5146 Node::TraitItem(ti) => match ti.kind {
5147 TraitItemKind::Fn(ref sig, _) => Some(FnKind::Method(ti.ident, sig)),
5148 _ => None,
5149 },
5150 Node::ImplItem(ii) => match ii.kind {
5151 ImplItemKind::Fn(ref sig, _) => Some(FnKind::Method(ii.ident, sig)),
5152 _ => None,
5153 },
5154 Node::Expr(e) => match e.kind {
5155 ExprKind::Closure { .. } => Some(FnKind::Closure),
5156 _ => None,
5157 },
5158 _ => None,
5159 }
5160 }
5161
5162 pub fn path(self) -> Option<&'hir QPath<'hir>> {
5164 match self {
5165 Node::Ty(Ty { kind: TyKind::Path(path), .. })
5166 | Node::Expr(Expr { kind: ExprKind::Path(path), .. })
5167 | Node::PatExpr(PatExpr { kind: PatExprKind::Path(path), .. }) => Some(path),
5168 _ => None,
5169 }
5170 }
5171
5172 #[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! {
5173 expect_param, &'hir Param<'hir>, Node::Param(n), n;
5174 expect_item, &'hir Item<'hir>, Node::Item(n), n;
5175 expect_foreign_item, &'hir ForeignItem<'hir>, Node::ForeignItem(n), n;
5176 expect_trait_item, &'hir TraitItem<'hir>, Node::TraitItem(n), n;
5177 expect_impl_item, &'hir ImplItem<'hir>, Node::ImplItem(n), n;
5178 expect_variant, &'hir Variant<'hir>, Node::Variant(n), n;
5179 expect_field, &'hir FieldDef<'hir>, Node::Field(n), n;
5180 expect_anon_const, &'hir AnonConst, Node::AnonConst(n), n;
5181 expect_inline_const, &'hir ConstBlock, Node::ConstBlock(n), n;
5182 expect_expr, &'hir Expr<'hir>, Node::Expr(n), n;
5183 expect_expr_field, &'hir ExprField<'hir>, Node::ExprField(n), n;
5184 expect_stmt, &'hir Stmt<'hir>, Node::Stmt(n), n;
5185 expect_path_segment, &'hir PathSegment<'hir>, Node::PathSegment(n), n;
5186 expect_ty, &'hir Ty<'hir>, Node::Ty(n), n;
5187 expect_assoc_item_constraint, &'hir AssocItemConstraint<'hir>, Node::AssocItemConstraint(n), n;
5188 expect_trait_ref, &'hir TraitRef<'hir>, Node::TraitRef(n), n;
5189 expect_opaque_ty, &'hir OpaqueTy<'hir>, Node::OpaqueTy(n), n;
5190 expect_pat, &'hir Pat<'hir>, Node::Pat(n), n;
5191 expect_pat_field, &'hir PatField<'hir>, Node::PatField(n), n;
5192 expect_arm, &'hir Arm<'hir>, Node::Arm(n), n;
5193 expect_block, &'hir Block<'hir>, Node::Block(n), n;
5194 expect_let_stmt, &'hir LetStmt<'hir>, Node::LetStmt(n), n;
5195 expect_ctor, &'hir VariantData<'hir>, Node::Ctor(n), n;
5196 expect_lifetime, &'hir Lifetime, Node::Lifetime(n), n;
5197 expect_generic_param, &'hir GenericParam<'hir>, Node::GenericParam(n), n;
5198 expect_crate, &'hir Mod<'hir>, Node::Crate(n), n;
5199 expect_infer, &'hir InferArg, Node::Infer(n), n;
5200 expect_closure, &'hir Closure<'hir>, Node::Expr(Expr { kind: ExprKind::Closure(n), .. }), n;
5201 }
5202}
5203
5204#[cfg(target_pointer_width = "64")]
5206mod size_asserts {
5207 use rustc_data_structures::static_assert_size;
5208
5209 use super::*;
5210 const _: [(); 48] = [(); ::std::mem::size_of::<Block<'_>>()];static_assert_size!(Block<'_>, 48);
5212 const _: [(); 24] = [(); ::std::mem::size_of::<Body<'_>>()];static_assert_size!(Body<'_>, 24);
5213 const _: [(); 64] = [(); ::std::mem::size_of::<Expr<'_>>()];static_assert_size!(Expr<'_>, 64);
5214 const _: [(); 48] = [(); ::std::mem::size_of::<ExprKind<'_>>()];static_assert_size!(ExprKind<'_>, 48);
5215 const _: [(); 40] = [(); ::std::mem::size_of::<FnDecl<'_>>()];static_assert_size!(FnDecl<'_>, 40);
5216 const _: [(); 88] = [(); ::std::mem::size_of::<ForeignItem<'_>>()];static_assert_size!(ForeignItem<'_>, 88);
5217 const _: [(); 56] = [(); ::std::mem::size_of::<ForeignItemKind<'_>>()];static_assert_size!(ForeignItemKind<'_>, 56);
5218 const _: [(); 16] = [(); ::std::mem::size_of::<GenericArg<'_>>()];static_assert_size!(GenericArg<'_>, 16);
5219 const _: [(); 64] = [(); ::std::mem::size_of::<GenericBound<'_>>()];static_assert_size!(GenericBound<'_>, 64);
5220 const _: [(); 56] = [(); ::std::mem::size_of::<Generics<'_>>()];static_assert_size!(Generics<'_>, 56);
5221 const _: [(); 48] = [(); ::std::mem::size_of::<Impl<'_>>()];static_assert_size!(Impl<'_>, 48);
5222 const _: [(); 88] = [(); ::std::mem::size_of::<ImplItem<'_>>()];static_assert_size!(ImplItem<'_>, 88);
5223 const _: [(); 40] = [(); ::std::mem::size_of::<ImplItemKind<'_>>()];static_assert_size!(ImplItemKind<'_>, 40);
5224 const _: [(); 88] = [(); ::std::mem::size_of::<Item<'_>>()];static_assert_size!(Item<'_>, 88);
5225 const _: [(); 64] = [(); ::std::mem::size_of::<ItemKind<'_>>()];static_assert_size!(ItemKind<'_>, 64);
5226 const _: [(); 64] = [(); ::std::mem::size_of::<LetStmt<'_>>()];static_assert_size!(LetStmt<'_>, 64);
5227 const _: [(); 32] = [(); ::std::mem::size_of::<Param<'_>>()];static_assert_size!(Param<'_>, 32);
5228 const _: [(); 80] = [(); ::std::mem::size_of::<Pat<'_>>()];static_assert_size!(Pat<'_>, 80);
5229 const _: [(); 56] = [(); ::std::mem::size_of::<PatKind<'_>>()];static_assert_size!(PatKind<'_>, 56);
5230 const _: [(); 40] = [(); ::std::mem::size_of::<Path<'_>>()];static_assert_size!(Path<'_>, 40);
5231 const _: [(); 48] = [(); ::std::mem::size_of::<PathSegment<'_>>()];static_assert_size!(PathSegment<'_>, 48);
5232 const _: [(); 24] = [(); ::std::mem::size_of::<QPath<'_>>()];static_assert_size!(QPath<'_>, 24);
5233 const _: [(); 12] = [(); ::std::mem::size_of::<Res>()];static_assert_size!(Res, 12);
5234 const _: [(); 32] = [(); ::std::mem::size_of::<Stmt<'_>>()];static_assert_size!(Stmt<'_>, 32);
5235 const _: [(); 16] = [(); ::std::mem::size_of::<StmtKind<'_>>()];static_assert_size!(StmtKind<'_>, 16);
5236 const _: [(); 48] = [(); ::std::mem::size_of::<TraitImplHeader<'_>>()];static_assert_size!(TraitImplHeader<'_>, 48);
5237 const _: [(); 88] = [(); ::std::mem::size_of::<TraitItem<'_>>()];static_assert_size!(TraitItem<'_>, 88);
5238 const _: [(); 48] = [(); ::std::mem::size_of::<TraitItemKind<'_>>()];static_assert_size!(TraitItemKind<'_>, 48);
5239 const _: [(); 48] = [(); ::std::mem::size_of::<Ty<'_>>()];static_assert_size!(Ty<'_>, 48);
5240 const _: [(); 32] = [(); ::std::mem::size_of::<TyKind<'_>>()];static_assert_size!(TyKind<'_>, 32);
5241 }
5243
5244#[cfg(test)]
5245mod tests;