1use rustc_ast::node_id::NodeMap;
5use rustc_ast::{self as ast, NodeId};
6use rustc_attr_ir::StrippedCfgItem;
7use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
8use rustc_data_structures::steal::Steal;
9use rustc_data_structures::unord::{UnordMap, UnordSet};
10use rustc_errors::{ErrorGuaranteed, LintBuffer};
11use rustc_hir::def::{DefKind, Namespace, PerNS, Res};
12use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalDefIdMap, LocalModId, ModId};
13use rustc_hir::definitions::PerParentDisambiguatorState;
14use rustc_hir::{MissingLifetimeKind, TraitCandidate};
15use rustc_macros::{StableHash, TyDecodable, TyEncodable};
16use rustc_span::{ExpnId, Ident, Span, Symbol};
17use smallvec::SmallVec;
18
19use crate::middle::privacy::EffectiveVisibilities;
20use crate::ty::Visibility;
21
22#[derive(#[automatically_derived]
impl ::core::marker::Copy for PartialRes { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for PartialRes { }
#[automatically_derived]
impl ::core::clone::Clone for PartialRes {
#[inline]
fn clone(&self) -> PartialRes {
let _: ::core::clone::AssertParamIsClone<Res<NodeId>>;
let _: ::core::clone::AssertParamIsClone<usize>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for PartialRes {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "PartialRes",
"base_res", &self.base_res, "unresolved_segments",
&&self.unresolved_segments)
}
}Debug)]
39pub struct PartialRes {
40 base_res: Res<NodeId>,
41 unresolved_segments: usize,
42}
43
44impl PartialRes {
45 #[inline]
46 pub fn new(base_res: Res<NodeId>) -> Self {
47 PartialRes { base_res, unresolved_segments: 0 }
48 }
49
50 #[inline]
51 pub fn with_unresolved_segments(base_res: Res<NodeId>, mut unresolved_segments: usize) -> Self {
52 if base_res == Res::Err {
53 unresolved_segments = 0
54 }
55 PartialRes { base_res, unresolved_segments }
56 }
57
58 #[inline]
59 pub fn base_res(&self) -> Res<NodeId> {
60 self.base_res
61 }
62
63 #[inline]
64 pub fn unresolved_segments(&self) -> usize {
65 self.unresolved_segments
66 }
67
68 #[inline]
69 pub fn full_res(&self) -> Option<Res<NodeId>> {
70 (self.unresolved_segments == 0).then_some(self.base_res)
71 }
72
73 #[inline]
74 pub fn expect_full_res(&self) -> Res<NodeId> {
75 self.full_res().expect("unexpected unresolved segments")
76 }
77}
78
79#[derive(#[automatically_derived]
impl ::core::marker::Copy for LifetimeRes { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for LifetimeRes { }
#[automatically_derived]
impl ::core::clone::Clone for LifetimeRes {
#[inline]
fn clone(&self) -> LifetimeRes {
let _: ::core::clone::AssertParamIsClone<LocalDefId>;
let _: ::core::clone::AssertParamIsClone<NodeId>;
let _: ::core::clone::AssertParamIsClone<MissingLifetimeKind>;
let _: ::core::clone::AssertParamIsClone<ErrorGuaranteed>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for LifetimeRes {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
LifetimeRes::Param { param: __self_0, binder: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Param",
"param", __self_0, "binder", &__self_1),
LifetimeRes::Fresh { param: __self_0, kind: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "Fresh",
"param", __self_0, "kind", &__self_1),
LifetimeRes::Infer =>
::core::fmt::Formatter::write_str(f, "Infer"),
LifetimeRes::Static =>
::core::fmt::Formatter::write_str(f, "Static"),
LifetimeRes::Error(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Error",
&__self_0),
LifetimeRes::ElidedAnchor { start: __self_0, end: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"ElidedAnchor", "start", __self_0, "end", &__self_1),
}
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for LifetimeRes { }
#[automatically_derived]
impl ::core::cmp::PartialEq for LifetimeRes {
#[inline]
fn eq(&self, other: &LifetimeRes) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(LifetimeRes::Param { param: __self_0, binder: __self_1 },
LifetimeRes::Param { param: __arg1_0, binder: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(LifetimeRes::Fresh { param: __self_0, kind: __self_1 },
LifetimeRes::Fresh { param: __arg1_0, kind: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(LifetimeRes::Error(__self_0), LifetimeRes::Error(__arg1_0))
=> __self_0 == __arg1_0,
(LifetimeRes::ElidedAnchor { start: __self_0, end: __self_1 },
LifetimeRes::ElidedAnchor { start: __arg1_0, end: __arg1_1
}) => __self_0 == __arg1_0 && __self_1 == __arg1_1,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for LifetimeRes {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<LocalDefId>;
let _: ::core::cmp::AssertParamIsEq<NodeId>;
let _: ::core::cmp::AssertParamIsEq<MissingLifetimeKind>;
let _: ::core::cmp::AssertParamIsEq<ErrorGuaranteed>;
}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for LifetimeRes {
#[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 {
LifetimeRes::Param { param: __self_0, binder: __self_1 } => {
::core::hash::Hash::hash(__self_0, state);
::core::hash::Hash::hash(__self_1, state)
}
LifetimeRes::Fresh { param: __self_0, kind: __self_1 } => {
::core::hash::Hash::hash(__self_0, state);
::core::hash::Hash::hash(__self_1, state)
}
LifetimeRes::Error(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
LifetimeRes::ElidedAnchor { start: __self_0, end: __self_1 } => {
::core::hash::Hash::hash(__self_0, state);
::core::hash::Hash::hash(__self_1, state)
}
_ => {}
}
}
}Hash)]
81pub enum LifetimeRes {
82 Param {
84 param: LocalDefId,
86 binder: NodeId,
94 },
95 Fresh {
97 param: NodeId,
101 kind: MissingLifetimeKind,
103 },
104 Infer,
107 Static,
109 Error(ErrorGuaranteed),
111 ElidedAnchor { start: NodeId, end: NodeId },
113}
114
115#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Reexport { }
#[automatically_derived]
impl ::core::clone::Clone for Reexport {
#[inline]
fn clone(&self) -> Reexport {
let _: ::core::clone::AssertParamIsClone<DefId>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Reexport { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for Reexport {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Reexport::Single(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Single",
&__self_0),
Reexport::Glob(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Glob",
&__self_0),
Reexport::ExternCrate(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ExternCrate", &__self_0),
Reexport::MacroUse =>
::core::fmt::Formatter::write_str(f, "MacroUse"),
Reexport::MacroExport =>
::core::fmt::Formatter::write_str(f, "MacroExport"),
}
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for Reexport {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
Reexport::Single(ref __binding_0) => { 0usize }
Reexport::Glob(ref __binding_0) => { 1usize }
Reexport::ExternCrate(ref __binding_0) => { 2usize }
Reexport::MacroUse => { 3usize }
Reexport::MacroExport => { 4usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
Reexport::Single(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
Reexport::Glob(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
Reexport::ExternCrate(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
Reexport::MacroUse => {}
Reexport::MacroExport => {}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for Reexport {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
Reexport::Single(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
Reexport::Glob(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
Reexport::ExternCrate(::rustc_serialize::Decodable::decode(__decoder))
}
3usize => { Reexport::MacroUse }
4usize => { Reexport::MacroExport }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Reexport`, expected 0..5, actual {0}",
n));
}
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for Reexport {
#[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 {
Reexport::Single(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Reexport::Glob(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Reexport::ExternCrate(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
Reexport::MacroUse => {}
Reexport::MacroExport => {}
}
}
}
};StableHash)]
118pub enum Reexport {
119 Single(DefId),
120 Glob(DefId),
121 ExternCrate(DefId),
122 MacroUse,
123 MacroExport,
124}
125
126impl Reexport {
127 pub fn id(self) -> Option<DefId> {
128 match self {
129 Reexport::Single(id) | Reexport::Glob(id) | Reexport::ExternCrate(id) => Some(id),
130 Reexport::MacroUse | Reexport::MacroExport => None,
131 }
132 }
133}
134
135#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ModChild {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "ModChild",
"ident", &self.ident, "res", &self.res, "vis", &self.vis,
"reexport_chain", &&self.reexport_chain)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for ModChild {
fn encode(&self, __encoder: &mut __E) {
let ModChild {
ident: ref __binding_0,
res: ref __binding_1,
vis: ref __binding_2,
reexport_chain: ref __binding_3 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for ModChild {
fn decode(__decoder: &mut __D) -> Self {
ModChild {
ident: ::rustc_serialize::Decodable::decode(__decoder),
res: ::rustc_serialize::Decodable::decode(__decoder),
vis: ::rustc_serialize::Decodable::decode(__decoder),
reexport_chain: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for ModChild {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
ModChild {
ident: ref __binding_0,
res: ref __binding_1,
vis: ref __binding_2,
reexport_chain: 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)]
141pub struct ModChild {
142 pub ident: Ident,
144 pub res: Res<!>,
147 pub vis: Visibility<ModId>,
149 pub reexport_chain: SmallVec<[Reexport; 2]>,
152}
153
154#[derive(#[automatically_derived]
impl ::core::fmt::Debug for AmbigModChild {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "AmbigModChild",
"main", &self.main, "second", &&self.second)
}
}Debug, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for AmbigModChild {
fn encode(&self, __encoder: &mut __E) {
let AmbigModChild {
main: ref __binding_0, second: ref __binding_1 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for AmbigModChild {
fn decode(__decoder: &mut __D) -> Self {
AmbigModChild {
main: ::rustc_serialize::Decodable::decode(__decoder),
second: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
AmbigModChild {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
AmbigModChild {
main: ref __binding_0, second: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
156pub struct AmbigModChild {
157 pub main: ModChild,
158 pub second: ModChild,
159}
160
161#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ResolverGlobalCtxt {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["visibilities_for_hashing", "expn_that_defined",
"effective_visibilities", "macro_reachable_adts",
"extern_crate_map", "maybe_unused_trait_imports",
"module_children", "ambig_module_children", "glob_map",
"main_def", "trait_impls", "proc_macros",
"confused_type_with_std_module", "doc_link_resolutions",
"doc_link_traits_in_scope", "all_macro_rules",
"stripped_cfg_items", "delegation_infos"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.visibilities_for_hashing, &self.expn_that_defined,
&self.effective_visibilities, &self.macro_reachable_adts,
&self.extern_crate_map, &self.maybe_unused_trait_imports,
&self.module_children, &self.ambig_module_children,
&self.glob_map, &self.main_def, &self.trait_impls,
&self.proc_macros, &self.confused_type_with_std_module,
&self.doc_link_resolutions, &self.doc_link_traits_in_scope,
&self.all_macro_rules, &self.stripped_cfg_items,
&&self.delegation_infos];
::core::fmt::Formatter::debug_struct_fields_finish(f,
"ResolverGlobalCtxt", names, values)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
ResolverGlobalCtxt {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
ResolverGlobalCtxt {
visibilities_for_hashing: ref __binding_0,
expn_that_defined: ref __binding_1,
effective_visibilities: ref __binding_2,
macro_reachable_adts: ref __binding_3,
extern_crate_map: ref __binding_4,
maybe_unused_trait_imports: ref __binding_5,
module_children: ref __binding_6,
ambig_module_children: ref __binding_7,
glob_map: ref __binding_8,
main_def: ref __binding_9,
trait_impls: ref __binding_10,
proc_macros: ref __binding_11,
confused_type_with_std_module: ref __binding_12,
doc_link_resolutions: ref __binding_13,
doc_link_traits_in_scope: ref __binding_14,
all_macro_rules: ref __binding_15,
stripped_cfg_items: ref __binding_16,
delegation_infos: ref __binding_17 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
{ __binding_5.stable_hash(__hcx, __hasher); }
{ __binding_6.stable_hash(__hcx, __hasher); }
{ __binding_7.stable_hash(__hcx, __hasher); }
{ __binding_8.stable_hash(__hcx, __hasher); }
{ __binding_9.stable_hash(__hcx, __hasher); }
{ __binding_10.stable_hash(__hcx, __hasher); }
{ __binding_11.stable_hash(__hcx, __hasher); }
{ __binding_12.stable_hash(__hcx, __hasher); }
{ __binding_13.stable_hash(__hcx, __hasher); }
{ __binding_14.stable_hash(__hcx, __hasher); }
{ __binding_15.stable_hash(__hcx, __hasher); }
{ __binding_16.stable_hash(__hcx, __hasher); }
{ __binding_17.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
162pub struct ResolverGlobalCtxt {
163 pub visibilities_for_hashing: Vec<(LocalDefId, Visibility)>,
164 pub expn_that_defined: UnordMap<LocalDefId, ExpnId>,
166 pub effective_visibilities: EffectiveVisibilities,
167 pub macro_reachable_adts: FxIndexMap<LocalDefId, FxIndexSet<LocalDefId>>,
173 pub extern_crate_map: UnordMap<LocalDefId, CrateNum>,
174 pub maybe_unused_trait_imports: FxIndexSet<LocalDefId>,
175 pub module_children: LocalDefIdMap<Vec<ModChild>>,
176 pub ambig_module_children: LocalDefIdMap<Vec<AmbigModChild>>,
177 pub glob_map: FxIndexMap<LocalDefId, FxIndexSet<Symbol>>,
178 pub main_def: Option<MainDefinition>,
179 pub trait_impls: FxIndexMap<DefId, Vec<LocalDefId>>,
180 pub proc_macros: Vec<LocalDefId>,
183 pub confused_type_with_std_module: FxIndexMap<Span, Span>,
186 pub doc_link_resolutions: FxIndexMap<LocalModId, DocLinkResMap>,
187 pub doc_link_traits_in_scope: FxIndexMap<LocalModId, Vec<DefId>>,
188 pub all_macro_rules: UnordSet<Symbol>,
189 pub stripped_cfg_items: Vec<StrippedCfgItem>,
190 pub delegation_infos: FxIndexMap<LocalDefId, DelegationInfo>,
193}
194
195#[derive(#[automatically_derived]
impl<'tcx> ::core::fmt::Debug for PerOwnerResolverData<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["node_id_to_def_id", "lifetime_elision_allowed",
"label_res_map", "lifetimes_res_map", "trait_map",
"import_res", "extra_lifetime_params_map", "id", "def_id"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.node_id_to_def_id, &self.lifetime_elision_allowed,
&self.label_res_map, &self.lifetimes_res_map,
&self.trait_map, &self.import_res,
&self.extra_lifetime_params_map, &self.id, &&self.def_id];
::core::fmt::Formatter::debug_struct_fields_finish(f,
"PerOwnerResolverData", names, values)
}
}Debug)]
196pub struct PerOwnerResolverData<'tcx> {
197 pub node_id_to_def_id: NodeMap<LocalDefId> = Default::default(),
198 pub lifetime_elision_allowed: bool = false,
200 pub label_res_map: NodeMap<NodeId> = Default::default(),
203 pub lifetimes_res_map: NodeMap<LifetimeRes> = Default::default(),
205
206 pub trait_map: NodeMap<&'tcx [TraitCandidate<'tcx>]> = Default::default(),
207
208 pub import_res: PerNS<Option<Res<NodeId>>> = Default::default(),
210 pub extra_lifetime_params_map: NodeMap<Vec<(Ident, NodeId, MissingLifetimeKind)>> =
212 Default::default(),
213
214 pub id: NodeId,
216 pub def_id: LocalDefId,
218}
219
220impl<'tcx> PerOwnerResolverData<'tcx> {
221 pub fn new(id: NodeId, def_id: LocalDefId) -> PerOwnerResolverData<'tcx> {
222 PerOwnerResolverData { id, def_id, .. }
223 }
224
225 pub fn get_label_res(&self, id: NodeId) -> Option<NodeId> {
227 self.label_res_map.get(&id).copied()
228 }
229
230 pub fn get_lifetime_res(&self, id: NodeId) -> Option<LifetimeRes> {
232 self.lifetimes_res_map.get(&id).copied()
233 }
234
235 pub fn extra_lifetime_params(&self, id: NodeId) -> &[(Ident, NodeId, MissingLifetimeKind)] {
243 self.extra_lifetime_params_map.get(&id).map_or(&[], |v| &v[..])
244 }
245}
246
247#[derive(#[automatically_derived]
impl<'tcx> ::core::fmt::Debug for ResolverAstLowering<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f,
"ResolverAstLowering", "partial_res_map", &self.partial_res_map,
"next_node_id", &self.next_node_id, "owners", &self.owners,
"lint_buffer", &self.lint_buffer, "disambiguators",
&&self.disambiguators)
}
}Debug)]
250pub struct ResolverAstLowering<'tcx> {
251 pub partial_res_map: NodeMap<PartialRes>,
253
254 pub next_node_id: NodeId,
255
256 pub owners: NodeMap<PerOwnerResolverData<'tcx>>,
257
258 pub lint_buffer: Steal<LintBuffer>,
260
261 pub disambiguators: LocalDefIdMap<Steal<PerParentDisambiguatorState>>,
262}
263
264#[derive(#[automatically_derived]
impl ::core::fmt::Debug for DelegationInfo {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"DelegationInfo", "resolution_id", &&self.resolution_id)
}
}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 { resolution_id: ref __binding_0 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
265pub struct DelegationInfo {
266 pub resolution_id: Result<DefId, ErrorGuaranteed>,
272}
273
274#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for MainDefinition { }
#[automatically_derived]
impl ::core::clone::Clone for MainDefinition {
#[inline]
fn clone(&self) -> MainDefinition {
let _: ::core::clone::AssertParamIsClone<Res<NodeId>>;
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Span>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MainDefinition { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for MainDefinition {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"MainDefinition", "res", &self.res, "is_import", &self.is_import,
"span", &&self.span)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
MainDefinition {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
MainDefinition {
res: ref __binding_0,
is_import: 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)]
275pub struct MainDefinition {
276 pub res: Res<NodeId>,
277 pub is_import: bool,
278 pub span: Span,
279}
280
281impl MainDefinition {
282 pub fn opt_fn_def_id(self) -> Option<DefId> {
283 if let Res::Def(DefKind::Fn, def_id) = self.res { Some(def_id) } else { None }
284 }
285}
286
287pub type DocLinkResMap = FxIndexMap<(Symbol, Namespace), Option<Res<NodeId>>>;
290
291#[derive(#[automatically_derived]
impl ::core::fmt::Debug for AstOwner {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
AstOwner::NonOwner =>
::core::fmt::Formatter::write_str(f, "NonOwner"),
AstOwner::NestedUseTree(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"NestedUseTree", &__self_0),
AstOwner::Crate(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Crate",
&__self_0),
AstOwner::Item(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Item",
&__self_0),
AstOwner::TraitItem(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TraitItem", &__self_0),
AstOwner::ImplItem(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ImplItem", &__self_0),
AstOwner::ForeignItem(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ForeignItem", &__self_0),
}
}
}Debug)]
298pub enum AstOwner {
299 NonOwner,
301 NestedUseTree(LocalDefId),
304 Crate(Box<ast::Crate>),
305 Item(Box<ast::Item>),
306 TraitItem(Box<ast::AssocItem>),
307 ImplItem(Box<ast::AssocItem>),
308 ForeignItem(Box<ast::ForeignItem>),
309}