From 34e4d72929c33bb126e0b1b199faab9031e0f3de Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 30 May 2022 18:49:17 +0200 Subject: Separate `source_span` and `expn_that_defined` from `Definitions`. --- compiler/rustc_query_system/src/ich/hcx.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_query_system/src') 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 { pub struct StableHashingContext<'a> { definitions: &'a Definitions, cstore: &'a dyn CrateStore, + source_span: &'a IndexVec, // 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, 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, ) -> 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, ) -> 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] -- cgit 1.4.1-3-g733a5