diff options
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/dep_graph/dep_node.rs | 2 | ||||
| -rw-r--r-- | src/librustc/hir/map/collector.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ich/hcx.rs | 64 | ||||
| -rw-r--r-- | src/librustc/ich/impls_hir.rs | 132 | ||||
| -rw-r--r-- | src/librustc/ich/impls_mir.rs | 98 | ||||
| -rw-r--r-- | src/librustc/ich/impls_syntax.rs | 48 | ||||
| -rw-r--r-- | src/librustc/ich/impls_ty.rs | 206 | ||||
| -rw-r--r-- | src/librustc/lint/levels.rs | 4 | ||||
| -rw-r--r-- | src/librustc/macros.rs | 16 | ||||
| -rw-r--r-- | src/librustc/middle/borrowck.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/region.rs | 4 | ||||
| -rw-r--r-- | src/librustc/mir/cache.rs | 4 | ||||
| -rw-r--r-- | src/librustc/mir/interpret/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc/mir/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc/mir/mono.rs | 8 | ||||
| -rw-r--r-- | src/librustc/session/config.rs | 4 | ||||
| -rw-r--r-- | src/librustc/traits/specialize/specialization_graph.rs | 4 | ||||
| -rw-r--r-- | src/librustc/ty/context.rs | 6 | ||||
| -rw-r--r-- | src/librustc/ty/fast_reject.rs | 6 | ||||
| -rw-r--r-- | src/librustc/ty/layout.rs | 20 | ||||
| -rw-r--r-- | src/librustc/ty/mod.rs | 16 | ||||
| -rw-r--r-- | src/librustc/ty/trait_def.rs | 4 |
22 files changed, 352 insertions, 304 deletions
diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 6824c015eab..7d8709a82f4 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -661,7 +661,7 @@ 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<StableHashingContext<'gcx>> + fmt::Debug + where T: HashStable<StableHashingContext<'a>> + fmt::Debug { default const CAN_RECONSTRUCT_QUERY_KEY: bool = false; diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 9bbda9d7447..3c523f5633e 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -529,7 +529,7 @@ struct HirItemLike<T> { hash_bodies: bool, } -impl<'hir, T> HashStable<StableHashingContext<'hir>> for HirItemLike<T> +impl<'a, 'hir, T> HashStable<StableHashingContext<'hir>> for HirItemLike<T> where T: HashStable<StableHashingContext<'hir>> { fn hash_stable<W: StableHasherResult>(&self, diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 4dcab6a04ee..6ae588b2a07 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -46,19 +46,19 @@ pub fn compute_ignored_attr_names() -> FxHashSet<Symbol> { /// 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). #[derive(Clone)] -pub struct StableHashingContext<'gcx> { - sess: &'gcx Session, - definitions: &'gcx Definitions, - cstore: &'gcx dyn CrateStore, - body_resolver: BodyResolver<'gcx>, +pub struct StableHashingContext<'a> { + sess: &'a Session, + definitions: &'a Definitions, + cstore: &'a dyn CrateStore, + body_resolver: BodyResolver<'a>, hash_spans: bool, hash_bodies: bool, node_id_hashing_mode: NodeIdHashingMode, // Very often, we are hashing something that does not need the // CachingCodemapView, so we initialize it lazily. - raw_codemap: &'gcx CodeMap, - caching_codemap: Option<CachingCodemapView<'gcx>>, + raw_codemap: &'a CodeMap, + caching_codemap: Option<CachingCodemapView<'a>>, } #[derive(PartialEq, Eq, Clone, Copy)] @@ -81,14 +81,14 @@ impl<'gcx> BodyResolver<'gcx> { } } -impl<'gcx> StableHashingContext<'gcx> { +impl<'a> StableHashingContext<'a> { // 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 dyn CrateStore) + pub fn new(sess: &'a Session, + krate: &'a hir::Crate, + definitions: &'a Definitions, + cstore: &'a dyn CrateStore) -> Self { let hash_spans_initial = !sess.opts.debugging_opts.incremental_ignore_spans; @@ -106,7 +106,7 @@ impl<'gcx> StableHashingContext<'gcx> { } #[inline] - pub fn sess(&self) -> &'gcx Session { + pub fn sess(&self) -> &'a Session { self.sess } @@ -165,7 +165,7 @@ impl<'gcx> StableHashingContext<'gcx> { } #[inline] - pub fn codemap(&mut self) -> &mut CachingCodemapView<'gcx> { + pub fn codemap(&mut self) -> &mut CachingCodemapView<'a> { match self.caching_codemap { Some(ref mut cm) => { cm @@ -193,27 +193,27 @@ impl<'gcx> StableHashingContext<'gcx> { } impl<'a, 'gcx, 'lcx> StableHashingContextProvider for TyCtxt<'a, 'gcx, 'lcx> { - type ContextType = StableHashingContext<'gcx>; + type ContextType = StableHashingContext<'a>; fn create_stable_hashing_context(&self) -> Self::ContextType { (*self).create_stable_hashing_context() } } -impl<'gcx> StableHashingContextProvider for StableHashingContext<'gcx> { - type ContextType = StableHashingContext<'gcx>; +impl<'a> StableHashingContextProvider for StableHashingContext<'a> { + type ContextType = StableHashingContext<'a>; fn create_stable_hashing_context(&self) -> Self::ContextType { self.clone() } } -impl<'gcx> ::dep_graph::DepGraphSafe for StableHashingContext<'gcx> { +impl<'a> ::dep_graph::DepGraphSafe for StableHashingContext<'a> { } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::BodyId { +impl<'a> HashStable<StableHashingContext<'a>> for hir::BodyId { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { if hcx.hash_bodies() { hcx.body_resolver.body(*self).hash_stable(hcx, hasher); @@ -221,10 +221,10 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::BodyId { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::HirId { +impl<'a> HashStable<StableHashingContext<'a>> for hir::HirId { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { match hcx.node_id_hashing_mode { NodeIdHashingMode::Ignore => { @@ -243,21 +243,21 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::HirId { } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for hir::HirId { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::HirId { type KeyType = (DefPathHash, hir::ItemLocalId); #[inline] fn to_stable_hash_key(&self, - hcx: &StableHashingContext<'gcx>) + hcx: &StableHashingContext<'a>) -> (DefPathHash, hir::ItemLocalId) { let def_path_hash = hcx.local_def_path_hash(self.owner); (def_path_hash, self.local_id) } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::NodeId { +impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { match hcx.node_id_hashing_mode { NodeIdHashingMode::Ignore => { @@ -270,18 +270,18 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::NodeId { } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for ast::NodeId { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for ast::NodeId { type KeyType = (DefPathHash, hir::ItemLocalId); #[inline] fn to_stable_hash_key(&self, - hcx: &StableHashingContext<'gcx>) + hcx: &StableHashingContext<'a>) -> (DefPathHash, hir::ItemLocalId) { hcx.definitions.node_to_hir_id(*self).to_stable_hash_key(hcx) } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for Span { +impl<'a> HashStable<StableHashingContext<'a>> 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 @@ -293,7 +293,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> 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<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { const TAG_VALID_SPAN: u8 = 0; const TAG_INVALID_SPAN: u8 = 1; @@ -373,8 +373,8 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for Span { } } -pub fn hash_stable_trait_impls<'gcx, W, R>( - hcx: &mut StableHashingContext<'gcx>, +pub fn hash_stable_trait_impls<'a, 'gcx, W, R>( + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>, blanket_impls: &Vec<DefId>, non_blanket_impls: &HashMap<fast_reject::SimplifiedType, Vec<DefId>, R>) diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index faad3f35631..c085b803085 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -21,46 +21,46 @@ use std::mem; use syntax::ast; use syntax::attr; -impl<'gcx> HashStable<StableHashingContext<'gcx>> for DefId { +impl<'a> HashStable<StableHashingContext<'a>> for DefId { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { hcx.def_path_hash(*self).hash_stable(hcx, hasher); } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for DefId { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for DefId { type KeyType = DefPathHash; #[inline] - fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash { + fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash { hcx.def_path_hash(*self) } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for LocalDefId { +impl<'a> HashStable<StableHashingContext<'a>> for LocalDefId { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { hcx.def_path_hash(self.to_def_id()).hash_stable(hcx, hasher); } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for LocalDefId { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for LocalDefId { type KeyType = DefPathHash; #[inline] - fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash { + fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash { hcx.def_path_hash(self.to_def_id()) } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for CrateNum { +impl<'a> HashStable<StableHashingContext<'a>> for CrateNum { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { hcx.def_path_hash(DefId { krate: *self, @@ -69,11 +69,11 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for CrateNum { } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for CrateNum { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for CrateNum { type KeyType = DefPathHash; #[inline] - fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash { + fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash { let def_id = DefId { krate: *self, index: CRATE_DEF_INDEX }; def_id.to_stable_hash_key(hcx) } @@ -81,13 +81,13 @@ impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for CrateNum { impl_stable_hash_for!(tuple_struct hir::ItemLocalId { index }); -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> +impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::ItemLocalId { type KeyType = hir::ItemLocalId; #[inline] fn to_stable_hash_key(&self, - _: &StableHashingContext<'gcx>) + _: &StableHashingContext<'a>) -> hir::ItemLocalId { *self } @@ -100,9 +100,9 @@ for hir::ItemLocalId { // want to pick up on a reference changing its target, so we hash the NodeIds // in "DefPath Mode". -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ItemId { +impl<'a> HashStable<StableHashingContext<'a>> for hir::ItemId { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::ItemId { id @@ -114,9 +114,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ItemId { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItemId { +impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItemId { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::TraitItemId { node_id @@ -128,9 +128,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItemId { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ImplItemId { +impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItemId { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::ImplItemId { node_id @@ -271,9 +271,9 @@ impl_stable_hash_for!(struct hir::TypeBinding { span }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Ty { +impl<'a> HashStable<StableHashingContext<'a>> for hir::Ty { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { hcx.while_hashing_hir_bodies(true, |hcx| { let hir::Ty { @@ -339,9 +339,9 @@ impl_stable_hash_for!(enum hir::FunctionRetTy { Return(t) }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitRef { +impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitRef { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::TraitRef { ref path, @@ -376,9 +376,9 @@ impl_stable_hash_for!(struct hir::MacroDef { }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Block { +impl<'a> HashStable<StableHashingContext<'a>> for hir::Block { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::Block { ref stmts, @@ -400,9 +400,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Block { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Pat { +impl<'a> HashStable<StableHashingContext<'a>> for hir::Pat { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::Pat { id: _, @@ -527,9 +527,9 @@ impl_stable_hash_for!(enum hir::UnsafeSource { UserProvided }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Expr { +impl<'a> HashStable<StableHashingContext<'a>> for hir::Expr { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { hcx.while_hashing_hir_bodies(true, |hcx| { let hir::Expr { @@ -591,9 +591,9 @@ impl_stable_hash_for!(enum hir::LoopSource { ForLoop }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::MatchSource { +impl<'a> HashStable<StableHashingContext<'a>> for hir::MatchSource { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use hir::MatchSource; @@ -647,9 +647,9 @@ impl_stable_hash_for!(enum hir::ScopeTarget { Loop(loop_id_result) }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::Ident { +impl<'a> HashStable<StableHashingContext<'a>> for ast::Ident { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ast::Ident { ref name, @@ -660,9 +660,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::Ident { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItem { +impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItem { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::TraitItem { id: _, @@ -695,9 +695,9 @@ impl_stable_hash_for!(enum hir::TraitItemKind { Type(bounds, rhs) }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ImplItem { +impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItem { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::ImplItem { id: _, @@ -729,9 +729,9 @@ impl_stable_hash_for!(enum hir::ImplItemKind { Type(t) }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Visibility { +impl<'a> HashStable<StableHashingContext<'a>> for hir::Visibility { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -750,9 +750,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Visibility { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Defaultness { +impl<'a> HashStable<StableHashingContext<'a>> for hir::Defaultness { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -771,9 +771,9 @@ impl_stable_hash_for!(enum hir::ImplPolarity { Negative }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Mod { +impl<'a> HashStable<StableHashingContext<'a>> for hir::Mod { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::Mod { inner, @@ -826,9 +826,9 @@ impl_stable_hash_for!(enum hir::VariantData { Unit(id) }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item { +impl<'a> HashStable<StableHashingContext<'a>> for hir::Item { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::Item { name, @@ -885,10 +885,10 @@ impl_stable_hash_for!(struct hir::ImplItemRef { defaultness }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for hir::AssociatedItemKind { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -930,9 +930,9 @@ impl_stable_hash_for!(struct hir::Arg { hir_id }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Body { +impl<'a> HashStable<StableHashingContext<'a>> for hir::Body { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::Body { ref arguments, @@ -948,12 +948,12 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Body { } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for hir::BodyId { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::BodyId { type KeyType = (DefPathHash, hir::ItemLocalId); #[inline] fn to_stable_hash_key(&self, - hcx: &StableHashingContext<'gcx>) + hcx: &StableHashingContext<'a>) -> (DefPathHash, hir::ItemLocalId) { let hir::BodyId { node_id } = *self; node_id.to_stable_hash_key(hcx) @@ -966,9 +966,9 @@ impl_stable_hash_for!(struct hir::InlineAsmOutput { is_indirect }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::GlobalAsm { +impl<'a> HashStable<StableHashingContext<'a>> for hir::GlobalAsm { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::GlobalAsm { asm, @@ -979,9 +979,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::GlobalAsm { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::InlineAsm { +impl<'a> HashStable<StableHashingContext<'a>> for hir::InlineAsm { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let hir::InlineAsm { asm, @@ -1062,22 +1062,22 @@ impl_stable_hash_for!(enum hir::Constness { NotConst }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for hir::def_id::DefIndex { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { hcx.local_def_path_hash(*self).hash_stable(hcx, hasher); } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> +impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::def_id::DefIndex { type KeyType = DefPathHash; #[inline] - fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash { + fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash { hcx.local_def_path_hash(*self) } } @@ -1090,10 +1090,10 @@ impl_stable_hash_for!(struct hir::def::Export { is_import }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for ::middle::lang_items::LangItem { fn hash_stable<W: StableHasherResult>(&self, - _: &mut StableHashingContext<'gcx>, + _: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { ::std::hash::Hash::hash(self, hasher); } @@ -1104,10 +1104,10 @@ impl_stable_hash_for!(struct ::middle::lang_items::LanguageItems { missing }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitCandidate { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { let hir::TraitCandidate { @@ -1121,11 +1121,11 @@ for hir::TraitCandidate { } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for hir::TraitCandidate { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::TraitCandidate { type KeyType = (DefPathHash, Option<(DefPathHash, hir::ItemLocalId)>); fn to_stable_hash_key(&self, - hcx: &StableHashingContext<'gcx>) + hcx: &StableHashingContext<'a>) -> Self::KeyType { let hir::TraitCandidate { def_id, diff --git a/src/librustc/ich/impls_mir.rs b/src/librustc/ich/impls_mir.rs index 40204943bb5..1e6dadae363 100644 --- a/src/librustc/ich/impls_mir.rs +++ b/src/librustc/ich/impls_mir.rs @@ -35,11 +35,11 @@ impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator, impl_stable_hash_for!(struct mir::UnsafetyViolation { source_info, description, kind }); impl_stable_hash_for!(struct mir::UnsafetyCheckResult { violations, unsafe_blocks }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for mir::BorrowKind { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -54,11 +54,11 @@ for mir::BorrowKind { } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for mir::UnsafetyViolationKind { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -79,12 +79,12 @@ impl_stable_hash_for!(struct mir::Terminator<'tcx> { source_info }); -impl<'gcx, T> HashStable<StableHashingContext<'gcx>> for mir::ClearCrossCrate<T> - where T: HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for mir::ClearCrossCrate<T> + where T: HashStable<StableHashingContext<'a>> { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -96,61 +96,61 @@ impl<'gcx, T> HashStable<StableHashingContext<'gcx>> for mir::ClearCrossCrate<T> } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Local { +impl<'a> HashStable<StableHashingContext<'a>> for mir::Local { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::BasicBlock { +impl<'a> HashStable<StableHashingContext<'a>> for mir::BasicBlock { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Field { +impl<'a> HashStable<StableHashingContext<'a>> for mir::Field { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for mir::VisibilityScope { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Promoted { +impl<'a> HashStable<StableHashingContext<'a>> for mir::Promoted { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::TerminatorKind<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -227,10 +227,10 @@ for mir::TerminatorKind<'gcx> { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::AssertMessage<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -250,10 +250,10 @@ for mir::AssertMessage<'gcx> { impl_stable_hash_for!(struct mir::Statement<'tcx> { source_info, kind }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::StatementKind<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -287,12 +287,12 @@ for mir::StatementKind<'gcx> { } } -impl<'gcx, T> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for mir::ValidationOperand<'gcx, T> - where T: HashStable<StableHashingContext<'gcx>> + where T: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { self.place.hash_stable(hcx, hasher); @@ -304,9 +304,9 @@ impl<'gcx, T> HashStable<StableHashingContext<'gcx>> impl_stable_hash_for!(enum mir::ValidationOp { Acquire, Release, Suspend(region_scope) }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Place<'gcx> { +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Place<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -323,14 +323,14 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Place<'gcx> { } } -impl<'gcx, B, V, T> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, B, V, T> HashStable<StableHashingContext<'a>> for mir::Projection<'gcx, B, V, T> - where B: HashStable<StableHashingContext<'gcx>>, - V: HashStable<StableHashingContext<'gcx>>, - T: HashStable<StableHashingContext<'gcx>> + where B: HashStable<StableHashingContext<'a>>, + V: HashStable<StableHashingContext<'a>>, + T: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let mir::Projection { ref base, @@ -342,13 +342,13 @@ for mir::Projection<'gcx, B, V, T> } } -impl<'gcx, V, T> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, V, T> HashStable<StableHashingContext<'a>> for mir::ProjectionElem<'gcx, V, T> - where V: HashStable<StableHashingContext<'gcx>>, - T: HashStable<StableHashingContext<'gcx>> + where V: HashStable<StableHashingContext<'a>>, + T: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -382,9 +382,9 @@ impl_stable_hash_for!(struct mir::VisibilityScopeInfo { lint_root, safety }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Safety { +impl<'a> HashStable<StableHashingContext<'a>> for mir::Safety { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -399,9 +399,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Safety { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Operand<'gcx> { +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Operand<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -419,9 +419,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Operand<'gcx> { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Rvalue<'gcx> { +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Rvalue<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -479,10 +479,10 @@ impl_stable_hash_for!(enum mir::CastKind { Unsize }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::AggregateKind<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -541,9 +541,9 @@ impl_stable_hash_for!(enum mir::NullOp { impl_stable_hash_for!(struct mir::Constant<'tcx> { span, ty, literal }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::Literal<'gcx> { +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::Literal<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -570,9 +570,9 @@ impl_stable_hash_for!(struct mir::ClosureOutlivesRequirement<'tcx> { blame_span }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for mir::ClosureOutlivesSubject<'gcx> { +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::ClosureOutlivesSubject<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { 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 f935cbfcde9..52f43fbed7b 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -29,42 +29,42 @@ use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher, StableHasherResult}; use rustc_data_structures::accumulate_vec::AccumulateVec; -impl<'gcx> HashStable<StableHashingContext<'gcx>> for InternedString { +impl<'a> HashStable<StableHashingContext<'a>> for InternedString { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let s: &str = &**self; s.hash_stable(hcx, hasher); } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for InternedString { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for InternedString { type KeyType = InternedString; #[inline] fn to_stable_hash_key(&self, - _: &StableHashingContext<'gcx>) + _: &StableHashingContext<'a>) -> InternedString { self.clone() } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::Name { +impl<'a> HashStable<StableHashingContext<'a>> for ast::Name { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { self.as_str().hash_stable(hcx, hasher); } } -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for ast::Name { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for ast::Name { type KeyType = InternedString; #[inline] fn to_stable_hash_key(&self, - _: &StableHashingContext<'gcx>) + _: &StableHashingContext<'a>) -> InternedString { self.as_str() } @@ -111,10 +111,10 @@ impl_stable_hash_for!(struct ::syntax::attr::Stability { rustc_const_unstable }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for ::syntax::attr::StabilityLevel { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -166,9 +166,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<'gcx> HashStable<StableHashingContext<'gcx>> for [ast::Attribute] { +impl<'a> HashStable<StableHashingContext<'a>> for [ast::Attribute] { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { if self.len() == 0 { self.len().hash_stable(hcx, hasher); @@ -191,9 +191,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for [ast::Attribute] { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::Attribute { +impl<'a> HashStable<StableHashingContext<'a>> for ast::Attribute { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { // Make sure that these have been filtered out. debug_assert!(self.name().map(|name| !hcx.is_ignored_attr(name)).unwrap_or(true)); @@ -220,10 +220,10 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::Attribute { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for tokenstream::TokenTree { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -242,10 +242,10 @@ for tokenstream::TokenTree { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for tokenstream::TokenStream { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { for sub_tt in self.trees() { sub_tt.hash_stable(hcx, hasher); @@ -253,9 +253,11 @@ for tokenstream::TokenStream { } } -fn hash_token<'gcx, W: StableHasherResult>(token: &token::Token, - hcx: &mut StableHashingContext<'gcx>, - hasher: &mut StableHasher<W>) { +fn hash_token<'a, 'gcx, W: StableHasherResult>( + token: &token::Token, + hcx: &mut StableHashingContext<'a>, + hasher: &mut StableHasher<W>, +) { mem::discriminant(token).hash_stable(hcx, hasher); match *token { token::Token::Eq | @@ -383,9 +385,9 @@ impl_stable_hash_for!(enum ::syntax_pos::FileName { Custom(s) }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for FileMap { +impl<'a> HashStable<StableHashingContext<'a>> for FileMap { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let FileMap { name: _, // We hash the smaller name_hash instead of this diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index a25741c95aa..a92d9b16612 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -23,11 +23,11 @@ use traits; use ty; use mir; -impl<'gcx, T> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for &'gcx ty::Slice<T> - where T: HashStable<StableHashingContext<'gcx>> { + where T: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { thread_local! { static CACHE: RefCell<FxHashMap<(usize, usize), Fingerprint>> = @@ -52,10 +52,10 @@ for &'gcx ty::Slice<T> } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::subst::Kind<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { self.unpack().hash_stable(hcx, hasher); } @@ -73,10 +73,10 @@ for ty::subst::UnpackedKind<'gcx> { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionKind { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -120,20 +120,20 @@ for ty::RegionKind { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::RegionVid { +impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionVid { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use rustc_data_structures::indexed_vec::Idx; self.index().hash_stable(hcx, hasher); } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::adjustment::AutoBorrow<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -148,10 +148,10 @@ for ty::adjustment::AutoBorrow<'gcx> { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::adjustment::Adjust<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -197,10 +197,10 @@ impl_stable_hash_for!(enum ty::BorrowKind { MutBorrow }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::UpvarCapture<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -224,11 +224,11 @@ impl_stable_hash_for!(struct ty::FnSig<'tcx> { abi }); -impl<'gcx, T> HashStable<StableHashingContext<'gcx>> for ty::Binder<T> - where T: HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for ty::Binder<T> + where T: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ty::Binder(ref inner) = *self; inner.hash_stable(hcx, hasher); @@ -247,13 +247,13 @@ impl_stable_hash_for!(struct ty::TraitRef<'tcx> { def_id, substs }); impl_stable_hash_for!(struct ty::TraitPredicate<'tcx> { trait_ref }); impl_stable_hash_for!(struct ty::SubtypePredicate<'tcx> { a_is_expected, a, b }); -impl<'gcx, A, B> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, A, B> HashStable<StableHashingContext<'a>> for ty::OutlivesPredicate<A, B> - where A: HashStable<StableHashingContext<'gcx>>, - B: HashStable<StableHashingContext<'gcx>>, + where A: HashStable<StableHashingContext<'a>>, + B: HashStable<StableHashingContext<'a>>, { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ty::OutlivesPredicate(ref a, ref b) = *self; a.hash_stable(hcx, hasher); @@ -265,9 +265,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<'gcx> HashStable<StableHashingContext<'gcx>> for ty::Predicate<'gcx> { +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::Predicate<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -305,9 +305,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::Predicate<'gcx> { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::AdtFlags { +impl<'a> HashStable<StableHashingContext<'a>> for ty::AdtFlags { fn hash_stable<W: StableHasherResult>(&self, - _: &mut StableHashingContext<'gcx>, + _: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { std_hash::Hash::hash(self, hasher); } @@ -332,10 +332,10 @@ impl_stable_hash_for!(struct ty::FieldDef { vis }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ::middle::const_val::ConstVal<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use middle::const_val::ConstVal::*; @@ -368,7 +368,51 @@ impl_stable_hash_for!(struct mir::interpret::MemoryPointer { offset }); -impl_stable_hash_for!(tuple_struct mir::interpret::AllocId{id}); +impl<'a> HashStable<StableHashingContext<'a>> for mir::interpret::AllocId { + fn hash_stable<W: StableHasherResult>( + &self, + hcx: &mut StableHashingContext<'a>, + hasher: &mut StableHasher<W>, + ) { + ty::tls::with_opt(|tcx| { + let tcx = tcx.expect("can't hash AllocIds during hir lowering"); + let interner = tcx + .interpret_interner + .borrow(); + if let Some(def_id) = interner.get_corresponding_static_def_id(*self) { + 0.hash_stable(hcx, hasher); + // statics are unique via their DefId + def_id.hash_stable(hcx, hasher); + } else if let Some(alloc) = interner.get_alloc(*self) { + // not a static, can't be recursive, hash the allocation + 1.hash_stable(hcx, hasher); + alloc.hash_stable(hcx, hasher); + } else if let Some(inst) = interner.get_fn(*self) { + 2.hash_stable(hcx, hasher); + inst.hash_stable(hcx, hasher); + } else { + bug!("no allocation for {}", self); + } + }); + } +} + +impl<'a> HashStable<StableHashingContext<'a>> for mir::interpret::Allocation { + fn hash_stable<W: StableHasherResult>( + &self, + hcx: &mut StableHashingContext<'a>, + hasher: &mut StableHasher<W>, + ) { + self.bytes.hash_stable(hcx, hasher); + for reloc in self.relocations.iter() { + reloc.hash_stable(hcx, hasher); + } + self.undef_mask.hash_stable(hcx, hasher); + self.align.hash_stable(hcx, hasher); + self.mutable.hash_stable(hcx, hasher); + } +} + impl_stable_hash_for!(struct mir::interpret::Pointer{primval}); impl_stable_hash_for!(enum mir::interpret::PrimVal { @@ -387,10 +431,10 @@ impl_stable_hash_for!(struct ::middle::const_val::ConstEvalErr<'tcx> { kind }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ::middle::const_val::ErrKind<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use middle::const_val::ErrKind::*; @@ -441,10 +485,10 @@ impl_stable_hash_for!(struct ty::GenericPredicates<'tcx> { predicates }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ::mir::interpret::EvalError<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use mir::interpret::EvalErrorKind::*; @@ -621,9 +665,9 @@ impl_stable_hash_for!(enum ty::adjustment::CustomCoerceUnsized { Struct(index) }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::Generics { +impl<'a> HashStable<StableHashingContext<'a>> for ty::Generics { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ty::Generics { parent, @@ -649,10 +693,10 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::Generics { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionParameterDef { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ty::RegionParameterDef { name, @@ -678,12 +722,12 @@ impl_stable_hash_for!(struct ty::TypeParameterDef { synthetic }); -impl<'gcx, T> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for ::middle::resolve_lifetime::Set1<T> - where T: HashStable<StableHashingContext<'gcx>> + where T: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use middle::resolve_lifetime::Set1; @@ -734,11 +778,11 @@ impl_stable_hash_for!(enum ty::cast::CastKind { impl_stable_hash_for!(tuple_struct ::middle::region::FirstStatementIndex { idx }); impl_stable_hash_for!(struct ::middle::region::Scope { id, code }); -impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for region::Scope { +impl<'a> ToStableHashKey<StableHashingContext<'a>> for region::Scope { type KeyType = region::Scope; #[inline] - fn to_stable_hash_key(&self, _: &StableHashingContext<'gcx>) -> region::Scope { + fn to_stable_hash_key(&self, _: &StableHashingContext<'a>) -> region::Scope { *self } } @@ -764,11 +808,11 @@ impl_stable_hash_for!(enum ty::BoundRegion { BrEnv }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::TypeVariants<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use ty::TypeVariants::*; @@ -865,11 +909,11 @@ impl_stable_hash_for!(struct ty::TypeAndMut<'tcx> { mutbl }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::ExistentialPredicate<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -902,9 +946,9 @@ impl_stable_hash_for!(struct ty::Instance<'tcx> { substs }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::InstanceDef<'gcx> { +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::InstanceDef<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); @@ -938,9 +982,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::InstanceDef<'gcx> { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::TraitDef { +impl<'a> HashStable<StableHashingContext<'a>> for ty::TraitDef { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ty::TraitDef { // We already have the def_path_hash below, no need to hash it twice @@ -968,9 +1012,9 @@ impl_stable_hash_for!(struct ty::DtorckConstraint<'tcx> { }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::CrateVariancesMap { +impl<'a> HashStable<StableHashingContext<'a>> for ty::CrateVariancesMap { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ty::CrateVariancesMap { ref variances, @@ -1004,12 +1048,12 @@ impl_stable_hash_for!(enum ty::AssociatedItemContainer { }); -impl<'gcx, T> HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for ty::steal::Steal<T> - where T: HashStable<StableHashingContext<'gcx>> + where T: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { self.borrow().hash_stable(hcx, hasher); } @@ -1032,10 +1076,10 @@ impl_stable_hash_for!(enum ::middle::privacy::AccessLevel { Public }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> +impl<'a> HashStable<StableHashingContext<'a>> for ::middle::privacy::AccessLevels { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { let ::middle::privacy::AccessLevels { @@ -1062,10 +1106,10 @@ impl_stable_hash_for!(tuple_struct ::middle::reachable::ReachableSet { reachable_set }); -impl<'gcx, N> HashStable<StableHashingContext<'gcx>> -for traits::Vtable<'gcx, N> where N: HashStable<StableHashingContext<'gcx>> { +impl<'a, 'gcx, N> HashStable<StableHashingContext<'a>> +for traits::Vtable<'gcx, N> where N: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use traits::Vtable::*; @@ -1084,10 +1128,10 @@ for traits::Vtable<'gcx, N> where N: HashStable<StableHashingContext<'gcx>> { } } -impl<'gcx, N> HashStable<StableHashingContext<'gcx>> -for traits::VtableImplData<'gcx, N> where N: HashStable<StableHashingContext<'gcx>> { +impl<'a, 'gcx, N> HashStable<StableHashingContext<'a>> +for traits::VtableImplData<'gcx, N> where N: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let traits::VtableImplData { impl_def_id, @@ -1100,10 +1144,10 @@ for traits::VtableImplData<'gcx, N> where N: HashStable<StableHashingContext<'gc } } -impl<'gcx, N> HashStable<StableHashingContext<'gcx>> -for traits::VtableAutoImplData<N> where N: HashStable<StableHashingContext<'gcx>> { +impl<'a, 'gcx, N> HashStable<StableHashingContext<'a>> +for traits::VtableAutoImplData<N> where N: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let traits::VtableAutoImplData { trait_def_id, @@ -1114,10 +1158,10 @@ for traits::VtableAutoImplData<N> where N: HashStable<StableHashingContext<'gcx> } } -impl<'gcx, N> HashStable<StableHashingContext<'gcx>> -for traits::VtableObjectData<'gcx, N> where N: HashStable<StableHashingContext<'gcx>> { +impl<'a, 'gcx, N> HashStable<StableHashingContext<'a>> +for traits::VtableObjectData<'gcx, N> where N: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let traits::VtableObjectData { upcast_trait_ref, @@ -1130,10 +1174,10 @@ for traits::VtableObjectData<'gcx, N> where N: HashStable<StableHashingContext<' } } -impl<'gcx, N> HashStable<StableHashingContext<'gcx>> -for traits::VtableBuiltinData<N> where N: HashStable<StableHashingContext<'gcx>> { +impl<'a, 'gcx, N> HashStable<StableHashingContext<'a>> +for traits::VtableBuiltinData<N> where N: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let traits::VtableBuiltinData { ref nested, @@ -1142,10 +1186,10 @@ for traits::VtableBuiltinData<N> where N: HashStable<StableHashingContext<'gcx>> } } -impl<'gcx, N> HashStable<StableHashingContext<'gcx>> -for traits::VtableClosureData<'gcx, N> where N: HashStable<StableHashingContext<'gcx>> { +impl<'a, 'gcx, N> HashStable<StableHashingContext<'a>> +for traits::VtableClosureData<'gcx, N> where N: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let traits::VtableClosureData { closure_def_id, @@ -1158,10 +1202,10 @@ for traits::VtableClosureData<'gcx, N> where N: HashStable<StableHashingContext< } } -impl<'gcx, N> HashStable<StableHashingContext<'gcx>> -for traits::VtableFnPointerData<'gcx, N> where N: HashStable<StableHashingContext<'gcx>> { +impl<'a, 'gcx, N> HashStable<StableHashingContext<'a>> +for traits::VtableFnPointerData<'gcx, N> where N: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let traits::VtableFnPointerData { fn_ty, @@ -1172,10 +1216,10 @@ for traits::VtableFnPointerData<'gcx, N> where N: HashStable<StableHashingContex } } -impl<'gcx, N> HashStable<StableHashingContext<'gcx>> -for traits::VtableGeneratorData<'gcx, N> where N: HashStable<StableHashingContext<'gcx>> { +impl<'a, 'gcx, N> HashStable<StableHashingContext<'a>> +for traits::VtableGeneratorData<'gcx, N> where N: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let traits::VtableGeneratorData { closure_def_id, diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index 909904b4fc3..8a899a35ecb 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -394,10 +394,10 @@ impl LintLevelMap { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for LintLevelMap { +impl<'a> HashStable<StableHashingContext<'a>> for LintLevelMap { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let LintLevelMap { ref sets, diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index f0285d6a937..9a394e52481 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<'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'tcx>> for $enum_name { + impl<'a, 'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>> for $enum_name { #[inline] fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self, - __ctx: &mut $crate::ich::StableHashingContext<'tcx>, + __ctx: &mut $crate::ich::StableHashingContext<'a>, __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) { 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<'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'tcx>> for $struct_name { + impl<'a, 'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>> for $struct_name { #[inline] fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self, - __ctx: &mut $crate::ich::StableHashingContext<'tcx>, + __ctx: &mut $crate::ich::StableHashingContext<'a>, __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) { let $struct_name { $(ref $field),* @@ -106,10 +106,10 @@ macro_rules! impl_stable_hash_for { } }; (tuple_struct $struct_name:path { $($field:ident),* }) => { - impl<'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'tcx>> for $struct_name { + impl<'a, 'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>> for $struct_name { #[inline] fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self, - __ctx: &mut $crate::ich::StableHashingContext<'tcx>, + __ctx: &mut $crate::ich::StableHashingContext<'a>, __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) { 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<'tcx> HashStable<StableHashingContext<'tcx>> for ::syntax::codemap::Spanned<$T> + impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ::syntax::codemap::Spanned<$T> { #[inline] fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'tcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { self.node.hash_stable(hcx, hasher); self.span.hash_stable(hcx, hasher); diff --git a/src/librustc/middle/borrowck.rs b/src/librustc/middle/borrowck.rs index 380f79361e2..6f5791ed5d7 100644 --- a/src/librustc/middle/borrowck.rs +++ b/src/librustc/middle/borrowck.rs @@ -20,9 +20,9 @@ pub struct BorrowCheckResult { pub used_mut_nodes: FxHashSet<HirId>, } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for BorrowCheckResult { +impl<'a> HashStable<StableHashingContext<'a>> for BorrowCheckResult { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let BorrowCheckResult { ref used_mut_nodes, diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 812ee0dc72f..c73930553cd 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -1488,9 +1488,9 @@ pub fn provide(providers: &mut Providers) { }; } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ScopeTree { +impl<'a> HashStable<StableHashingContext<'a>> for ScopeTree { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ScopeTree { root_body, diff --git a/src/librustc/mir/cache.rs b/src/librustc/mir/cache.rs index efc2f647cfd..45cb70d0070 100644 --- a/src/librustc/mir/cache.rs +++ b/src/librustc/mir/cache.rs @@ -35,9 +35,9 @@ impl serialize::Decodable for Cache { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for Cache { +impl<'a> HashStable<StableHashingContext<'a>> for Cache { fn hash_stable<W: StableHasherResult>(&self, - _: &mut StableHashingContext<'gcx>, + _: &mut StableHashingContext<'a>, _: &mut StableHasher<W>) { // do nothing } diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 394b3d96a4f..c395be549a3 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -200,6 +200,8 @@ pub struct UndefMask { len: u64, } +impl_stable_hash_for!(struct mir::interpret::UndefMask{blocks, len}); + impl UndefMask { pub fn new(size: u64) -> Self { let mut m = UndefMask { diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 9e9ba516203..8da3a125d3f 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1877,7 +1877,7 @@ fn fmt_const_val<W: Write>(fmt: &mut W, const_val: &ty::Const) -> fmt::Result { } } -fn print_miri_value<W: Write>(value: Value, ty: Ty, f: &mut W) -> fmt::Result { +pub fn print_miri_value<W: Write>(value: Value, ty: Ty, f: &mut W) -> fmt::Result { use ty::TypeVariants::*; use rustc_const_math::ConstFloat; match (value, &ty.sty) { diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index d8eac2b4159..d01059a3e01 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -41,9 +41,9 @@ impl<'tcx> MonoItem<'tcx> { } } -impl<'tcx> HashStable<StableHashingContext<'tcx>> for MonoItem<'tcx> { +impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for MonoItem<'tcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'tcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { ::std::mem::discriminant(self).hash_stable(hcx, hasher); @@ -171,9 +171,9 @@ impl<'tcx> CodegenUnit<'tcx> { } } -impl<'tcx> HashStable<StableHashingContext<'tcx>> for CodegenUnit<'tcx> { +impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for CodegenUnit<'tcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'tcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let CodegenUnit { ref items, diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 157614f847a..437369400ed 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -179,10 +179,10 @@ impl_stable_hash_for!(enum self::OutputType { DepInfo }); -impl<'tcx> ToStableHashKey<StableHashingContext<'tcx>> for OutputType { +impl<'a, 'tcx> ToStableHashKey<StableHashingContext<'a>> for OutputType { type KeyType = OutputType; #[inline] - fn to_stable_hash_key(&self, _: &StableHashingContext<'tcx>) -> Self::KeyType { + fn to_stable_hash_key(&self, _: &StableHashingContext<'a>) -> Self::KeyType { *self } } diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index dbf15ad1707..f8b895177f3 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -391,9 +391,9 @@ pub fn ancestors(tcx: TyCtxt, } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for Children { +impl<'a> HashStable<StableHashingContext<'a>> for Children { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let Children { ref nonblanket_impls, diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index bf75afcfa1a..3ec3f665db9 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -676,9 +676,9 @@ impl<'tcx> TypeckTables<'tcx> { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for TypeckTables<'gcx> { +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for TypeckTables<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ty::TypeckTables { local_id_root, @@ -1366,7 +1366,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.cstore.crate_data_as_rc_any(cnum) } - pub fn create_stable_hashing_context(self) -> StableHashingContext<'gcx> { + pub fn create_stable_hashing_context(self) -> StableHashingContext<'a> { let krate = self.dep_graph.with_ignore(|| self.gcx.hir.krate()); StableHashingContext::new(self.sess, diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index 97c259e6bf3..93d8a4d979d 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -154,12 +154,12 @@ impl<D: Copy + Debug + Ord + Eq + Hash> SimplifiedTypeGen<D> { } } -impl<'gcx, D> HashStable<StableHashingContext<'gcx>> for SimplifiedTypeGen<D> +impl<'a, 'gcx, D> HashStable<StableHashingContext<'a>> for SimplifiedTypeGen<D> where D: Copy + Debug + Ord + Eq + Hash + - HashStable<StableHashingContext<'gcx>>, + HashStable<StableHashingContext<'a>>, { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 35d8fb2a67a..79f01a32cd9 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -2369,9 +2369,9 @@ impl<'a, 'tcx> TyLayout<'tcx> { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for Variants { +impl<'a> HashStable<StableHashingContext<'a>> for Variants { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use ty::layout::Variants::*; mem::discriminant(self).hash_stable(hcx, hasher); @@ -2405,9 +2405,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for Variants { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for FieldPlacement { +impl<'a> HashStable<StableHashingContext<'a>> for FieldPlacement { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use ty::layout::FieldPlacement::*; mem::discriminant(self).hash_stable(hcx, hasher); @@ -2428,9 +2428,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for FieldPlacement { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for Abi { +impl<'a> HashStable<StableHashingContext<'a>> for Abi { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { use ty::layout::Abi::*; mem::discriminant(self).hash_stable(hcx, hasher); @@ -2455,9 +2455,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for Abi { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for Scalar { +impl<'a> HashStable<StableHashingContext<'a>> for Scalar { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let Scalar { value, valid_range: RangeInclusive { start, end } } = *self; value.hash_stable(hcx, hasher); @@ -2498,10 +2498,10 @@ impl_stable_hash_for!(struct ::ty::layout::Size { raw }); -impl<'gcx> HashStable<StableHashingContext<'gcx>> for LayoutError<'gcx> +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for LayoutError<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { 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 f9071cff78f..2c7ec5155a6 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -80,7 +80,7 @@ pub use self::binding::BindingMode; pub use self::binding::BindingMode::*; pub use self::context::{TyCtxt, GlobalArenas, AllArenas, tls, keep_local}; -pub use self::context::{Lift, TypeckTables}; +pub use self::context::{Lift, TypeckTables, InterpretInterner}; pub use self::instance::{Instance, InstanceDef}; @@ -529,9 +529,9 @@ impl<'tcx> TyS<'tcx> { } } -impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::TyS<'gcx> { +impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::TyS<'gcx> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ty::TyS { ref sty, @@ -1440,11 +1440,11 @@ impl<'tcx, T> ParamEnvAnd<'tcx, T> { } } -impl<'gcx, T> HashStable<StableHashingContext<'gcx>> for ParamEnvAnd<'gcx, T> - where T: HashStable<StableHashingContext<'gcx>> +impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for ParamEnvAnd<'gcx, T> + where T: HashStable<StableHashingContext<'a>> { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let ParamEnvAnd { ref param_env, @@ -1545,9 +1545,9 @@ impl<'tcx> serialize::UseSpecializedEncodable for &'tcx AdtDef { impl<'tcx> serialize::UseSpecializedDecodable for &'tcx AdtDef {} -impl<'gcx> HashStable<StableHashingContext<'gcx>> for AdtDef { +impl<'a> HashStable<StableHashingContext<'a>> for AdtDef { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { thread_local! { static CACHE: RefCell<FxHashMap<usize, Fingerprint>> = diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index 62d3c8dc87d..32f0d3384c4 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<'gcx> HashStable<StableHashingContext<'gcx>> for TraitImpls { +impl<'a> HashStable<StableHashingContext<'a>> for TraitImpls { fn hash_stable<W: StableHasherResult>(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { let TraitImpls { ref blanket_impls, |
