Skip to content

Commit d74af40

Browse files
committed
Remove unused cache.
1 parent a09e9c9 commit d74af40

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

compiler/rustc_metadata/src/rmeta/decoder.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ pub(super) struct DecodeContext<'a, 'tcx> {
162162
sess: Option<&'tcx Session>,
163163
tcx: Option<TyCtxt<'tcx>>,
164164

165-
// Cache the last used source_file for translating spans as an optimization.
166-
last_source_file_index: usize,
167-
168165
lazy_state: LazyState,
169166

170167
// Used for decoding interpret::AllocIds in a cached & thread-safe manner.
@@ -193,7 +190,6 @@ pub(super) trait Metadata<'a, 'tcx>: Copy {
193190
blob: self.blob(),
194191
sess: self.sess().or(tcx.map(|tcx| tcx.sess)),
195192
tcx,
196-
last_source_file_index: 0,
197193
lazy_state: LazyState::NoNode,
198194
alloc_decoding_session: self
199195
.cdata()
@@ -582,12 +578,6 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span {
582578
cnum
583579
);
584580

585-
// Decoding 'foreign' spans should be rare enough that it's
586-
// not worth it to maintain a per-CrateNum cache for `last_source_file_index`.
587-
// We just set it to 0, to ensure that we don't try to access something out
588-
// of bounds for our initial 'guess'
589-
decoder.last_source_file_index = 0;
590-
591581
let foreign_data = decoder.cdata().cstore.get_crate_data(cnum);
592582
foreign_data.imported_source_file(metadata_index, sess)
593583
};

0 commit comments

Comments
 (0)