about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-08-06 23:09:15 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-08-06 23:09:15 +0200
commitd74af405eb349922e7aca4ecc510991bb5ae9ab4 (patch)
tree195ab7891f1b6fadf2c51e6d7fe6e1d5e7fbef0b
parenta09e9c99a4c58ab6208aa44c4061df9aa2e40197 (diff)
downloadrust-d74af405eb349922e7aca4ecc510991bb5ae9ab4.tar.gz
rust-d74af405eb349922e7aca4ecc510991bb5ae9ab4.zip
Remove unused cache.
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder.rs10
1 files changed, 0 insertions, 10 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs
index 29acacbf3b3..be5c7669b01 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder.rs
@@ -162,9 +162,6 @@ pub(super) struct DecodeContext<'a, 'tcx> {
     sess: Option<&'tcx Session>,
     tcx: Option<TyCtxt<'tcx>>,
 
-    // Cache the last used source_file for translating spans as an optimization.
-    last_source_file_index: usize,
-
     lazy_state: LazyState,
 
     // Used for decoding interpret::AllocIds in a cached & thread-safe manner.
@@ -193,7 +190,6 @@ pub(super) trait Metadata<'a, 'tcx>: Copy {
             blob: self.blob(),
             sess: self.sess().or(tcx.map(|tcx| tcx.sess)),
             tcx,
-            last_source_file_index: 0,
             lazy_state: LazyState::NoNode,
             alloc_decoding_session: self
                 .cdata()
@@ -582,12 +578,6 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span {
                 cnum
             );
 
-            // Decoding 'foreign' spans should be rare enough that it's
-            // not worth it to maintain a per-CrateNum cache for `last_source_file_index`.
-            // We just set it to 0, to ensure that we don't try to access something out
-            // of bounds for our initial 'guess'
-            decoder.last_source_file_index = 0;
-
             let foreign_data = decoder.cdata().cstore.get_crate_data(cnum);
             foreign_data.imported_source_file(metadata_index, sess)
         };