diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 1dcc9272d4e..7c21bba49f8 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -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 - where T: HashStable> + fmt::Debug + where T: HashStable> + fmt::Debug { default const CAN_RECONSTRUCT_QUERY_KEY: bool = false; 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(); self.hash_stable(&mut hcx, &mut hasher); diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index d043d8346e6..b2d6886e7f2 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -247,7 +247,7 @@ pub struct Map<'hir> { /// plain old integers. map: Vec>, - definitions: Definitions, + definitions: &'hir Definitions, /// Bodies inlined from other crates are cached here. inlined_bodies: RefCell>, @@ -304,8 +304,8 @@ impl<'hir> Map<'hir> { } #[inline] - pub fn definitions(&self) -> &Definitions { - &self.definitions + pub fn definitions(&self) -> &'hir Definitions { + self.definitions } 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 } } pub fn map_crate<'hir>(forest: &'hir mut Forest, - definitions: Definitions) + definitions: &'hir Definitions) -> Map<'hir> { let map = { let mut collector = NodeCollector::root(&forest.krate, diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 136190f7573..0a2566f0692 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -11,7 +11,9 @@ use hir; use hir::def_id::{DefId, DefIndex}; use hir::map::DefPathHash; +use hir::map::definitions::Definitions; use ich::{self, CachingCodemapView}; +use middle::cstore::CrateStore; use session::config::DebugInfoLevel::NoDebugInfo; use ty::{self, TyCtxt, fast_reject}; use session::Session; @@ -41,8 +43,10 @@ thread_local!(static IGNORED_ATTR_NAMES: RefCell> = /// 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 /// things (e.g. each DefId/DefPath is only hashed once). -pub struct StableHashingContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub struct StableHashingContext<'gcx> { + sess: &'gcx Session, + definitions: &'gcx Definitions, + cstore: &'gcx CrateStore, body_resolver: BodyResolver<'gcx>, hash_spans: 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 /// to avoid that the crate is used to get untracked access to all of the HIR. #[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. // 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) } } -impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> { - - pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { - let hash_spans_initial = tcx.sess.opts.debuginfo != NoDebugInfo; - let check_overflow_initial = tcx.sess.overflow_checks(); +impl<'gcx> StableHashingContext<'gcx> { + // The `krate` here is only used for mapping BodyIds to Bodies. + // Don't use it for anything else or you'll run the risk of + // leaking data out of the tracking system. + 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); 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 { - tcx, - body_resolver, + sess, + body_resolver: BodyResolver(krate), + definitions, + cstore, caching_codemap: None, - raw_codemap: tcx.sess.codemap(), + raw_codemap: sess.codemap(), hash_spans: hash_spans_initial, hash_bodies: true, overflow_checks_enabled: check_overflow_initial, @@ -106,7 +116,7 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> { #[inline] pub fn sess(&self) -> &'gcx Session { - self.tcx.sess + self.sess } pub fn force_span_hashing(mut self) -> Self { @@ -146,12 +156,16 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> { #[inline] 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] 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] @@ -239,15 +253,15 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> { } 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 { - StableHashingContext::new(*self) + (*self).create_stable_hashing_context() } } -impl<'a, 'gcx, 'tcx> HashStable> for hir::BodyId { +impl<'gcx> HashStable> for hir::BodyId { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { if hcx.hash_bodies() { hcx.body_resolver.body(*self).hash_stable(hcx, hasher); @@ -255,10 +269,10 @@ impl<'a, 'gcx, 'tcx> HashStable> for hir::B } } -impl<'a, 'gcx, 'tcx> HashStable> for hir::HirId { +impl<'gcx> HashStable> for hir::HirId { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { match hcx.node_id_hashing_mode { NodeIdHashingMode::Ignore => { @@ -270,52 +284,52 @@ impl<'a, 'gcx, 'tcx> HashStable> for hir::H local_id, } = *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); } } } } -impl<'a, 'gcx, 'tcx> ToStableHashKey> for hir::HirId { +impl<'gcx> ToStableHashKey> for hir::HirId { type KeyType = (DefPathHash, hir::ItemLocalId); #[inline] fn to_stable_hash_key(&self, - hcx: &StableHashingContext<'a, 'gcx, 'tcx>) + hcx: &StableHashingContext<'gcx>) -> (DefPathHash, hir::ItemLocalId) { let def_path_hash = hcx.local_def_path_hash(self.owner); (def_path_hash, self.local_id) } } -impl<'a, 'gcx, 'tcx> HashStable> for ast::NodeId { +impl<'gcx> HashStable> for ast::NodeId { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { match hcx.node_id_hashing_mode { NodeIdHashingMode::Ignore => { // Don't do anything. } 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> for ast::NodeId { +impl<'gcx> ToStableHashKey> for ast::NodeId { type KeyType = (DefPathHash, hir::ItemLocalId); #[inline] fn to_stable_hash_key(&self, - hcx: &StableHashingContext<'a, 'gcx, 'tcx>) + hcx: &StableHashingContext<'gcx>) -> (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> for Span { +impl<'gcx> HashStable> for Span { // 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 @@ -327,7 +341,7 @@ impl<'a, 'gcx, 'tcx> HashStable> for Span { // 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. fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use syntax_pos::Pos; @@ -390,8 +404,8 @@ impl<'a, 'gcx, 'tcx> HashStable> for Span { } } -pub fn hash_stable_trait_impls<'a, 'tcx, 'gcx, W, R>( - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, +pub fn hash_stable_trait_impls<'gcx, W, R>( + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher, blanket_impls: &Vec, non_blanket_impls: &HashMap, R>) diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index aa4826528ec..9582b03ce1c 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -20,28 +20,28 @@ use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, use std::mem; use syntax::ast; -impl<'a, 'gcx, 'tcx> HashStable> for DefId { +impl<'gcx> HashStable> for DefId { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { hcx.def_path_hash(*self).hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> ToStableHashKey> for DefId { +impl<'gcx> ToStableHashKey> for DefId { type KeyType = DefPathHash; #[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) } } -impl<'a, 'gcx, 'tcx> HashStable> for CrateNum { +impl<'gcx> HashStable> for CrateNum { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { hcx.def_path_hash(DefId { krate: *self, @@ -50,11 +50,11 @@ impl<'a, 'gcx, 'tcx> HashStable> for CrateN } } -impl<'a, 'gcx, 'tcx> ToStableHashKey> for CrateNum { +impl<'gcx> ToStableHashKey> for CrateNum { type KeyType = DefPathHash; #[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 }; def_id.to_stable_hash_key(hcx) } @@ -62,13 +62,13 @@ impl<'a, 'gcx, 'tcx> ToStableHashKey> for C impl_stable_hash_for!(tuple_struct hir::ItemLocalId { index }); -impl<'a, 'gcx, 'lcx> ToStableHashKey> +impl<'gcx> ToStableHashKey> for hir::ItemLocalId { type KeyType = hir::ItemLocalId; #[inline] fn to_stable_hash_key(&self, - _: &StableHashingContext<'a, 'gcx, 'lcx>) + _: &StableHashingContext<'gcx>) -> hir::ItemLocalId { *self } @@ -81,9 +81,9 @@ for hir::ItemLocalId { // want to pick up on a reference changing its target, so we hash the NodeIds // in "DefPath Mode". -impl<'a, 'gcx, 'tcx> HashStable> for hir::ItemId { +impl<'gcx> HashStable> for hir::ItemId { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::ItemId { id @@ -95,9 +95,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for hir::I } } -impl<'a, 'gcx, 'tcx> HashStable> for hir::TraitItemId { +impl<'gcx> HashStable> for hir::TraitItemId { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::TraitItemId { node_id @@ -109,9 +109,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for hir::T } } -impl<'a, 'gcx, 'tcx> HashStable> for hir::ImplItemId { +impl<'gcx> HashStable> for hir::ImplItemId { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::ImplItemId { node_id @@ -231,9 +231,9 @@ impl_stable_hash_for!(struct hir::TypeBinding { span }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::Ty { +impl<'gcx> HashStable> for hir::Ty { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { hcx.while_hashing_hir_bodies(true, |hcx| { let hir::Ty { @@ -292,9 +292,9 @@ impl_stable_hash_for!(enum hir::FunctionRetTy { Return(t) }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::TraitRef { +impl<'gcx> HashStable> for hir::TraitRef { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::TraitRef { ref path, @@ -329,9 +329,9 @@ impl_stable_hash_for!(struct hir::MacroDef { }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::Block { +impl<'gcx> HashStable> for hir::Block { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::Block { ref stmts, @@ -377,9 +377,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for hir::B } } -impl<'a, 'gcx, 'tcx> HashStable> for hir::Pat { +impl<'gcx> HashStable> for hir::Pat { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::Pat { id: _, @@ -504,9 +504,9 @@ impl_stable_hash_for!(enum hir::UnsafeSource { UserProvided }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::Expr { +impl<'gcx> HashStable> for hir::Expr { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { hcx.while_hashing_hir_bodies(true, |hcx| { let hir::Expr { @@ -622,9 +622,9 @@ impl_stable_hash_for!(enum hir::LoopSource { ForLoop }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::MatchSource { +impl<'gcx> HashStable> for hir::MatchSource { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use hir::MatchSource; @@ -673,9 +673,9 @@ impl_stable_hash_for!(enum hir::ScopeTarget { Loop(loop_id_result) }); -impl<'a, 'gcx, 'tcx> HashStable> for ast::Ident { +impl<'gcx> HashStable> for ast::Ident { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ast::Ident { ref name, @@ -686,9 +686,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for ast::I } } -impl<'a, 'gcx, 'tcx> HashStable> for hir::TraitItem { +impl<'gcx> HashStable> for hir::TraitItem { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::TraitItem { id, @@ -720,9 +720,9 @@ impl_stable_hash_for!(enum hir::TraitItemKind { Type(bounds, rhs) }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::ImplItem { +impl<'gcx> HashStable> for hir::ImplItem { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::ImplItem { id, @@ -753,9 +753,9 @@ impl_stable_hash_for!(enum hir::ImplItemKind { Type(t) }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::Visibility { +impl<'gcx> HashStable> for hir::Visibility { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -774,9 +774,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for hir::V } } -impl<'a, 'gcx, 'tcx> HashStable> for hir::Defaultness { +impl<'gcx> HashStable> for hir::Defaultness { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -795,9 +795,9 @@ impl_stable_hash_for!(enum hir::ImplPolarity { Negative }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::Mod { +impl<'gcx> HashStable> for hir::Mod { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::Mod { inner, @@ -850,9 +850,9 @@ impl_stable_hash_for!(enum hir::VariantData { Unit(id) }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::Item { +impl<'gcx> HashStable> for hir::Item { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hash_spans = match self.node { hir::ItemStatic(..) | @@ -933,10 +933,10 @@ impl_stable_hash_for!(struct hir::ImplItemRef { defaultness }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for hir::AssociatedItemKind { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -977,9 +977,9 @@ impl_stable_hash_for!(struct hir::Arg { hir_id }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::Body { +impl<'gcx> HashStable> for hir::Body { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::Body { ref arguments, @@ -995,12 +995,12 @@ impl<'a, 'gcx, 'tcx> HashStable> for hir::B } } -impl<'a, 'gcx, 'tcx> ToStableHashKey> for hir::BodyId { +impl<'gcx> ToStableHashKey> for hir::BodyId { type KeyType = (DefPathHash, hir::ItemLocalId); #[inline] fn to_stable_hash_key(&self, - hcx: &StableHashingContext<'a, 'gcx, 'tcx>) + hcx: &StableHashingContext<'gcx>) -> (DefPathHash, hir::ItemLocalId) { let hir::BodyId { node_id } = *self; node_id.to_stable_hash_key(hcx) @@ -1013,9 +1013,9 @@ impl_stable_hash_for!(struct hir::InlineAsmOutput { is_indirect }); -impl<'a, 'gcx, 'tcx> HashStable> for hir::GlobalAsm { +impl<'gcx> HashStable> for hir::GlobalAsm { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::GlobalAsm { asm, @@ -1026,9 +1026,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for hir::G } } -impl<'a, 'gcx, 'tcx> HashStable> for hir::InlineAsm { +impl<'gcx> HashStable> for hir::InlineAsm { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let hir::InlineAsm { asm, @@ -1103,22 +1103,22 @@ impl_stable_hash_for!(enum hir::Constness { NotConst }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for hir::def_id::DefIndex { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { hcx.local_def_path_hash(*self).hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> ToStableHashKey> +impl<'gcx> ToStableHashKey> for hir::def_id::DefIndex { type KeyType = DefPathHash; #[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) } } @@ -1129,10 +1129,10 @@ impl_stable_hash_for!(struct hir::def::Export { span }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ::middle::lang_items::LangItem { fn hash_stable(&self, - _: &mut StableHashingContext<'a, 'gcx, 'tcx>, + _: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { ::std::hash::Hash::hash(self, hasher); } @@ -1143,10 +1143,10 @@ impl_stable_hash_for!(struct ::middle::lang_items::LanguageItems { missing }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for hir::TraitCandidate { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { let hir::TraitCandidate { diff --git a/src/librustc/ich/impls_mir.rs b/src/librustc/ich/impls_mir.rs index dce1639b375..9b6613e4cae 100644 --- a/src/librustc/ich/impls_mir.rs +++ b/src/librustc/ich/impls_mir.rs @@ -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::BasicBlockData<'tcx> { statements, terminator, is_cleanup }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for mir::Terminator<'gcx> { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let mir::Terminator { ref kind, @@ -76,61 +76,61 @@ for mir::Terminator<'gcx> { } -impl<'a, 'gcx, 'tcx> HashStable> for mir::Local { +impl<'gcx> HashStable> for mir::Local { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> HashStable> for mir::BasicBlock { +impl<'gcx> HashStable> for mir::BasicBlock { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> HashStable> for mir::Field { +impl<'gcx> HashStable> for mir::Field { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for mir::VisibilityScope { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> HashStable> for mir::Promoted { +impl<'gcx> HashStable> for mir::Promoted { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for mir::TerminatorKind<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -196,10 +196,10 @@ for mir::TerminatorKind<'gcx> { } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for mir::AssertMessage<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { 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<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for mir::StatementKind<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -256,12 +256,12 @@ for mir::StatementKind<'gcx> { } } -impl<'a, 'gcx, 'tcx, T> HashStable> +impl<'gcx, T> HashStable> for mir::ValidationOperand<'gcx, T> - where T: HashStable> + where T: HashStable> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { self.lval.hash_stable(hcx, hasher); @@ -273,9 +273,9 @@ impl<'a, 'gcx, 'tcx, T> HashStable> impl_stable_hash_for!(enum mir::ValidationOp { Acquire, Release, Suspend(region_scope) }); -impl<'a, 'gcx, 'tcx> HashStable> for mir::Lvalue<'gcx> { +impl<'gcx> HashStable> for mir::Lvalue<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -292,14 +292,14 @@ impl<'a, 'gcx, 'tcx> HashStable> for mir::L } } -impl<'a, 'gcx, 'tcx, B, V, T> HashStable> +impl<'gcx, B, V, T> HashStable> for mir::Projection<'gcx, B, V, T> - where B: HashStable>, - V: HashStable>, - T: HashStable> + where B: HashStable>, + V: HashStable>, + T: HashStable> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let mir::Projection { ref base, @@ -311,13 +311,13 @@ for mir::Projection<'gcx, B, V, T> } } -impl<'a, 'gcx, 'tcx, V, T> HashStable> +impl<'gcx, V, T> HashStable> for mir::ProjectionElem<'gcx, V, T> - where V: HashStable>, - T: HashStable> + where V: HashStable>, + T: HashStable> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -348,9 +348,9 @@ for mir::ProjectionElem<'gcx, V, T> impl_stable_hash_for!(struct mir::VisibilityScopeData { span, parent_scope }); -impl<'a, 'gcx, 'tcx> HashStable> for mir::Operand<'gcx> { +impl<'gcx> HashStable> for mir::Operand<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -365,9 +365,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for mir::O } } -impl<'a, 'gcx, 'tcx> HashStable> for mir::Rvalue<'gcx> { +impl<'gcx> HashStable> for mir::Rvalue<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -425,10 +425,10 @@ impl_stable_hash_for!(enum mir::CastKind { Unsize }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for mir::AggregateKind<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); 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<'a, 'gcx, 'tcx> HashStable> for mir::Literal<'gcx> { +impl<'gcx> HashStable> for mir::Literal<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index 6bcbce4b693..6821ac85298 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -28,42 +28,42 @@ use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher, StableHasherResult}; use rustc_data_structures::accumulate_vec::AccumulateVec; -impl<'a, 'gcx, 'tcx> HashStable> for InternedString { +impl<'gcx> HashStable> for InternedString { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let s: &str = &**self; s.hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> ToStableHashKey> for InternedString { +impl<'gcx> ToStableHashKey> for InternedString { type KeyType = InternedString; #[inline] fn to_stable_hash_key(&self, - _: &StableHashingContext<'a, 'gcx, 'tcx>) + _: &StableHashingContext<'gcx>) -> InternedString { self.clone() } } -impl<'a, 'gcx, 'tcx> HashStable> for ast::Name { +impl<'gcx> HashStable> for ast::Name { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { self.as_str().hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> ToStableHashKey> for ast::Name { +impl<'gcx> ToStableHashKey> for ast::Name { type KeyType = InternedString; #[inline] fn to_stable_hash_key(&self, - _: &StableHashingContext<'a, 'gcx, 'tcx>) + _: &StableHashingContext<'gcx>) -> InternedString { self.as_str() } @@ -110,10 +110,10 @@ impl_stable_hash_for!(struct ::syntax::attr::Stability { rustc_const_unstable }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ::syntax::attr::StabilityLevel { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); 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::AttrStyle { Outer, Inner }); -impl<'a, 'gcx, 'tcx> HashStable> for [ast::Attribute] { +impl<'gcx> HashStable> for [ast::Attribute] { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { if self.len() == 0 { self.len().hash_stable(hcx, hasher); @@ -190,9 +190,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for [ast:: } } -impl<'a, 'gcx, 'tcx> HashStable> for ast::Attribute { +impl<'gcx> HashStable> for ast::Attribute { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { // Make sure that these have been filtered out. debug_assert!(self.name().map(|name| !hcx.is_ignored_attr(name)).unwrap_or(true)); @@ -219,10 +219,10 @@ impl<'a, 'gcx, 'tcx> HashStable> for ast::A } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for tokenstream::TokenTree { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -241,10 +241,10 @@ for tokenstream::TokenTree { } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for tokenstream::TokenStream { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { for sub_tt in self.trees() { sub_tt.hash_stable(hcx, hasher); @@ -252,10 +252,10 @@ for tokenstream::TokenStream { } } -fn hash_token<'a, 'gcx, 'tcx, W: StableHasherResult>(token: &token::Token, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, - hasher: &mut StableHasher, - error_reporting_span: Span) { +fn hash_token<'gcx, W: StableHasherResult>(token: &token::Token, + hcx: &mut StableHashingContext<'gcx>, + hasher: &mut StableHasher, + error_reporting_span: Span) { mem::discriminant(token).hash_stable(hcx, hasher); match *token { token::Token::Eq | @@ -358,9 +358,9 @@ impl_stable_hash_for!(enum ::syntax::ast::MetaItemKind { NameValue(lit) }); -impl<'a, 'gcx, 'tcx> HashStable> for FileMap { +impl<'gcx> HashStable> for FileMap { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let FileMap { ref name, diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 371a9c96644..e3ecaae953a 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -20,30 +20,30 @@ use middle::region; use traits; use ty; -impl<'a, 'gcx, 'tcx, T> HashStable> +impl<'gcx, T> HashStable> for &'gcx ty::Slice - where T: HashStable> { + where T: HashStable> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { (&self[..]).hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ty::subst::Kind<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { self.as_type().hash_stable(hcx, hasher); self.as_region().hash_stable(hcx, hasher); } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ty::RegionKind { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -81,10 +81,10 @@ for ty::RegionKind { } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ty::adjustment::AutoBorrow<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -99,10 +99,10 @@ for ty::adjustment::AutoBorrow<'gcx> { } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ty::adjustment::Adjust<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -134,10 +134,10 @@ impl_stable_hash_for!(enum ty::BorrowKind { MutBorrow }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ty::UpvarCapture<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -161,11 +161,11 @@ impl_stable_hash_for!(struct ty::FnSig<'tcx> { abi }); -impl<'a, 'gcx, 'tcx, T> HashStable> for ty::Binder - where T: HashStable> +impl<'gcx, T> HashStable> for ty::Binder + where T: HashStable> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ty::Binder(ref inner) = *self; 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!(struct ty::SubtypePredicate<'tcx> { a_is_expected, a, b }); -impl<'a, 'gcx, 'tcx, A, B> HashStable> +impl<'gcx, A, B> HashStable> for ty::OutlivesPredicate - where A: HashStable>, - B: HashStable>, + where A: HashStable>, + B: HashStable>, { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ty::OutlivesPredicate(ref a, ref b) = *self; 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<'a, 'gcx, 'tcx> HashStable> for ty::Predicate<'gcx> { +impl<'gcx> HashStable> for ty::Predicate<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -245,9 +245,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for ty::Pr } } -impl<'a, 'gcx, 'tcx> HashStable> for ty::AdtFlags { +impl<'gcx> HashStable> for ty::AdtFlags { fn hash_stable(&self, - _: &mut StableHashingContext<'a, 'gcx, 'tcx>, + _: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { std_hash::Hash::hash(self, hasher); } @@ -272,10 +272,10 @@ impl_stable_hash_for!(struct ty::FieldDef { vis }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ::middle::const_val::ConstVal<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use middle::const_val::ConstVal::*; use middle::const_val::ConstAggregate::*; @@ -347,10 +347,10 @@ impl_stable_hash_for!(struct ::middle::const_val::ConstEvalErr<'tcx> { kind }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ::middle::const_val::ErrKind<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use middle::const_val::ErrKind::*; @@ -410,9 +410,9 @@ impl_stable_hash_for!(enum ty::adjustment::CustomCoerceUnsized { Struct(index) }); -impl<'a, 'gcx, 'tcx> HashStable> for ty::Generics { +impl<'gcx> HashStable> for ty::Generics { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ty::Generics { parent, @@ -438,10 +438,10 @@ impl<'a, 'gcx, 'tcx> HashStable> for ty::Ge } } -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ty::RegionParameterDef { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ty::RegionParameterDef { name, @@ -466,12 +466,12 @@ impl_stable_hash_for!(struct ty::TypeParameterDef { pure_wrt_drop }); -impl<'a, 'gcx, 'tcx, T> HashStable> +impl<'gcx, T> HashStable> for ::middle::resolve_lifetime::Set1 - where T: HashStable> + where T: HashStable> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use middle::resolve_lifetime::Set1; @@ -522,11 +522,11 @@ impl_stable_hash_for!(enum ::middle::region::Scope { Remainder(block_remainder) }); -impl<'a, 'gcx, 'tcx> ToStableHashKey> for region::Scope { +impl<'gcx> ToStableHashKey> for region::Scope { type KeyType = region::Scope; #[inline] - fn to_stable_hash_key(&self, _: &StableHashingContext<'a, 'gcx, 'tcx>) -> region::Scope { + fn to_stable_hash_key(&self, _: &StableHashingContext<'gcx>) -> region::Scope { *self } } @@ -552,11 +552,11 @@ impl_stable_hash_for!(enum ty::BoundRegion { BrEnv }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ty::TypeVariants<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use ty::TypeVariants::*; @@ -648,11 +648,11 @@ impl_stable_hash_for!(struct ty::TypeAndMut<'tcx> { mutbl }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ty::ExistentialPredicate<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -685,9 +685,9 @@ impl_stable_hash_for!(struct ty::Instance<'tcx> { substs }); -impl<'a, 'gcx, 'tcx> HashStable> for ty::InstanceDef<'gcx> { +impl<'gcx> HashStable> for ty::InstanceDef<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -721,9 +721,9 @@ impl<'a, 'gcx, 'tcx> HashStable> for ty::In } } -impl<'a, 'gcx, 'tcx> HashStable> for ty::TraitDef { +impl<'gcx> HashStable> for ty::TraitDef { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ty::TraitDef { // 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> for ty::CrateVariancesMap { +impl<'gcx> HashStable> for ty::CrateVariancesMap { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ty::CrateVariancesMap { ref dependencies, @@ -789,12 +789,12 @@ impl_stable_hash_for!(enum ty::AssociatedItemContainer { }); -impl<'a, 'gcx, 'tcx, T> HashStable> +impl<'gcx, T> HashStable> for ty::steal::Steal - where T: HashStable> + where T: HashStable> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { self.borrow().hash_stable(hcx, hasher); } @@ -816,10 +816,10 @@ impl_stable_hash_for!(enum ::middle::privacy::AccessLevel { Public }); -impl<'a, 'gcx, 'tcx> HashStable> +impl<'gcx> HashStable> for ::middle::privacy::AccessLevels { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { let ::middle::privacy::AccessLevels { diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index eb2b136e417..21dfd3267df 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -386,10 +386,10 @@ impl LintLevelMap { } } -impl<'a, 'gcx, 'tcx> HashStable> for LintLevelMap { +impl<'gcx> HashStable> for LintLevelMap { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let LintLevelMap { ref sets, diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index f3d66b49de5..f0285d6a937 100644 --- a/src/librustc/macros.rs +++ b/src/librustc/macros.rs @@ -73,10 +73,10 @@ macro_rules! __impl_stable_hash_field { #[macro_export] macro_rules! impl_stable_hash_for { (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] fn hash_stable(&self, - __ctx: &mut $crate::ich::StableHashingContext<'a, 'tcx, 'lcx>, + __ctx: &mut $crate::ich::StableHashingContext<'tcx>, __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { use $enum_name::*; ::std::mem::discriminant(self).hash_stable(__ctx, __hasher); @@ -92,10 +92,10 @@ macro_rules! impl_stable_hash_for { } }; (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] fn hash_stable(&self, - __ctx: &mut $crate::ich::StableHashingContext<'a, 'tcx, 'lcx>, + __ctx: &mut $crate::ich::StableHashingContext<'tcx>, __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { let $struct_name { $(ref $field),* @@ -106,10 +106,10 @@ macro_rules! impl_stable_hash_for { } }; (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] fn hash_stable(&self, - __ctx: &mut $crate::ich::StableHashingContext<'a, 'tcx, 'lcx>, + __ctx: &mut $crate::ich::StableHashingContext<'tcx>, __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { let $struct_name ( $(ref $field),* @@ -125,11 +125,11 @@ macro_rules! impl_stable_hash_for { macro_rules! impl_stable_hash_for_spanned { ($T:path) => ( - impl<'a, 'tcx, 'lcx> HashStable> for ::syntax::codemap::Spanned<$T> + impl<'tcx> HashStable> for ::syntax::codemap::Spanned<$T> { #[inline] fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'tcx, 'lcx>, + hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) { self.node.hash_stable(hcx, hasher); self.span.hash_stable(hcx, hasher); diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 5c6feddb1fd..5b286c6593b 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -1239,9 +1239,9 @@ pub fn provide(providers: &mut Providers) { }; } -impl<'a, 'gcx, 'tcx> HashStable> for ScopeTree { +impl<'gcx> HashStable> for ScopeTree { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ScopeTree { root_body, diff --git a/src/librustc/mir/cache.rs b/src/librustc/mir/cache.rs index 73c702fedb8..efc2f647cfd 100644 --- a/src/librustc/mir/cache.rs +++ b/src/librustc/mir/cache.rs @@ -35,9 +35,9 @@ impl serialize::Decodable for Cache { } } -impl<'a, 'gcx, 'tcx> HashStable> for Cache { +impl<'gcx> HashStable> for Cache { fn hash_stable(&self, - _: &mut StableHashingContext<'a, 'gcx, 'tcx>, + _: &mut StableHashingContext<'gcx>, _: &mut StableHasher) { // do nothing } diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index 6895e0e8a34..0651d1904bf 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -369,9 +369,9 @@ pub fn ancestors(tcx: TyCtxt, } } -impl<'a, 'gcx, 'tcx> HashStable> for Children { +impl<'gcx> HashStable> for Children { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let Children { ref nonblanket_impls, diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 61cd5db9a19..8005714433f 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -687,9 +687,9 @@ impl<'tcx> TypeckTables<'tcx> { } } -impl<'a, 'gcx, 'tcx> HashStable> for TypeckTables<'gcx> { +impl<'gcx> HashStable> for TypeckTables<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ty::TypeckTables { 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 { 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> { diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index 86ae4bb92df..490bfe78a9a 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -144,12 +144,12 @@ impl SimplifiedTypeGen { } } -impl<'a, 'gcx, 'tcx, D> HashStable> for SimplifiedTypeGen +impl<'gcx, D> HashStable> for SimplifiedTypeGen where D: Copy + Debug + Ord + Eq + Hash + - HashStable>, + HashStable>, { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 1ae1e7007ac..1709f9ed2df 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -2306,10 +2306,10 @@ impl<'a, 'tcx> TyLayout<'tcx> { } } -impl<'a, 'gcx, 'tcx> HashStable> for Layout +impl<'gcx> HashStable> for Layout { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use ty::layout::Layout::*; mem::discriminant(self).hash_stable(hcx, hasher); @@ -2399,10 +2399,10 @@ impl_stable_hash_for!(struct ::ty::layout::Size { raw }); -impl<'a, 'gcx, 'tcx> HashStable> for LayoutError<'gcx> +impl<'gcx> HashStable> for LayoutError<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { use ty::layout::LayoutError::*; mem::discriminant(self).hash_stable(hcx, hasher); diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index da00f12edac..32d8a5114a7 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -500,9 +500,9 @@ impl<'tcx> TyS<'tcx> { } } -impl<'a, 'gcx, 'tcx> HashStable> for ty::TyS<'gcx> { +impl<'gcx> HashStable> for ty::TyS<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ty::TyS { ref sty, @@ -1334,9 +1334,9 @@ impl<'tcx> serialize::UseSpecializedEncodable for &'tcx AdtDef { impl<'tcx> serialize::UseSpecializedDecodable for &'tcx AdtDef {} -impl<'a, 'gcx, 'tcx> HashStable> for AdtDef { +impl<'gcx> HashStable> for AdtDef { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let ty::AdtDef { did, diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index 9ae6c3516a5..e0b05c2ba39 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -186,9 +186,9 @@ pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) } -impl<'a, 'gcx, 'tcx> HashStable> for TraitImpls { +impl<'gcx> HashStable> for TraitImpls { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let TraitImpls { ref blanket_impls, diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 16ae3cdbf17..27819f551b9 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -12,7 +12,7 @@ use hir::def_id::{DefId, LOCAL_CRATE}; use hir::map::DefPathData; -use ich::{StableHashingContext, NodeIdHashingMode}; +use ich::NodeIdHashingMode; use middle::const_val::ConstVal; use traits::{self, Reveal}; 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. pub fn type_id_hash(self, ty: Ty<'tcx>) -> u64 { 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 // erase them. The erase_regions() call will also anonymize bound diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 32a160bcffc..d50d3deb673 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -175,7 +175,7 @@ pub fn compile_input(sess: &Session, // Construct the HIR map let hir_map = time(sess.time_passes(), "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(); diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 34f4e0e7b0c..daabf481e46 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -133,7 +133,7 @@ fn test_env(source_string: &str, let arena = DroplessArena::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: let named_region_map = resolve_lifetime::krate(&sess, &*cstore, &hir_map); diff --git a/src/librustc_incremental/calculate_svh/mod.rs b/src/librustc_incremental/calculate_svh/mod.rs index 60e1f238f44..0329aa8d674 100644 --- a/src/librustc_incremental/calculate_svh/mod.rs +++ b/src/librustc_incremental/calculate_svh/mod.rs @@ -91,7 +91,7 @@ impl<'a> ::std::ops::Index<&'a DepNode> for IncrementalHashesMap { struct ComputeItemHashesVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - hcx: StableHashingContext<'a, 'tcx, 'tcx>, + hcx: StableHashingContext<'tcx>, hashes: IncrementalHashesMap, } @@ -100,7 +100,7 @@ impl<'a, 'tcx: 'a> ComputeItemHashesVisitor<'a, 'tcx> { def_index: DefIndex, hash_bodies: bool, item_like: T) - where T: HashStable> + where T: HashStable> { 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 @@ -303,7 +303,7 @@ pub fn compute_incremental_hashes_map<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) let mut visitor = ComputeItemHashesVisitor { tcx, - hcx: StableHashingContext::new(tcx), + hcx: tcx.create_stable_hashing_context(), hashes: IncrementalHashesMap::new(), }; diff --git a/src/librustc_metadata/astencode.rs b/src/librustc_metadata/astencode.rs index 3bc281e5486..d9ab2562eff 100644 --- a/src/librustc_metadata/astencode.rs +++ b/src/librustc_metadata/astencode.rs @@ -16,7 +16,7 @@ use schema::*; use rustc::hir; use rustc::ty::{self, TyCtxt}; -use rustc::ich::{StableHashingContext, Fingerprint}; +use rustc::ich::Fingerprint; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; #[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 // hash them here, during export, and store the hash with metadata. 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(); hcx.while_hashing_hir_bodies(true, |hcx| { diff --git a/src/librustc_metadata/isolated_encoder.rs b/src/librustc_metadata/isolated_encoder.rs index b9ad9086c03..7dc50fe29df 100644 --- a/src/librustc_metadata/isolated_encoder.rs +++ b/src/librustc_metadata/isolated_encoder.rs @@ -23,7 +23,7 @@ use rustc_serialize::Encodable; pub struct IsolatedEncoder<'a, 'b: 'a, 'tcx: 'b> { pub tcx: TyCtxt<'b, 'tcx, 'tcx>, ecx: &'a mut EncodeContext<'b, 'tcx>, - hcx: Option<(StableHashingContext<'b, 'tcx, 'tcx>, StableHasher)>, + hcx: Option<(StableHashingContext<'tcx>, StableHasher)>, } 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 // want to mess up our tests. let hcx = if tcx.sess.opts.debugging_opts.query_dep_graph { - StableHashingContext::new(tcx) + tcx.create_stable_hashing_context() } else { - StableHashingContext::new(tcx).force_span_hashing() + tcx.create_stable_hashing_context().force_span_hashing() }; Some((hcx, StableHasher::new())) @@ -61,7 +61,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { } pub fn lazy(&mut self, value: &T) -> Lazy - where T: Encodable + HashStable> + where T: Encodable + HashStable> { if let Some((ref mut hcx, ref mut hasher)) = self.hcx { value.hash_stable(hcx, hasher); @@ -72,7 +72,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { pub fn lazy_seq(&mut self, iter: I) -> LazySeq where I: IntoIterator, - T: Encodable + HashStable> + T: Encodable + HashStable> { if let Some((ref mut hcx, ref mut hasher)) = self.hcx { 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 where I: IntoIterator, - T: 'x + Encodable + HashStable> + T: 'x + Encodable + HashStable> { if let Some((ref mut hcx, ref mut hasher)) = self.hcx { 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(&mut self, slice: &[T]) -> LazySeq - where T: Encodable + HashStable> + where T: Encodable + HashStable> { if let Some((ref mut hcx, ref mut hasher)) = self.hcx { 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(&mut self, slice: &[&T]) -> LazySeq - where T: Encodable + HashStable> + where T: Encodable + HashStable> { if let Some((ref mut hcx, ref mut hasher)) = self.hcx { slice.hash_stable(hcx, hasher); diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index ee196d74bb8..dad0d26d271 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -229,9 +229,9 @@ pub struct TraitImpls { pub impls: LazySeq, } -impl<'a, 'gcx, 'tcx> HashStable> for TraitImpls { +impl<'gcx> HashStable> for TraitImpls { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { let TraitImpls { trait_id: (krate, def_index), @@ -312,9 +312,9 @@ pub enum EntryKind<'tcx> { AssociatedConst(AssociatedContainer, u8), } -impl<'a, 'gcx, 'tcx> HashStable> for EntryKind<'tcx> { +impl<'gcx> HashStable> for EntryKind<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>, + hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs index 40fc07cfd4f..7e75eb9c78b 100644 --- a/src/librustc_trans/context.rs +++ b/src/librustc_trans/context.rs @@ -141,10 +141,10 @@ impl<'a, 'tcx> DepGraphSafe 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 { - StableHashingContext::new(self.tcx) + self.tcx.create_stable_hashing_context() } } diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 4918dd78b37..29da763f334 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -141,10 +141,10 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> 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 { - StableHashingContext::new(self.terms_cx.tcx) + self.terms_cx.tcx.create_stable_hashing_context() } } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 277e2909ba9..1663e5ad142 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -175,7 +175,7 @@ pub fn run_core(search_paths: SearchPaths, let arena = DroplessArena::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, &None, &None, diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 95c0f5f5d63..36efc37a809 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -124,7 +124,7 @@ pub fn run(input: &str, 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 mut hir_collector = HirCollector { sess: &sess,