Remove the IGNORED_ATTR_NAMES thread local
This commit is contained in:
parent
8d3e93beae
commit
643e71e2e1
3 changed files with 13 additions and 16 deletions
|
@ -19,8 +19,8 @@ use session::Session;
|
||||||
|
|
||||||
use std::cmp::Ord;
|
use std::cmp::Ord;
|
||||||
use std::hash as std_hash;
|
use std::hash as std_hash;
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
|
||||||
|
@ -36,8 +36,10 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHashingContextProvi
|
||||||
use rustc_data_structures::accumulate_vec::AccumulateVec;
|
use rustc_data_structures::accumulate_vec::AccumulateVec;
|
||||||
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
|
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
|
||||||
|
|
||||||
thread_local!(static IGNORED_ATTR_NAMES: RefCell<FxHashSet<Symbol>> =
|
pub fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
|
||||||
RefCell::new(FxHashSet()));
|
debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0);
|
||||||
|
ich::IGNORED_ATTRIBUTES.iter().map(|&s| Symbol::intern(s)).collect()
|
||||||
|
}
|
||||||
|
|
||||||
/// This is the context state available during incr. comp. hashing. It contains
|
/// This is the context state available during incr. comp. hashing. It contains
|
||||||
/// enough information to transform DefIds and HirIds into stable DefPaths (i.e.
|
/// enough information to transform DefIds and HirIds into stable DefPaths (i.e.
|
||||||
|
@ -90,15 +92,6 @@ impl<'gcx> StableHashingContext<'gcx> {
|
||||||
-> Self {
|
-> Self {
|
||||||
let hash_spans_initial = !sess.opts.debugging_opts.incremental_ignore_spans;
|
let hash_spans_initial = !sess.opts.debugging_opts.incremental_ignore_spans;
|
||||||
|
|
||||||
debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0);
|
|
||||||
IGNORED_ATTR_NAMES.with(|names| {
|
|
||||||
let mut names = names.borrow_mut();
|
|
||||||
if names.is_empty() {
|
|
||||||
names.extend(ich::IGNORED_ATTRIBUTES.iter()
|
|
||||||
.map(|&s| Symbol::intern(s)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
StableHashingContext {
|
StableHashingContext {
|
||||||
sess,
|
sess,
|
||||||
body_resolver: BodyResolver(krate),
|
body_resolver: BodyResolver(krate),
|
||||||
|
@ -186,9 +179,7 @@ impl<'gcx> StableHashingContext<'gcx> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_ignored_attr(&self, name: Symbol) -> bool {
|
pub fn is_ignored_attr(&self, name: Symbol) -> bool {
|
||||||
IGNORED_ATTR_NAMES.with(|names| {
|
self.sess.ignored_attr_names.contains(&name)
|
||||||
names.borrow().contains(&name)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self, f: F) {
|
pub fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self, f: F) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
pub use self::fingerprint::Fingerprint;
|
pub use self::fingerprint::Fingerprint;
|
||||||
pub use self::caching_codemap_view::CachingCodemapView;
|
pub use self::caching_codemap_view::CachingCodemapView;
|
||||||
pub use self::hcx::{StableHashingContext, NodeIdHashingMode,
|
pub use self::hcx::{StableHashingContext, NodeIdHashingMode,
|
||||||
hash_stable_trait_impls};
|
hash_stable_trait_impls, compute_ignored_attr_names};
|
||||||
mod fingerprint;
|
mod fingerprint;
|
||||||
mod caching_codemap_view;
|
mod caching_codemap_view;
|
||||||
mod hcx;
|
mod hcx;
|
||||||
|
|
|
@ -14,6 +14,7 @@ pub use self::code_stats::{SizeKind, TypeSizeInfo, VariantInfo};
|
||||||
use hir::def_id::CrateNum;
|
use hir::def_id::CrateNum;
|
||||||
use ich::Fingerprint;
|
use ich::Fingerprint;
|
||||||
|
|
||||||
|
use ich;
|
||||||
use lint;
|
use lint;
|
||||||
use middle::allocator::AllocatorKind;
|
use middle::allocator::AllocatorKind;
|
||||||
use middle::dependency_format;
|
use middle::dependency_format;
|
||||||
|
@ -28,6 +29,7 @@ use errors::{self, DiagnosticBuilder, DiagnosticId};
|
||||||
use errors::emitter::{Emitter, EmitterWriter};
|
use errors::emitter::{Emitter, EmitterWriter};
|
||||||
use syntax::json::JsonEmitter;
|
use syntax::json::JsonEmitter;
|
||||||
use syntax::feature_gate;
|
use syntax::feature_gate;
|
||||||
|
use syntax::symbol::Symbol;
|
||||||
use syntax::parse;
|
use syntax::parse;
|
||||||
use syntax::parse::ParseSess;
|
use syntax::parse::ParseSess;
|
||||||
use syntax::{ast, codemap};
|
use syntax::{ast, codemap};
|
||||||
|
@ -112,6 +114,9 @@ pub struct Session {
|
||||||
|
|
||||||
incr_comp_session: RefCell<IncrCompSession>,
|
incr_comp_session: RefCell<IncrCompSession>,
|
||||||
|
|
||||||
|
/// A cache of attributes ignored by StableHashingContext
|
||||||
|
pub ignored_attr_names: FxHashSet<Symbol>,
|
||||||
|
|
||||||
/// Some measurements that are being gathered during compilation.
|
/// Some measurements that are being gathered during compilation.
|
||||||
pub perf_stats: PerfStats,
|
pub perf_stats: PerfStats,
|
||||||
|
|
||||||
|
@ -975,6 +980,7 @@ pub fn build_session_(sopts: config::Options,
|
||||||
injected_panic_runtime: Cell::new(None),
|
injected_panic_runtime: Cell::new(None),
|
||||||
imported_macro_spans: RefCell::new(HashMap::new()),
|
imported_macro_spans: RefCell::new(HashMap::new()),
|
||||||
incr_comp_session: RefCell::new(IncrCompSession::NotInitialized),
|
incr_comp_session: RefCell::new(IncrCompSession::NotInitialized),
|
||||||
|
ignored_attr_names: ich::compute_ignored_attr_names(),
|
||||||
perf_stats: PerfStats {
|
perf_stats: PerfStats {
|
||||||
svh_time: Cell::new(Duration::from_secs(0)),
|
svh_time: Cell::new(Duration::from_secs(0)),
|
||||||
incr_comp_hashes_time: Cell::new(Duration::from_secs(0)),
|
incr_comp_hashes_time: Cell::new(Duration::from_secs(0)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue