Skip to content

Commit

Permalink
mv CachingCodemapView CachingSourceMapView
Browse files Browse the repository at this point in the history
  • Loading branch information
dsciarra committed Aug 17, 2018
1 parent a8154c7 commit 99554c1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/librustc/ich/caching_codemap_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ struct CacheEntry {
}

#[derive(Clone)]
pub struct CachingCodemapView<'cm> {
pub struct CachingSourceMapView<'cm> {
source_map: &'cm SourceMap,
line_cache: [CacheEntry; 3],
time_stamp: usize,
}

impl<'cm> CachingCodemapView<'cm> {
pub fn new(source_map: &'cm SourceMap) -> CachingCodemapView<'cm> {
impl<'cm> CachingSourceMapView<'cm> {
pub fn new(source_map: &'cm SourceMap) -> CachingSourceMapView<'cm> {
let files = source_map.files();
let first_file = files[0].clone();
let entry = CacheEntry {
Expand All @@ -42,7 +42,7 @@ impl<'cm> CachingCodemapView<'cm> {
file_index: 0,
};

CachingCodemapView {
CachingSourceMapView {
source_map,
line_cache: [entry.clone(), entry.clone(), entry.clone()],
time_stamp: 0,
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use hir;
use hir::def_id::{DefId, DefIndex};
use hir::map::DefPathHash;
use hir::map::definitions::Definitions;
use ich::{self, CachingCodemapView, Fingerprint};
use ich::{self, CachingSourceMapView, Fingerprint};
use middle::cstore::CrateStore;
use ty::{TyCtxt, fast_reject};
use mir::interpret::AllocId;
Expand Down Expand Up @@ -57,9 +57,9 @@ pub struct StableHashingContext<'a> {
node_id_hashing_mode: NodeIdHashingMode,

// Very often, we are hashing something that does not need the
// CachingCodemapView, so we initialize it lazily.
// CachingSourceMapView, so we initialize it lazily.
raw_source_map: &'a SourceMap,
caching_source_map: Option<CachingCodemapView<'a>>,
caching_source_map: Option<CachingSourceMapView<'a>>,

pub(super) alloc_id_recursion_tracker: FxHashSet<AllocId>,
}
Expand Down Expand Up @@ -169,13 +169,13 @@ impl<'a> StableHashingContext<'a> {
}

#[inline]
pub fn source_map(&mut self) -> &mut CachingCodemapView<'a> {
pub fn source_map(&mut self) -> &mut CachingSourceMapView<'a> {
match self.caching_source_map {
Some(ref mut cm) => {
cm
}
ref mut none => {
*none = Some(CachingCodemapView::new(self.raw_source_map));
*none = Some(CachingSourceMapView::new(self.raw_source_map));
none.as_mut().unwrap()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ich/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! ICH - Incremental Compilation Hash

crate use rustc_data_structures::fingerprint::Fingerprint;
pub use self::caching_codemap_view::CachingCodemapView;
pub use self::caching_codemap_view::CachingSourceMapView;
pub use self::hcx::{StableHashingContextProvider, StableHashingContext, NodeIdHashingMode,
hash_stable_trait_impls};
mod caching_codemap_view;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/query/on_disk_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use hir;
use hir::def_id::{CrateNum, DefIndex, DefId, LocalDefId,
RESERVED_FOR_INCR_COMP_CACHE, LOCAL_CRATE};
use hir::map::definitions::DefPathHash;
use ich::{CachingCodemapView, Fingerprint};
use ich::{CachingSourceMapView, Fingerprint};
use mir::{self, interpret};
use mir::interpret::{AllocDecodingSession, AllocDecodingState};
use rustc_data_structures::fx::FxHashMap;
Expand Down Expand Up @@ -196,7 +196,7 @@ impl<'sess> OnDiskCache<'sess> {
expn_info_shorthands: FxHashMap(),
interpret_allocs: FxHashMap(),
interpret_allocs_inverse: Vec::new(),
source_map: CachingCodemapView::new(tcx.sess.source_map()),
source_map: CachingSourceMapView::new(tcx.sess.source_map()),
file_to_file_index,
};

Expand Down Expand Up @@ -770,7 +770,7 @@ struct CacheEncoder<'enc, 'a, 'tcx, E>
expn_info_shorthands: FxHashMap<Mark, AbsoluteBytePos>,
interpret_allocs: FxHashMap<interpret::AllocId, usize>,
interpret_allocs_inverse: Vec<interpret::AllocId>,
source_map: CachingCodemapView<'tcx>,
source_map: CachingSourceMapView<'tcx>,
file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>,
}

Expand Down

0 comments on commit 99554c1

Please sign in to comment.