Introduce get_diagnostic_name
This commit is contained in:
parent
d7539a6af0
commit
33b9b95305
9 changed files with 59 additions and 34 deletions
17
compiler/rustc_hir/src/diagnostic_items.rs
Normal file
17
compiler/rustc_hir/src/diagnostic_items.rs
Normal 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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue