diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 05361b6564170..329cc2216a498 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -37,7 +37,7 @@ use rustc_data_structures::stable_hasher::{HashStable, use rustc_data_structures::accumulate_vec::AccumulateVec; use rustc_data_structures::fx::{FxHashSet, FxHashMap}; -pub fn compute_ignored_attr_names() -> FxHashSet { +fn compute_ignored_attr_names() -> FxHashSet { debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0); ich::IGNORED_ATTRIBUTES.iter().map(|&s| Symbol::intern(s)).collect() } @@ -183,7 +183,10 @@ impl<'a> StableHashingContext<'a> { #[inline] pub fn is_ignored_attr(&self, name: Symbol) -> bool { - self.sess.ignored_attr_names.contains(&name) + thread_local! { + static IGNORED_ATTRIBUTES: FxHashSet = compute_ignored_attr_names(); + } + IGNORED_ATTRIBUTES.with(|attrs| attrs.contains(&name)) } pub fn hash_hir_item_like(&mut self, f: F) { diff --git a/src/librustc/ich/mod.rs b/src/librustc/ich/mod.rs index dbb9ecaddfd33..b00d8c565694a 100644 --- a/src/librustc/ich/mod.rs +++ b/src/librustc/ich/mod.rs @@ -13,7 +13,7 @@ crate use rustc_data_structures::fingerprint::Fingerprint; pub use self::caching_codemap_view::CachingCodemapView; pub use self::hcx::{StableHashingContextProvider, StableHashingContext, NodeIdHashingMode, - hash_stable_trait_impls, compute_ignored_attr_names}; + hash_stable_trait_impls}; mod caching_codemap_view; mod hcx; diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index ece58978c5d53..c3d4d3abf9a4c 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -14,7 +14,6 @@ use self::code_stats::CodeStats; use hir::def_id::CrateNum; use rustc_data_structures::fingerprint::Fingerprint; -use ich; use lint; use lint::builtin::BuiltinLintDiagnostics; use middle::allocator::AllocatorKind; @@ -34,7 +33,6 @@ use errors::emitter::{Emitter, EmitterWriter}; use syntax::edition::Edition; use syntax::json::JsonEmitter; use syntax::feature_gate; -use syntax::symbol::Symbol; use syntax::parse; use syntax::parse::ParseSess; use syntax::{ast, codemap}; @@ -128,9 +126,6 @@ pub struct Session { incr_comp_session: OneThread>, - /// A cache of attributes ignored by StableHashingContext - pub ignored_attr_names: FxHashSet, - /// Used by -Z profile-queries in util::common pub profile_channel: Lock>>, @@ -1143,7 +1138,6 @@ pub fn build_session_( injected_panic_runtime: Once::new(), imported_macro_spans: OneThread::new(RefCell::new(HashMap::new())), incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)), - ignored_attr_names: ich::compute_ignored_attr_names(), self_profiling: Lock::new(SelfProfiler::new()), profile_channel: Lock::new(None), perf_stats: PerfStats {