about summary refs log tree commit diff
path: root/compiler/rustc_query_system/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-05-30 18:49:17 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-06-14 22:45:51 +0200
commit34e4d72929c33bb126e0b1b199faab9031e0f3de (patch)
tree69b51523d44c6b69ba565ede45279fca81027797 /compiler/rustc_query_system/src
parentb676edd641dbd1049702e63dc027f92daa849d23 (diff)
downloadrust-34e4d72929c33bb126e0b1b199faab9031e0f3de.tar.gz
rust-34e4d72929c33bb126e0b1b199faab9031e0f3de.zip
Separate `source_span` and `expn_that_defined` from `Definitions`.
Diffstat (limited to 'compiler/rustc_query_system/src')
-rw-r--r--compiler/rustc_query_system/src/ich/hcx.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_query_system/src/ich/hcx.rs b/compiler/rustc_query_system/src/ich/hcx.rs
index 03ef8578eb7..d120742ffe3 100644
--- a/compiler/rustc_query_system/src/ich/hcx.rs
+++ b/compiler/rustc_query_system/src/ich/hcx.rs
@@ -7,6 +7,7 @@ use rustc_data_structures::sync::Lrc;
 use rustc_hir as hir;
 use rustc_hir::def_id::{DefId, LocalDefId};
 use rustc_hir::definitions::{DefPathHash, Definitions};
+use rustc_index::vec::IndexVec;
 use rustc_session::cstore::CrateStore;
 use rustc_session::Session;
 use rustc_span::source_map::SourceMap;
@@ -26,6 +27,7 @@ fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
 pub struct StableHashingContext<'a> {
     definitions: &'a Definitions,
     cstore: &'a dyn CrateStore,
+    source_span: &'a IndexVec<LocalDefId, Span>,
     // The value of `-Z incremental-ignore-spans`.
     // This field should only be used by `debug_opts_incremental_ignore_span`
     incremental_ignore_spans: bool,
@@ -56,6 +58,7 @@ impl<'a> StableHashingContext<'a> {
         sess: &'a Session,
         definitions: &'a Definitions,
         cstore: &'a dyn CrateStore,
+        source_span: &'a IndexVec<LocalDefId, Span>,
         always_ignore_spans: bool,
     ) -> Self {
         let hash_spans_initial =
@@ -65,6 +68,7 @@ impl<'a> StableHashingContext<'a> {
             body_resolver: BodyResolver::Forbidden,
             definitions,
             cstore,
+            source_span,
             incremental_ignore_spans: sess.opts.debugging_opts.incremental_ignore_spans,
             caching_source_map: None,
             raw_source_map: sess.source_map(),
@@ -77,11 +81,13 @@ impl<'a> StableHashingContext<'a> {
         sess: &'a Session,
         definitions: &'a Definitions,
         cstore: &'a dyn CrateStore,
+        source_span: &'a IndexVec<LocalDefId, Span>,
     ) -> Self {
         Self::new_with_or_without_spans(
             sess,
             definitions,
             cstore,
+            source_span,
             /*always_ignore_spans=*/ false,
         )
     }
@@ -91,9 +97,10 @@ impl<'a> StableHashingContext<'a> {
         sess: &'a Session,
         definitions: &'a Definitions,
         cstore: &'a dyn CrateStore,
+        source_span: &'a IndexVec<LocalDefId, Span>,
     ) -> Self {
         let always_ignore_spans = true;
-        Self::new_with_or_without_spans(sess, definitions, cstore, always_ignore_spans)
+        Self::new_with_or_without_spans(sess, definitions, cstore, source_span, always_ignore_spans)
     }
 
     /// Allow hashing
@@ -198,7 +205,7 @@ impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
 
     #[inline]
     fn def_span(&self, def_id: LocalDefId) -> Span {
-        self.definitions.def_span(def_id)
+        self.source_span[def_id]
     }
 
     #[inline]