1
Fork 0

Introduce get_diagnostic_name

This commit is contained in:
Cameron Steffen 2021-10-04 15:57:39 -05:00
parent d7539a6af0
commit 33b9b95305
9 changed files with 59 additions and 34 deletions

View file

@ -0,0 +1,17 @@
use crate::def_id::DefId;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_span::Symbol;
#[derive(Debug, Default)]
pub struct DiagnosticItems {
pub id_to_name: FxHashMap<DefId, Symbol>,
pub name_to_id: FxHashMap<Symbol, DefId>,
}
impl<CTX: crate::HashStableContext> HashStable<CTX> for DiagnosticItems {
#[inline]
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
self.name_to_id.hash_stable(ctx, hasher);
}
}

View file

@ -18,6 +18,7 @@ mod arena;
pub mod def;
pub mod def_path_hash_map;
pub mod definitions;
pub mod diagnostic_items;
pub use rustc_span::def_id;
mod hir;
pub mod hir_id;