1
Fork 0

Use UnhashMap for a few more maps

This avoids hashing data that's already hashed.
This commit is contained in:
Mark Rousskov 2024-01-17 17:09:04 -05:00
parent c58a5da7d4
commit 510fcd318b
4 changed files with 28 additions and 6 deletions

View file

@ -330,7 +330,7 @@ pub(crate) struct HygieneData {
/// would have collisions without a disambiguator.
/// The keys of this map are always computed with `ExpnData.disambiguator`
/// set to 0.
expn_data_disambiguators: FxHashMap<Hash64, u32>,
expn_data_disambiguators: UnhashMap<Hash64, u32>,
}
impl HygieneData {
@ -359,7 +359,7 @@ impl HygieneData {
dollar_crate_name: kw::DollarCrate,
}],
syntax_context_map: FxHashMap::default(),
expn_data_disambiguators: FxHashMap::default(),
expn_data_disambiguators: UnhashMap::default(),
}
}

View file

@ -10,8 +10,8 @@
//! information, source code snippets, etc.
use crate::*;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::{IntoDynSyncSend, MappedReadGuard, ReadGuard, RwLock};
use rustc_data_structures::unhash::UnhashMap;
use std::fs;
use std::io::{self, BorrowedBuf, Read};
use std::path::{self};
@ -164,7 +164,7 @@ impl FileLoader for RealFileLoader {
#[derive(Default)]
struct SourceMapFiles {
source_files: monotonic::MonotonicVec<Lrc<SourceFile>>,
stable_id_to_source_file: FxHashMap<StableSourceFileId, Lrc<SourceFile>>,
stable_id_to_source_file: UnhashMap<StableSourceFileId, Lrc<SourceFile>>,
}
pub struct SourceMap {