1
Fork 0

incr.comp.: Remove tcx from StableHashingContext.

This commit is contained in:
Michael Woerister 2017-09-14 15:10:24 +02:00
parent ba6f93ca76
commit d5b1fee6fd
28 changed files with 300 additions and 277 deletions

View file

@ -603,12 +603,12 @@ trait DepNodeParams<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> : fmt::Debug {
} }
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a, T> DepNodeParams<'a, 'gcx, 'tcx> for T impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a, T> DepNodeParams<'a, 'gcx, 'tcx> for T
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> + fmt::Debug where T: HashStable<StableHashingContext<'gcx>> + fmt::Debug
{ {
default const CAN_RECONSTRUCT_QUERY_KEY: bool = false; default const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
default fn to_fingerprint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Fingerprint { default fn to_fingerprint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Fingerprint {
let mut hcx = StableHashingContext::new(tcx); let mut hcx = tcx.create_stable_hashing_context();
let mut hasher = StableHasher::new(); let mut hasher = StableHasher::new();
self.hash_stable(&mut hcx, &mut hasher); self.hash_stable(&mut hcx, &mut hasher);

View file

@ -247,7 +247,7 @@ pub struct Map<'hir> {
/// plain old integers. /// plain old integers.
map: Vec<MapEntry<'hir>>, map: Vec<MapEntry<'hir>>,
definitions: Definitions, definitions: &'hir Definitions,
/// Bodies inlined from other crates are cached here. /// Bodies inlined from other crates are cached here.
inlined_bodies: RefCell<DefIdMap<&'hir Body>>, inlined_bodies: RefCell<DefIdMap<&'hir Body>>,
@ -304,8 +304,8 @@ impl<'hir> Map<'hir> {
} }
#[inline] #[inline]
pub fn definitions(&self) -> &Definitions { pub fn definitions(&self) -> &'hir Definitions {
&self.definitions self.definitions
} }
pub fn def_key(&self, def_id: DefId) -> DefKey { pub fn def_key(&self, def_id: DefId) -> DefKey {
@ -1013,7 +1013,7 @@ impl Named for TraitItem { fn name(&self) -> Name { self.name } }
impl Named for ImplItem { fn name(&self) -> Name { self.name } } impl Named for ImplItem { fn name(&self) -> Name { self.name } }
pub fn map_crate<'hir>(forest: &'hir mut Forest, pub fn map_crate<'hir>(forest: &'hir mut Forest,
definitions: Definitions) definitions: &'hir Definitions)
-> Map<'hir> { -> Map<'hir> {
let map = { let map = {
let mut collector = NodeCollector::root(&forest.krate, let mut collector = NodeCollector::root(&forest.krate,

View file

@ -11,7 +11,9 @@
use hir; use hir;
use hir::def_id::{DefId, DefIndex}; use hir::def_id::{DefId, DefIndex};
use hir::map::DefPathHash; use hir::map::DefPathHash;
use hir::map::definitions::Definitions;
use ich::{self, CachingCodemapView}; use ich::{self, CachingCodemapView};
use middle::cstore::CrateStore;
use session::config::DebugInfoLevel::NoDebugInfo; use session::config::DebugInfoLevel::NoDebugInfo;
use ty::{self, TyCtxt, fast_reject}; use ty::{self, TyCtxt, fast_reject};
use session::Session; use session::Session;
@ -41,8 +43,10 @@ thread_local!(static IGNORED_ATTR_NAMES: RefCell<FxHashSet<Symbol>> =
/// enough information to transform DefIds and HirIds into stable DefPaths (i.e. /// enough information to transform DefIds and HirIds into stable DefPaths (i.e.
/// a reference to the TyCtxt) and it holds a few caches for speeding up various /// a reference to the TyCtxt) and it holds a few caches for speeding up various
/// things (e.g. each DefId/DefPath is only hashed once). /// things (e.g. each DefId/DefPath is only hashed once).
pub struct StableHashingContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { pub struct StableHashingContext<'gcx> {
tcx: TyCtxt<'a, 'gcx, 'tcx>, sess: &'gcx Session,
definitions: &'gcx Definitions,
cstore: &'gcx CrateStore,
body_resolver: BodyResolver<'gcx>, body_resolver: BodyResolver<'gcx>,
hash_spans: bool, hash_spans: bool,
hash_bodies: bool, hash_bodies: bool,
@ -65,21 +69,27 @@ pub enum NodeIdHashingMode {
/// We could also just store a plain reference to the hir::Crate but we want /// We could also just store a plain reference to the hir::Crate but we want
/// to avoid that the crate is used to get untracked access to all of the HIR. /// to avoid that the crate is used to get untracked access to all of the HIR.
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
struct BodyResolver<'hir>(&'hir hir::Crate); struct BodyResolver<'gcx>(&'gcx hir::Crate);
impl<'hir> BodyResolver<'hir> { impl<'gcx> BodyResolver<'gcx> {
// Return a reference to the hir::Body with the given BodyId. // Return a reference to the hir::Body with the given BodyId.
// DOES NOT DO ANY TRACKING, use carefully. // DOES NOT DO ANY TRACKING, use carefully.
fn body(self, id: hir::BodyId) -> &'hir hir::Body { fn body(self, id: hir::BodyId) -> &'gcx hir::Body {
self.0.body(id) self.0.body(id)
} }
} }
impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> { impl<'gcx> StableHashingContext<'gcx> {
// The `krate` here is only used for mapping BodyIds to Bodies.
pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { // Don't use it for anything else or you'll run the risk of
let hash_spans_initial = tcx.sess.opts.debuginfo != NoDebugInfo; // leaking data out of the tracking system.
let check_overflow_initial = tcx.sess.overflow_checks(); pub fn new(sess: &'gcx Session,
krate: &'gcx hir::Crate,
definitions: &'gcx Definitions,
cstore: &'gcx CrateStore)
-> Self {
let hash_spans_initial = sess.opts.debuginfo != NoDebugInfo;
let check_overflow_initial = sess.overflow_checks();
debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0); debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0);
IGNORED_ATTR_NAMES.with(|names| { IGNORED_ATTR_NAMES.with(|names| {
@ -90,13 +100,13 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> {
} }
}); });
let body_resolver = BodyResolver(tcx.dep_graph.with_ignore(|| tcx.hir.krate()));
StableHashingContext { StableHashingContext {
tcx, sess,
body_resolver, body_resolver: BodyResolver(krate),
definitions,
cstore,
caching_codemap: None, caching_codemap: None,
raw_codemap: tcx.sess.codemap(), raw_codemap: sess.codemap(),
hash_spans: hash_spans_initial, hash_spans: hash_spans_initial,
hash_bodies: true, hash_bodies: true,
overflow_checks_enabled: check_overflow_initial, overflow_checks_enabled: check_overflow_initial,
@ -106,7 +116,7 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> {
#[inline] #[inline]
pub fn sess(&self) -> &'gcx Session { pub fn sess(&self) -> &'gcx Session {
self.tcx.sess self.sess
} }
pub fn force_span_hashing(mut self) -> Self { pub fn force_span_hashing(mut self) -> Self {
@ -146,12 +156,16 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> {
#[inline] #[inline]
pub fn def_path_hash(&self, def_id: DefId) -> DefPathHash { pub fn def_path_hash(&self, def_id: DefId) -> DefPathHash {
self.tcx.def_path_hash(def_id) if def_id.is_local() {
self.definitions.def_path_hash(def_id.index)
} else {
self.cstore.def_path_hash(def_id)
}
} }
#[inline] #[inline]
pub fn local_def_path_hash(&self, def_index: DefIndex) -> DefPathHash { pub fn local_def_path_hash(&self, def_index: DefIndex) -> DefPathHash {
self.tcx.hir.definitions().def_path_hash(def_index) self.definitions.def_path_hash(def_index)
} }
#[inline] #[inline]
@ -239,15 +253,15 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> {
} }
impl<'a, 'gcx, 'lcx> StableHashingContextProvider for ty::TyCtxt<'a, 'gcx, 'lcx> { impl<'a, 'gcx, 'lcx> StableHashingContextProvider for ty::TyCtxt<'a, 'gcx, 'lcx> {
type ContextType = StableHashingContext<'a, 'gcx, 'lcx>; type ContextType = StableHashingContext<'gcx>;
fn create_stable_hashing_context(&self) -> Self::ContextType { fn create_stable_hashing_context(&self) -> Self::ContextType {
StableHashingContext::new(*self) (*self).create_stable_hashing_context()
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::BodyId { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::BodyId {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
if hcx.hash_bodies() { if hcx.hash_bodies() {
hcx.body_resolver.body(*self).hash_stable(hcx, hasher); hcx.body_resolver.body(*self).hash_stable(hcx, hasher);
@ -255,10 +269,10 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::B
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::HirId { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::HirId {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
match hcx.node_id_hashing_mode { match hcx.node_id_hashing_mode {
NodeIdHashingMode::Ignore => { NodeIdHashingMode::Ignore => {
@ -270,52 +284,52 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::H
local_id, local_id,
} = *self; } = *self;
hcx.tcx.hir.definitions().def_path_hash(owner).hash_stable(hcx, hasher); hcx.local_def_path_hash(owner).hash_stable(hcx, hasher);
local_id.hash_stable(hcx, hasher); local_id.hash_stable(hcx, hasher);
} }
} }
} }
} }
impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> for hir::HirId { impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for hir::HirId {
type KeyType = (DefPathHash, hir::ItemLocalId); type KeyType = (DefPathHash, hir::ItemLocalId);
#[inline] #[inline]
fn to_stable_hash_key(&self, fn to_stable_hash_key(&self,
hcx: &StableHashingContext<'a, 'gcx, 'tcx>) hcx: &StableHashingContext<'gcx>)
-> (DefPathHash, hir::ItemLocalId) { -> (DefPathHash, hir::ItemLocalId) {
let def_path_hash = hcx.local_def_path_hash(self.owner); let def_path_hash = hcx.local_def_path_hash(self.owner);
(def_path_hash, self.local_id) (def_path_hash, self.local_id)
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ast::NodeId { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::NodeId {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
match hcx.node_id_hashing_mode { match hcx.node_id_hashing_mode {
NodeIdHashingMode::Ignore => { NodeIdHashingMode::Ignore => {
// Don't do anything. // Don't do anything.
} }
NodeIdHashingMode::HashDefPath => { NodeIdHashingMode::HashDefPath => {
hcx.tcx.hir.node_to_hir_id(*self).hash_stable(hcx, hasher); hcx.definitions.node_to_hir_id(*self).hash_stable(hcx, hasher);
} }
} }
} }
} }
impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> for ast::NodeId { impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for ast::NodeId {
type KeyType = (DefPathHash, hir::ItemLocalId); type KeyType = (DefPathHash, hir::ItemLocalId);
#[inline] #[inline]
fn to_stable_hash_key(&self, fn to_stable_hash_key(&self,
hcx: &StableHashingContext<'a, 'gcx, 'tcx>) hcx: &StableHashingContext<'gcx>)
-> (DefPathHash, hir::ItemLocalId) { -> (DefPathHash, hir::ItemLocalId) {
hcx.tcx.hir.node_to_hir_id(*self).to_stable_hash_key(hcx) hcx.definitions.node_to_hir_id(*self).to_stable_hash_key(hcx)
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for Span { impl<'gcx> HashStable<StableHashingContext<'gcx>> for Span {
// Hash a span in a stable way. We can't directly hash the span's BytePos // Hash a span in a stable way. We can't directly hash the span's BytePos
// fields (that would be similar to hashing pointers, since those are just // fields (that would be similar to hashing pointers, since those are just
@ -327,7 +341,7 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for Span {
// Also, hashing filenames is expensive so we avoid doing it twice when the // Also, hashing filenames is expensive so we avoid doing it twice when the
// span starts and ends in the same file, which is almost always the case. // span starts and ends in the same file, which is almost always the case.
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use syntax_pos::Pos; use syntax_pos::Pos;
@ -390,8 +404,8 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for Span {
} }
} }
pub fn hash_stable_trait_impls<'a, 'tcx, 'gcx, W, R>( pub fn hash_stable_trait_impls<'gcx, W, R>(
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>, hasher: &mut StableHasher<W>,
blanket_impls: &Vec<DefId>, blanket_impls: &Vec<DefId>,
non_blanket_impls: &HashMap<fast_reject::SimplifiedType, Vec<DefId>, R>) non_blanket_impls: &HashMap<fast_reject::SimplifiedType, Vec<DefId>, R>)

View file

@ -20,28 +20,28 @@ use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
use std::mem; use std::mem;
use syntax::ast; use syntax::ast;
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for DefId { impl<'gcx> HashStable<StableHashingContext<'gcx>> for DefId {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
hcx.def_path_hash(*self).hash_stable(hcx, hasher); hcx.def_path_hash(*self).hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> for DefId { impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for DefId {
type KeyType = DefPathHash; type KeyType = DefPathHash;
#[inline] #[inline]
fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a, 'gcx, 'tcx>) -> DefPathHash { fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash {
hcx.def_path_hash(*self) hcx.def_path_hash(*self)
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for CrateNum { impl<'gcx> HashStable<StableHashingContext<'gcx>> for CrateNum {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
hcx.def_path_hash(DefId { hcx.def_path_hash(DefId {
krate: *self, krate: *self,
@ -50,11 +50,11 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for CrateN
} }
} }
impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> for CrateNum { impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for CrateNum {
type KeyType = DefPathHash; type KeyType = DefPathHash;
#[inline] #[inline]
fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a, 'gcx, 'tcx>) -> DefPathHash { fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash {
let def_id = DefId { krate: *self, index: CRATE_DEF_INDEX }; let def_id = DefId { krate: *self, index: CRATE_DEF_INDEX };
def_id.to_stable_hash_key(hcx) def_id.to_stable_hash_key(hcx)
} }
@ -62,13 +62,13 @@ impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> for C
impl_stable_hash_for!(tuple_struct hir::ItemLocalId { index }); impl_stable_hash_for!(tuple_struct hir::ItemLocalId { index });
impl<'a, 'gcx, 'lcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'lcx>> impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>>
for hir::ItemLocalId { for hir::ItemLocalId {
type KeyType = hir::ItemLocalId; type KeyType = hir::ItemLocalId;
#[inline] #[inline]
fn to_stable_hash_key(&self, fn to_stable_hash_key(&self,
_: &StableHashingContext<'a, 'gcx, 'lcx>) _: &StableHashingContext<'gcx>)
-> hir::ItemLocalId { -> hir::ItemLocalId {
*self *self
} }
@ -81,9 +81,9 @@ for hir::ItemLocalId {
// want to pick up on a reference changing its target, so we hash the NodeIds // want to pick up on a reference changing its target, so we hash the NodeIds
// in "DefPath Mode". // in "DefPath Mode".
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::ItemId { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ItemId {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::ItemId { let hir::ItemId {
id id
@ -95,9 +95,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::I
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::TraitItemId { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItemId {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::TraitItemId { let hir::TraitItemId {
node_id node_id
@ -109,9 +109,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::T
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::ImplItemId { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ImplItemId {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::ImplItemId { let hir::ImplItemId {
node_id node_id
@ -231,9 +231,9 @@ impl_stable_hash_for!(struct hir::TypeBinding {
span span
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::Ty { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Ty {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
hcx.while_hashing_hir_bodies(true, |hcx| { hcx.while_hashing_hir_bodies(true, |hcx| {
let hir::Ty { let hir::Ty {
@ -292,9 +292,9 @@ impl_stable_hash_for!(enum hir::FunctionRetTy {
Return(t) Return(t)
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::TraitRef { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitRef {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::TraitRef { let hir::TraitRef {
ref path, ref path,
@ -329,9 +329,9 @@ impl_stable_hash_for!(struct hir::MacroDef {
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::Block { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Block {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::Block { let hir::Block {
ref stmts, ref stmts,
@ -377,9 +377,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::B
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::Pat { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Pat {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::Pat { let hir::Pat {
id: _, id: _,
@ -504,9 +504,9 @@ impl_stable_hash_for!(enum hir::UnsafeSource {
UserProvided UserProvided
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::Expr { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Expr {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
hcx.while_hashing_hir_bodies(true, |hcx| { hcx.while_hashing_hir_bodies(true, |hcx| {
let hir::Expr { let hir::Expr {
@ -622,9 +622,9 @@ impl_stable_hash_for!(enum hir::LoopSource {
ForLoop ForLoop
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::MatchSource { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::MatchSource {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use hir::MatchSource; use hir::MatchSource;
@ -673,9 +673,9 @@ impl_stable_hash_for!(enum hir::ScopeTarget {
Loop(loop_id_result) Loop(loop_id_result)
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ast::Ident { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::Ident {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ast::Ident { let ast::Ident {
ref name, ref name,
@ -686,9 +686,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ast::I
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::TraitItem { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItem {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::TraitItem { let hir::TraitItem {
id, id,
@ -720,9 +720,9 @@ impl_stable_hash_for!(enum hir::TraitItemKind {
Type(bounds, rhs) Type(bounds, rhs)
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::ImplItem { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ImplItem {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::ImplItem { let hir::ImplItem {
id, id,
@ -753,9 +753,9 @@ impl_stable_hash_for!(enum hir::ImplItemKind {
Type(t) Type(t)
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::Visibility { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Visibility {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -774,9 +774,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::V
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::Defaultness { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Defaultness {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -795,9 +795,9 @@ impl_stable_hash_for!(enum hir::ImplPolarity {
Negative Negative
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::Mod { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Mod {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::Mod { let hir::Mod {
inner, inner,
@ -850,9 +850,9 @@ impl_stable_hash_for!(enum hir::VariantData {
Unit(id) Unit(id)
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::Item { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hash_spans = match self.node { let hash_spans = match self.node {
hir::ItemStatic(..) | hir::ItemStatic(..) |
@ -933,10 +933,10 @@ impl_stable_hash_for!(struct hir::ImplItemRef {
defaultness defaultness
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for hir::AssociatedItemKind { for hir::AssociatedItemKind {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -977,9 +977,9 @@ impl_stable_hash_for!(struct hir::Arg {
hir_id hir_id
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::Body { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Body {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::Body { let hir::Body {
ref arguments, ref arguments,
@ -995,12 +995,12 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::B
} }
} }
impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> for hir::BodyId { impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for hir::BodyId {
type KeyType = (DefPathHash, hir::ItemLocalId); type KeyType = (DefPathHash, hir::ItemLocalId);
#[inline] #[inline]
fn to_stable_hash_key(&self, fn to_stable_hash_key(&self,
hcx: &StableHashingContext<'a, 'gcx, 'tcx>) hcx: &StableHashingContext<'gcx>)
-> (DefPathHash, hir::ItemLocalId) { -> (DefPathHash, hir::ItemLocalId) {
let hir::BodyId { node_id } = *self; let hir::BodyId { node_id } = *self;
node_id.to_stable_hash_key(hcx) node_id.to_stable_hash_key(hcx)
@ -1013,9 +1013,9 @@ impl_stable_hash_for!(struct hir::InlineAsmOutput {
is_indirect is_indirect
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::GlobalAsm { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::GlobalAsm {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::GlobalAsm { let hir::GlobalAsm {
asm, asm,
@ -1026,9 +1026,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::G
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for hir::InlineAsm { impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::InlineAsm {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let hir::InlineAsm { let hir::InlineAsm {
asm, asm,
@ -1103,22 +1103,22 @@ impl_stable_hash_for!(enum hir::Constness {
NotConst NotConst
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for hir::def_id::DefIndex { for hir::def_id::DefIndex {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
hcx.local_def_path_hash(*self).hash_stable(hcx, hasher); hcx.local_def_path_hash(*self).hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>>
for hir::def_id::DefIndex { for hir::def_id::DefIndex {
type KeyType = DefPathHash; type KeyType = DefPathHash;
#[inline] #[inline]
fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a, 'gcx, 'tcx>) -> DefPathHash { fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash {
hcx.local_def_path_hash(*self) hcx.local_def_path_hash(*self)
} }
} }
@ -1129,10 +1129,10 @@ impl_stable_hash_for!(struct hir::def::Export {
span span
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ::middle::lang_items::LangItem { for ::middle::lang_items::LangItem {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
_: &mut StableHashingContext<'a, 'gcx, 'tcx>, _: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
::std::hash::Hash::hash(self, hasher); ::std::hash::Hash::hash(self, hasher);
} }
@ -1143,10 +1143,10 @@ impl_stable_hash_for!(struct ::middle::lang_items::LanguageItems {
missing missing
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for hir::TraitCandidate { for hir::TraitCandidate {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
let hir::TraitCandidate { let hir::TraitCandidate {

View file

@ -33,11 +33,11 @@ impl_stable_hash_for!(struct mir::LocalDecl<'tcx> {
impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, by_ref }); impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, by_ref });
impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator, is_cleanup }); impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator, is_cleanup });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for mir::Terminator<'gcx> { for mir::Terminator<'gcx> {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let mir::Terminator { let mir::Terminator {
ref kind, ref kind,
@ -76,61 +76,61 @@ for mir::Terminator<'gcx> {
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Local { impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Local {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::Idx;
self.index().hash_stable(hcx, hasher); self.index().hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::BasicBlock { impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::BasicBlock {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::Idx;
self.index().hash_stable(hcx, hasher); self.index().hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Field { impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Field {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::Idx;
self.index().hash_stable(hcx, hasher); self.index().hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for mir::VisibilityScope { for mir::VisibilityScope {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::Idx;
self.index().hash_stable(hcx, hasher); self.index().hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Promoted { impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Promoted {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::Idx;
self.index().hash_stable(hcx, hasher); self.index().hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for mir::TerminatorKind<'gcx> { for mir::TerminatorKind<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
@ -196,10 +196,10 @@ for mir::TerminatorKind<'gcx> {
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for mir::AssertMessage<'gcx> { for mir::AssertMessage<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
@ -219,10 +219,10 @@ for mir::AssertMessage<'gcx> {
impl_stable_hash_for!(struct mir::Statement<'tcx> { source_info, kind }); impl_stable_hash_for!(struct mir::Statement<'tcx> { source_info, kind });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for mir::StatementKind<'gcx> { for mir::StatementKind<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
@ -256,12 +256,12 @@ for mir::StatementKind<'gcx> {
} }
} }
impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx, T> HashStable<StableHashingContext<'gcx>>
for mir::ValidationOperand<'gcx, T> for mir::ValidationOperand<'gcx, T>
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> where T: HashStable<StableHashingContext<'gcx>>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) hasher: &mut StableHasher<W>)
{ {
self.lval.hash_stable(hcx, hasher); self.lval.hash_stable(hcx, hasher);
@ -273,9 +273,9 @@ impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
impl_stable_hash_for!(enum mir::ValidationOp { Acquire, Release, Suspend(region_scope) }); impl_stable_hash_for!(enum mir::ValidationOp { Acquire, Release, Suspend(region_scope) });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Lvalue<'gcx> { impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Lvalue<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -292,14 +292,14 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::L
} }
} }
impl<'a, 'gcx, 'tcx, B, V, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx, B, V, T> HashStable<StableHashingContext<'gcx>>
for mir::Projection<'gcx, B, V, T> for mir::Projection<'gcx, B, V, T>
where B: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>, where B: HashStable<StableHashingContext<'gcx>>,
V: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>, V: HashStable<StableHashingContext<'gcx>>,
T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> T: HashStable<StableHashingContext<'gcx>>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let mir::Projection { let mir::Projection {
ref base, ref base,
@ -311,13 +311,13 @@ for mir::Projection<'gcx, B, V, T>
} }
} }
impl<'a, 'gcx, 'tcx, V, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx, V, T> HashStable<StableHashingContext<'gcx>>
for mir::ProjectionElem<'gcx, V, T> for mir::ProjectionElem<'gcx, V, T>
where V: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>, where V: HashStable<StableHashingContext<'gcx>>,
T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> T: HashStable<StableHashingContext<'gcx>>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -348,9 +348,9 @@ for mir::ProjectionElem<'gcx, V, T>
impl_stable_hash_for!(struct mir::VisibilityScopeData { span, parent_scope }); impl_stable_hash_for!(struct mir::VisibilityScopeData { span, parent_scope });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Operand<'gcx> { impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Operand<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
@ -365,9 +365,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::O
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Rvalue<'gcx> { impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Rvalue<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
@ -425,10 +425,10 @@ impl_stable_hash_for!(enum mir::CastKind {
Unsize Unsize
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for mir::AggregateKind<'gcx> { for mir::AggregateKind<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -487,9 +487,9 @@ impl_stable_hash_for!(enum mir::NullOp {
impl_stable_hash_for!(struct mir::Constant<'tcx> { span, ty, literal }); impl_stable_hash_for!(struct mir::Constant<'tcx> { span, ty, literal });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Literal<'gcx> { impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Literal<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {

View file

@ -28,42 +28,42 @@ use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
StableHasher, StableHasherResult}; StableHasher, StableHasherResult};
use rustc_data_structures::accumulate_vec::AccumulateVec; use rustc_data_structures::accumulate_vec::AccumulateVec;
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for InternedString { impl<'gcx> HashStable<StableHashingContext<'gcx>> for InternedString {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let s: &str = &**self; let s: &str = &**self;
s.hash_stable(hcx, hasher); s.hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> for InternedString { impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for InternedString {
type KeyType = InternedString; type KeyType = InternedString;
#[inline] #[inline]
fn to_stable_hash_key(&self, fn to_stable_hash_key(&self,
_: &StableHashingContext<'a, 'gcx, 'tcx>) _: &StableHashingContext<'gcx>)
-> InternedString { -> InternedString {
self.clone() self.clone()
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ast::Name { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::Name {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
self.as_str().hash_stable(hcx, hasher); self.as_str().hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> for ast::Name { impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for ast::Name {
type KeyType = InternedString; type KeyType = InternedString;
#[inline] #[inline]
fn to_stable_hash_key(&self, fn to_stable_hash_key(&self,
_: &StableHashingContext<'a, 'gcx, 'tcx>) _: &StableHashingContext<'gcx>)
-> InternedString { -> InternedString {
self.as_str() self.as_str()
} }
@ -110,10 +110,10 @@ impl_stable_hash_for!(struct ::syntax::attr::Stability {
rustc_const_unstable rustc_const_unstable
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ::syntax::attr::StabilityLevel { for ::syntax::attr::StabilityLevel {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -165,9 +165,9 @@ impl_stable_hash_for!(struct ::syntax::ast::Lifetime { id, span, ident });
impl_stable_hash_for!(enum ::syntax::ast::StrStyle { Cooked, Raw(pounds) }); impl_stable_hash_for!(enum ::syntax::ast::StrStyle { Cooked, Raw(pounds) });
impl_stable_hash_for!(enum ::syntax::ast::AttrStyle { Outer, Inner }); impl_stable_hash_for!(enum ::syntax::ast::AttrStyle { Outer, Inner });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for [ast::Attribute] { impl<'gcx> HashStable<StableHashingContext<'gcx>> for [ast::Attribute] {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
if self.len() == 0 { if self.len() == 0 {
self.len().hash_stable(hcx, hasher); self.len().hash_stable(hcx, hasher);
@ -190,9 +190,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for [ast::
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ast::Attribute { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::Attribute {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
// Make sure that these have been filtered out. // Make sure that these have been filtered out.
debug_assert!(self.name().map(|name| !hcx.is_ignored_attr(name)).unwrap_or(true)); debug_assert!(self.name().map(|name| !hcx.is_ignored_attr(name)).unwrap_or(true));
@ -219,10 +219,10 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ast::A
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for tokenstream::TokenTree { for tokenstream::TokenTree {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -241,10 +241,10 @@ for tokenstream::TokenTree {
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for tokenstream::TokenStream { for tokenstream::TokenStream {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
for sub_tt in self.trees() { for sub_tt in self.trees() {
sub_tt.hash_stable(hcx, hasher); sub_tt.hash_stable(hcx, hasher);
@ -252,10 +252,10 @@ for tokenstream::TokenStream {
} }
} }
fn hash_token<'a, 'gcx, 'tcx, W: StableHasherResult>(token: &token::Token, fn hash_token<'gcx, W: StableHasherResult>(token: &token::Token,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>, hasher: &mut StableHasher<W>,
error_reporting_span: Span) { error_reporting_span: Span) {
mem::discriminant(token).hash_stable(hcx, hasher); mem::discriminant(token).hash_stable(hcx, hasher);
match *token { match *token {
token::Token::Eq | token::Token::Eq |
@ -358,9 +358,9 @@ impl_stable_hash_for!(enum ::syntax::ast::MetaItemKind {
NameValue(lit) NameValue(lit)
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for FileMap { impl<'gcx> HashStable<StableHashingContext<'gcx>> for FileMap {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let FileMap { let FileMap {
ref name, ref name,

View file

@ -20,30 +20,30 @@ use middle::region;
use traits; use traits;
use ty; use ty;
impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx, T> HashStable<StableHashingContext<'gcx>>
for &'gcx ty::Slice<T> for &'gcx ty::Slice<T>
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> { where T: HashStable<StableHashingContext<'gcx>> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
(&self[..]).hash_stable(hcx, hasher); (&self[..]).hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ty::subst::Kind<'gcx> { for ty::subst::Kind<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
self.as_type().hash_stable(hcx, hasher); self.as_type().hash_stable(hcx, hasher);
self.as_region().hash_stable(hcx, hasher); self.as_region().hash_stable(hcx, hasher);
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ty::RegionKind { for ty::RegionKind {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -81,10 +81,10 @@ for ty::RegionKind {
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ty::adjustment::AutoBorrow<'gcx> { for ty::adjustment::AutoBorrow<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -99,10 +99,10 @@ for ty::adjustment::AutoBorrow<'gcx> {
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ty::adjustment::Adjust<'gcx> { for ty::adjustment::Adjust<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -134,10 +134,10 @@ impl_stable_hash_for!(enum ty::BorrowKind {
MutBorrow MutBorrow
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ty::UpvarCapture<'gcx> { for ty::UpvarCapture<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -161,11 +161,11 @@ impl_stable_hash_for!(struct ty::FnSig<'tcx> {
abi abi
}); });
impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::Binder<T> impl<'gcx, T> HashStable<StableHashingContext<'gcx>> for ty::Binder<T>
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> where T: HashStable<StableHashingContext<'gcx>>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ty::Binder(ref inner) = *self; let ty::Binder(ref inner) = *self;
inner.hash_stable(hcx, hasher); inner.hash_stable(hcx, hasher);
@ -185,13 +185,13 @@ impl_stable_hash_for!(struct ty::TraitPredicate<'tcx> { trait_ref });
impl_stable_hash_for!(tuple_struct ty::EquatePredicate<'tcx> { t1, t2 }); impl_stable_hash_for!(tuple_struct ty::EquatePredicate<'tcx> { t1, t2 });
impl_stable_hash_for!(struct ty::SubtypePredicate<'tcx> { a_is_expected, a, b }); impl_stable_hash_for!(struct ty::SubtypePredicate<'tcx> { a_is_expected, a, b });
impl<'a, 'gcx, 'tcx, A, B> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx, A, B> HashStable<StableHashingContext<'gcx>>
for ty::OutlivesPredicate<A, B> for ty::OutlivesPredicate<A, B>
where A: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>, where A: HashStable<StableHashingContext<'gcx>>,
B: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>, B: HashStable<StableHashingContext<'gcx>>,
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ty::OutlivesPredicate(ref a, ref b) = *self; let ty::OutlivesPredicate(ref a, ref b) = *self;
a.hash_stable(hcx, hasher); a.hash_stable(hcx, hasher);
@ -203,9 +203,9 @@ impl_stable_hash_for!(struct ty::ProjectionPredicate<'tcx> { projection_ty, ty }
impl_stable_hash_for!(struct ty::ProjectionTy<'tcx> { substs, item_def_id }); impl_stable_hash_for!(struct ty::ProjectionTy<'tcx> { substs, item_def_id });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::Predicate<'gcx> { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::Predicate<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -245,9 +245,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::Pr
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::AdtFlags { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::AdtFlags {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
_: &mut StableHashingContext<'a, 'gcx, 'tcx>, _: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
std_hash::Hash::hash(self, hasher); std_hash::Hash::hash(self, hasher);
} }
@ -272,10 +272,10 @@ impl_stable_hash_for!(struct ty::FieldDef {
vis vis
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ::middle::const_val::ConstVal<'gcx> { for ::middle::const_val::ConstVal<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use middle::const_val::ConstVal::*; use middle::const_val::ConstVal::*;
use middle::const_val::ConstAggregate::*; use middle::const_val::ConstAggregate::*;
@ -347,10 +347,10 @@ impl_stable_hash_for!(struct ::middle::const_val::ConstEvalErr<'tcx> {
kind kind
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ::middle::const_val::ErrKind<'gcx> { for ::middle::const_val::ErrKind<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use middle::const_val::ErrKind::*; use middle::const_val::ErrKind::*;
@ -410,9 +410,9 @@ impl_stable_hash_for!(enum ty::adjustment::CustomCoerceUnsized {
Struct(index) Struct(index)
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::Generics { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::Generics {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ty::Generics { let ty::Generics {
parent, parent,
@ -438,10 +438,10 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::Ge
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ty::RegionParameterDef { for ty::RegionParameterDef {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ty::RegionParameterDef { let ty::RegionParameterDef {
name, name,
@ -466,12 +466,12 @@ impl_stable_hash_for!(struct ty::TypeParameterDef {
pure_wrt_drop pure_wrt_drop
}); });
impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx, T> HashStable<StableHashingContext<'gcx>>
for ::middle::resolve_lifetime::Set1<T> for ::middle::resolve_lifetime::Set1<T>
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> where T: HashStable<StableHashingContext<'gcx>>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use middle::resolve_lifetime::Set1; use middle::resolve_lifetime::Set1;
@ -522,11 +522,11 @@ impl_stable_hash_for!(enum ::middle::region::Scope {
Remainder(block_remainder) Remainder(block_remainder)
}); });
impl<'a, 'gcx, 'tcx> ToStableHashKey<StableHashingContext<'a, 'gcx, 'tcx>> for region::Scope { impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for region::Scope {
type KeyType = region::Scope; type KeyType = region::Scope;
#[inline] #[inline]
fn to_stable_hash_key(&self, _: &StableHashingContext<'a, 'gcx, 'tcx>) -> region::Scope { fn to_stable_hash_key(&self, _: &StableHashingContext<'gcx>) -> region::Scope {
*self *self
} }
} }
@ -552,11 +552,11 @@ impl_stable_hash_for!(enum ty::BoundRegion {
BrEnv BrEnv
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ty::TypeVariants<'gcx> for ty::TypeVariants<'gcx>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use ty::TypeVariants::*; use ty::TypeVariants::*;
@ -648,11 +648,11 @@ impl_stable_hash_for!(struct ty::TypeAndMut<'tcx> {
mutbl mutbl
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ty::ExistentialPredicate<'gcx> for ty::ExistentialPredicate<'gcx>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -685,9 +685,9 @@ impl_stable_hash_for!(struct ty::Instance<'tcx> {
substs substs
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::InstanceDef<'gcx> { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::InstanceDef<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
@ -721,9 +721,9 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::In
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::TraitDef { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::TraitDef {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ty::TraitDef { let ty::TraitDef {
// We already have the def_path_hash below, no need to hash it twice // We already have the def_path_hash below, no need to hash it twice
@ -751,9 +751,9 @@ impl_stable_hash_for!(struct ty::DtorckConstraint<'tcx> {
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::CrateVariancesMap { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::CrateVariancesMap {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ty::CrateVariancesMap { let ty::CrateVariancesMap {
ref dependencies, ref dependencies,
@ -789,12 +789,12 @@ impl_stable_hash_for!(enum ty::AssociatedItemContainer {
}); });
impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx, T> HashStable<StableHashingContext<'gcx>>
for ty::steal::Steal<T> for ty::steal::Steal<T>
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> where T: HashStable<StableHashingContext<'gcx>>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
self.borrow().hash_stable(hcx, hasher); self.borrow().hash_stable(hcx, hasher);
} }
@ -816,10 +816,10 @@ impl_stable_hash_for!(enum ::middle::privacy::AccessLevel {
Public Public
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> impl<'gcx> HashStable<StableHashingContext<'gcx>>
for ::middle::privacy::AccessLevels { for ::middle::privacy::AccessLevels {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
let ::middle::privacy::AccessLevels { let ::middle::privacy::AccessLevels {

View file

@ -386,10 +386,10 @@ impl LintLevelMap {
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for LintLevelMap { impl<'gcx> HashStable<StableHashingContext<'gcx>> for LintLevelMap {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let LintLevelMap { let LintLevelMap {
ref sets, ref sets,

View file

@ -73,10 +73,10 @@ macro_rules! __impl_stable_hash_field {
#[macro_export] #[macro_export]
macro_rules! impl_stable_hash_for { macro_rules! impl_stable_hash_for {
(enum $enum_name:path { $( $variant:ident $( ( $($arg:ident),* ) )* ),* }) => { (enum $enum_name:path { $( $variant:ident $( ( $($arg:ident),* ) )* ),* }) => {
impl<'a, 'tcx, 'lcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a, 'tcx, 'lcx>> for $enum_name { impl<'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'tcx>> for $enum_name {
#[inline] #[inline]
fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self, fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self,
__ctx: &mut $crate::ich::StableHashingContext<'a, 'tcx, 'lcx>, __ctx: &mut $crate::ich::StableHashingContext<'tcx>,
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) { __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) {
use $enum_name::*; use $enum_name::*;
::std::mem::discriminant(self).hash_stable(__ctx, __hasher); ::std::mem::discriminant(self).hash_stable(__ctx, __hasher);
@ -92,10 +92,10 @@ macro_rules! impl_stable_hash_for {
} }
}; };
(struct $struct_name:path { $($field:ident),* }) => { (struct $struct_name:path { $($field:ident),* }) => {
impl<'a, 'tcx, 'lcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a, 'tcx, 'lcx>> for $struct_name { impl<'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'tcx>> for $struct_name {
#[inline] #[inline]
fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self, fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self,
__ctx: &mut $crate::ich::StableHashingContext<'a, 'tcx, 'lcx>, __ctx: &mut $crate::ich::StableHashingContext<'tcx>,
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) { __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) {
let $struct_name { let $struct_name {
$(ref $field),* $(ref $field),*
@ -106,10 +106,10 @@ macro_rules! impl_stable_hash_for {
} }
}; };
(tuple_struct $struct_name:path { $($field:ident),* }) => { (tuple_struct $struct_name:path { $($field:ident),* }) => {
impl<'a, 'tcx, 'lcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a, 'tcx, 'lcx>> for $struct_name { impl<'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'tcx>> for $struct_name {
#[inline] #[inline]
fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self, fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self,
__ctx: &mut $crate::ich::StableHashingContext<'a, 'tcx, 'lcx>, __ctx: &mut $crate::ich::StableHashingContext<'tcx>,
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) { __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) {
let $struct_name ( let $struct_name (
$(ref $field),* $(ref $field),*
@ -125,11 +125,11 @@ macro_rules! impl_stable_hash_for {
macro_rules! impl_stable_hash_for_spanned { macro_rules! impl_stable_hash_for_spanned {
($T:path) => ( ($T:path) => (
impl<'a, 'tcx, 'lcx> HashStable<StableHashingContext<'a, 'tcx, 'lcx>> for ::syntax::codemap::Spanned<$T> impl<'tcx> HashStable<StableHashingContext<'tcx>> for ::syntax::codemap::Spanned<$T>
{ {
#[inline] #[inline]
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'tcx, 'lcx>, hcx: &mut StableHashingContext<'tcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
self.node.hash_stable(hcx, hasher); self.node.hash_stable(hcx, hasher);
self.span.hash_stable(hcx, hasher); self.span.hash_stable(hcx, hasher);

View file

@ -1239,9 +1239,9 @@ pub fn provide(providers: &mut Providers) {
}; };
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ScopeTree { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ScopeTree {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ScopeTree { let ScopeTree {
root_body, root_body,

View file

@ -35,9 +35,9 @@ impl serialize::Decodable for Cache {
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for Cache { impl<'gcx> HashStable<StableHashingContext<'gcx>> for Cache {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
_: &mut StableHashingContext<'a, 'gcx, 'tcx>, _: &mut StableHashingContext<'gcx>,
_: &mut StableHasher<W>) { _: &mut StableHasher<W>) {
// do nothing // do nothing
} }

View file

@ -369,9 +369,9 @@ pub fn ancestors(tcx: TyCtxt,
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for Children { impl<'gcx> HashStable<StableHashingContext<'gcx>> for Children {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let Children { let Children {
ref nonblanket_impls, ref nonblanket_impls,

View file

@ -687,9 +687,9 @@ impl<'tcx> TypeckTables<'tcx> {
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for TypeckTables<'gcx> { impl<'gcx> HashStable<StableHashingContext<'gcx>> for TypeckTables<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ty::TypeckTables { let ty::TypeckTables {
local_id_root, local_id_root,
@ -1225,6 +1225,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn crate_data_as_rc_any(self, cnum: CrateNum) -> Rc<Any> { pub fn crate_data_as_rc_any(self, cnum: CrateNum) -> Rc<Any> {
self.cstore.crate_data_as_rc_any(cnum) self.cstore.crate_data_as_rc_any(cnum)
} }
pub fn create_stable_hashing_context(self) -> StableHashingContext<'gcx> {
let krate = self.dep_graph.with_ignore(|| self.gcx.hir.krate());
StableHashingContext::new(self.sess,
krate,
self.hir.definitions(),
self.cstore)
}
} }
impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {

View file

@ -144,12 +144,12 @@ impl<D: Copy + Debug + Ord + Eq + Hash> SimplifiedTypeGen<D> {
} }
} }
impl<'a, 'gcx, 'tcx, D> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for SimplifiedTypeGen<D> impl<'gcx, D> HashStable<StableHashingContext<'gcx>> for SimplifiedTypeGen<D>
where D: Copy + Debug + Ord + Eq + Hash + where D: Copy + Debug + Ord + Eq + Hash +
HashStable<StableHashingContext<'a, 'gcx, 'tcx>>, HashStable<StableHashingContext<'gcx>>,
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {

View file

@ -2306,10 +2306,10 @@ impl<'a, 'tcx> TyLayout<'tcx> {
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for Layout impl<'gcx> HashStable<StableHashingContext<'gcx>> for Layout
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use ty::layout::Layout::*; use ty::layout::Layout::*;
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
@ -2399,10 +2399,10 @@ impl_stable_hash_for!(struct ::ty::layout::Size {
raw raw
}); });
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for LayoutError<'gcx> impl<'gcx> HashStable<StableHashingContext<'gcx>> for LayoutError<'gcx>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use ty::layout::LayoutError::*; use ty::layout::LayoutError::*;
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);

View file

@ -500,9 +500,9 @@ impl<'tcx> TyS<'tcx> {
} }
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::TyS<'gcx> { impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::TyS<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ty::TyS { let ty::TyS {
ref sty, ref sty,
@ -1334,9 +1334,9 @@ impl<'tcx> serialize::UseSpecializedEncodable for &'tcx AdtDef {
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx AdtDef {} impl<'tcx> serialize::UseSpecializedDecodable for &'tcx AdtDef {}
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for AdtDef { impl<'gcx> HashStable<StableHashingContext<'gcx>> for AdtDef {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let ty::AdtDef { let ty::AdtDef {
did, did,

View file

@ -186,9 +186,9 @@ pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}) })
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for TraitImpls { impl<'gcx> HashStable<StableHashingContext<'gcx>> for TraitImpls {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let TraitImpls { let TraitImpls {
ref blanket_impls, ref blanket_impls,

View file

@ -12,7 +12,7 @@
use hir::def_id::{DefId, LOCAL_CRATE}; use hir::def_id::{DefId, LOCAL_CRATE};
use hir::map::DefPathData; use hir::map::DefPathData;
use ich::{StableHashingContext, NodeIdHashingMode}; use ich::NodeIdHashingMode;
use middle::const_val::ConstVal; use middle::const_val::ConstVal;
use traits::{self, Reveal}; use traits::{self, Reveal};
use ty::{self, Ty, TyCtxt, TypeFoldable}; use ty::{self, Ty, TyCtxt, TypeFoldable};
@ -214,7 +214,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
/// context it's calculated within. This is used by the `type_id` intrinsic. /// context it's calculated within. This is used by the `type_id` intrinsic.
pub fn type_id_hash(self, ty: Ty<'tcx>) -> u64 { pub fn type_id_hash(self, ty: Ty<'tcx>) -> u64 {
let mut hasher = StableHasher::new(); let mut hasher = StableHasher::new();
let mut hcx = StableHashingContext::new(self); let mut hcx = self.create_stable_hashing_context();
// We want the type_id be independent of the types free regions, so we // We want the type_id be independent of the types free regions, so we
// erase them. The erase_regions() call will also anonymize bound // erase them. The erase_regions() call will also anonymize bound

View file

@ -175,7 +175,7 @@ pub fn compile_input(sess: &Session,
// Construct the HIR map // Construct the HIR map
let hir_map = time(sess.time_passes(), let hir_map = time(sess.time_passes(),
"indexing hir", "indexing hir",
|| hir_map::map_crate(&mut hir_forest, defs)); || hir_map::map_crate(&mut hir_forest, &defs));
{ {
let _ignore = hir_map.dep_graph.in_ignore(); let _ignore = hir_map.dep_graph.in_ignore();

View file

@ -133,7 +133,7 @@ fn test_env<F>(source_string: &str,
let arena = DroplessArena::new(); let arena = DroplessArena::new();
let arenas = ty::GlobalArenas::new(); let arenas = ty::GlobalArenas::new();
let hir_map = hir_map::map_crate(&mut hir_forest, defs); let hir_map = hir_map::map_crate(&mut hir_forest, &defs);
// run just enough stuff to build a tcx: // run just enough stuff to build a tcx:
let named_region_map = resolve_lifetime::krate(&sess, &*cstore, &hir_map); let named_region_map = resolve_lifetime::krate(&sess, &*cstore, &hir_map);

View file

@ -91,7 +91,7 @@ impl<'a> ::std::ops::Index<&'a DepNode> for IncrementalHashesMap {
struct ComputeItemHashesVisitor<'a, 'tcx: 'a> { struct ComputeItemHashesVisitor<'a, 'tcx: 'a> {
tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>,
hcx: StableHashingContext<'a, 'tcx, 'tcx>, hcx: StableHashingContext<'tcx>,
hashes: IncrementalHashesMap, hashes: IncrementalHashesMap,
} }
@ -100,7 +100,7 @@ impl<'a, 'tcx: 'a> ComputeItemHashesVisitor<'a, 'tcx> {
def_index: DefIndex, def_index: DefIndex,
hash_bodies: bool, hash_bodies: bool,
item_like: T) item_like: T)
where T: HashStable<StableHashingContext<'a, 'tcx, 'tcx>> where T: HashStable<StableHashingContext<'tcx>>
{ {
if !hash_bodies && !self.tcx.sess.opts.build_dep_graph() { if !hash_bodies && !self.tcx.sess.opts.build_dep_graph() {
// If we just need the hashes in order to compute the SVH, we don't // If we just need the hashes in order to compute the SVH, we don't
@ -303,7 +303,7 @@ pub fn compute_incremental_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
let mut visitor = ComputeItemHashesVisitor { let mut visitor = ComputeItemHashesVisitor {
tcx, tcx,
hcx: StableHashingContext::new(tcx), hcx: tcx.create_stable_hashing_context(),
hashes: IncrementalHashesMap::new(), hashes: IncrementalHashesMap::new(),
}; };

View file

@ -16,7 +16,7 @@ use schema::*;
use rustc::hir; use rustc::hir;
use rustc::ty::{self, TyCtxt}; use rustc::ty::{self, TyCtxt};
use rustc::ich::{StableHashingContext, Fingerprint}; use rustc::ich::Fingerprint;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
#[derive(RustcEncodable, RustcDecodable)] #[derive(RustcEncodable, RustcDecodable)]
@ -43,7 +43,7 @@ impl<'a, 'b, 'tcx> IsolatedEncoder<'a, 'b, 'tcx> {
// In order to avoid having to hash hir::Bodies from extern crates, we // In order to avoid having to hash hir::Bodies from extern crates, we
// hash them here, during export, and store the hash with metadata. // hash them here, during export, and store the hash with metadata.
let stable_bodies_hash = { let stable_bodies_hash = {
let mut hcx = StableHashingContext::new(self.tcx); let mut hcx = self.tcx.create_stable_hashing_context();
let mut hasher = StableHasher::new(); let mut hasher = StableHasher::new();
hcx.while_hashing_hir_bodies(true, |hcx| { hcx.while_hashing_hir_bodies(true, |hcx| {

View file

@ -23,7 +23,7 @@ use rustc_serialize::Encodable;
pub struct IsolatedEncoder<'a, 'b: 'a, 'tcx: 'b> { pub struct IsolatedEncoder<'a, 'b: 'a, 'tcx: 'b> {
pub tcx: TyCtxt<'b, 'tcx, 'tcx>, pub tcx: TyCtxt<'b, 'tcx, 'tcx>,
ecx: &'a mut EncodeContext<'b, 'tcx>, ecx: &'a mut EncodeContext<'b, 'tcx>,
hcx: Option<(StableHashingContext<'b, 'tcx, 'tcx>, StableHasher<Fingerprint>)>, hcx: Option<(StableHashingContext<'tcx>, StableHasher<Fingerprint>)>,
} }
impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
@ -40,9 +40,9 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
// Except when -Zquery-dep-graph is specified because we don't // Except when -Zquery-dep-graph is specified because we don't
// want to mess up our tests. // want to mess up our tests.
let hcx = if tcx.sess.opts.debugging_opts.query_dep_graph { let hcx = if tcx.sess.opts.debugging_opts.query_dep_graph {
StableHashingContext::new(tcx) tcx.create_stable_hashing_context()
} else { } else {
StableHashingContext::new(tcx).force_span_hashing() tcx.create_stable_hashing_context().force_span_hashing()
}; };
Some((hcx, StableHasher::new())) Some((hcx, StableHasher::new()))
@ -61,7 +61,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
} }
pub fn lazy<T>(&mut self, value: &T) -> Lazy<T> pub fn lazy<T>(&mut self, value: &T) -> Lazy<T>
where T: Encodable + HashStable<StableHashingContext<'b, 'tcx, 'tcx>> where T: Encodable + HashStable<StableHashingContext<'tcx>>
{ {
if let Some((ref mut hcx, ref mut hasher)) = self.hcx { if let Some((ref mut hcx, ref mut hasher)) = self.hcx {
value.hash_stable(hcx, hasher); value.hash_stable(hcx, hasher);
@ -72,7 +72,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
pub fn lazy_seq<I, T>(&mut self, iter: I) -> LazySeq<T> pub fn lazy_seq<I, T>(&mut self, iter: I) -> LazySeq<T>
where I: IntoIterator<Item = T>, where I: IntoIterator<Item = T>,
T: Encodable + HashStable<StableHashingContext<'b, 'tcx, 'tcx>> T: Encodable + HashStable<StableHashingContext<'tcx>>
{ {
if let Some((ref mut hcx, ref mut hasher)) = self.hcx { if let Some((ref mut hcx, ref mut hasher)) = self.hcx {
let iter = iter.into_iter(); let iter = iter.into_iter();
@ -111,7 +111,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
pub fn lazy_seq_ref<'x, I, T>(&mut self, iter: I) -> LazySeq<T> pub fn lazy_seq_ref<'x, I, T>(&mut self, iter: I) -> LazySeq<T>
where I: IntoIterator<Item = &'x T>, where I: IntoIterator<Item = &'x T>,
T: 'x + Encodable + HashStable<StableHashingContext<'b, 'tcx, 'tcx>> T: 'x + Encodable + HashStable<StableHashingContext<'tcx>>
{ {
if let Some((ref mut hcx, ref mut hasher)) = self.hcx { if let Some((ref mut hcx, ref mut hasher)) = self.hcx {
let iter = iter.into_iter(); let iter = iter.into_iter();
@ -149,7 +149,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
} }
pub fn lazy_seq_from_slice<T>(&mut self, slice: &[T]) -> LazySeq<T> pub fn lazy_seq_from_slice<T>(&mut self, slice: &[T]) -> LazySeq<T>
where T: Encodable + HashStable<StableHashingContext<'b, 'tcx, 'tcx>> where T: Encodable + HashStable<StableHashingContext<'tcx>>
{ {
if let Some((ref mut hcx, ref mut hasher)) = self.hcx { if let Some((ref mut hcx, ref mut hasher)) = self.hcx {
slice.hash_stable(hcx, hasher); slice.hash_stable(hcx, hasher);
@ -159,7 +159,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
} }
pub fn lazy_seq_ref_from_slice<T>(&mut self, slice: &[&T]) -> LazySeq<T> pub fn lazy_seq_ref_from_slice<T>(&mut self, slice: &[&T]) -> LazySeq<T>
where T: Encodable + HashStable<StableHashingContext<'b, 'tcx, 'tcx>> where T: Encodable + HashStable<StableHashingContext<'tcx>>
{ {
if let Some((ref mut hcx, ref mut hasher)) = self.hcx { if let Some((ref mut hcx, ref mut hasher)) = self.hcx {
slice.hash_stable(hcx, hasher); slice.hash_stable(hcx, hasher);

View file

@ -229,9 +229,9 @@ pub struct TraitImpls {
pub impls: LazySeq<DefIndex>, pub impls: LazySeq<DefIndex>,
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for TraitImpls { impl<'gcx> HashStable<StableHashingContext<'gcx>> for TraitImpls {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
let TraitImpls { let TraitImpls {
trait_id: (krate, def_index), trait_id: (krate, def_index),
@ -312,9 +312,9 @@ pub enum EntryKind<'tcx> {
AssociatedConst(AssociatedContainer, u8), AssociatedConst(AssociatedContainer, u8),
} }
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for EntryKind<'tcx> { impl<'gcx> HashStable<StableHashingContext<'gcx>> for EntryKind<'gcx> {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {

View file

@ -141,10 +141,10 @@ impl<'a, 'tcx> DepGraphSafe for SharedCrateContext<'a, 'tcx> {
} }
impl<'a, 'tcx> StableHashingContextProvider for SharedCrateContext<'a, 'tcx> { impl<'a, 'tcx> StableHashingContextProvider for SharedCrateContext<'a, 'tcx> {
type ContextType = StableHashingContext<'a, 'tcx, 'tcx>; type ContextType = StableHashingContext<'tcx>;
fn create_stable_hashing_context(&self) -> Self::ContextType { fn create_stable_hashing_context(&self) -> Self::ContextType {
StableHashingContext::new(self.tcx) self.tcx.create_stable_hashing_context()
} }
} }

View file

@ -141,10 +141,10 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> {
} }
impl<'a, 'tcx> StableHashingContextProvider for ConstraintContext<'a, 'tcx> { impl<'a, 'tcx> StableHashingContextProvider for ConstraintContext<'a, 'tcx> {
type ContextType = StableHashingContext<'a, 'tcx, 'tcx>; type ContextType = StableHashingContext<'tcx>;
fn create_stable_hashing_context(&self) -> Self::ContextType { fn create_stable_hashing_context(&self) -> Self::ContextType {
StableHashingContext::new(self.terms_cx.tcx) self.terms_cx.tcx.create_stable_hashing_context()
} }
} }

View file

@ -175,7 +175,7 @@ pub fn run_core(search_paths: SearchPaths,
let arena = DroplessArena::new(); let arena = DroplessArena::new();
let arenas = GlobalArenas::new(); let arenas = GlobalArenas::new();
let hir_map = hir_map::map_crate(&mut hir_forest, defs); let hir_map = hir_map::map_crate(&mut hir_forest, &defs);
let output_filenames = driver::build_output_filenames(&input, let output_filenames = driver::build_output_filenames(&input,
&None, &None,
&None, &None,

View file

@ -124,7 +124,7 @@ pub fn run(input: &str,
render_type); render_type);
{ {
let map = hir::map::map_crate(&mut hir_forest, defs); let map = hir::map::map_crate(&mut hir_forest, &defs);
let krate = map.krate(); let krate = map.krate();
let mut hir_collector = HirCollector { let mut hir_collector = HirCollector {
sess: &sess, sess: &sess,