Skip to main content

rustc_hir/
diagnostic_items.rs

1use rustc_data_structures::fx::FxIndexMap;
2use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
3use rustc_span::Symbol;
4use rustc_span::def_id::DefIdMap;
5
6use crate::def_id::DefId;
7
8#[derive(#[automatically_derived]
impl ::core::fmt::Debug for DiagnosticItems {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "DiagnosticItems", "id_to_name", &self.id_to_name, "name_to_id",
            &&self.name_to_id)
    }
}Debug, #[automatically_derived]
impl ::core::default::Default for DiagnosticItems {
    #[inline]
    fn default() -> DiagnosticItems {
        DiagnosticItems {
            id_to_name: ::core::default::Default::default(),
            name_to_id: ::core::default::Default::default(),
        }
    }
}Default)]
9pub struct DiagnosticItems {
10    pub id_to_name: DefIdMap<Symbol>,
11    pub name_to_id: FxIndexMap<Symbol, DefId>,
12}
13
14impl<CTX: crate::HashStableContext> HashStable<CTX> for DiagnosticItems {
15    #[inline]
16    fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
17        self.name_to_id.hash_stable(ctx, hasher);
18    }
19}