@@ -162,9 +162,6 @@ pub(super) struct DecodeContext<'a, 'tcx> {
162
162
sess: Option<&'tcx Session>,
163
163
tcx: Option<TyCtxt<'tcx>>,
164
164
165
- // Cache the last used source_file for translating spans as an optimization.
166
- last_source_file_index: usize,
167
-
168
165
lazy_state: LazyState,
169
166
170
167
// Used for decoding interpret::AllocIds in a cached & thread-safe manner.
@@ -193,7 +190,6 @@ pub(super) trait Metadata<'a, 'tcx>: Copy {
193
190
blob: self.blob(),
194
191
sess: self.sess().or(tcx.map(|tcx| tcx.sess)),
195
192
tcx,
196
- last_source_file_index: 0,
197
193
lazy_state: LazyState::NoNode,
198
194
alloc_decoding_session: self
199
195
.cdata()
@@ -582,12 +578,6 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span {
582
578
cnum
583
579
);
584
580
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
-
591
581
let foreign_data = decoder.cdata().cstore.get_crate_data(cnum);
592
582
foreign_data.imported_source_file(metadata_index, sess)
593
583
};
0 commit comments