diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2018-01-16 10:16:38 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2018-03-08 08:34:08 +0100 |
| commit | 7d2d4e320294d69f6fff3002200b7ea8809b95d1 (patch) | |
| tree | 9fb7eb37c4977c528d2b38d0bb5cc6dc27f4c81b /src/librustc/ich/impls_syntax.rs | |
| parent | e0045ab8915c85e35dd04e9f9d00d6d011237bfa (diff) | |
| download | rust-7d2d4e320294d69f6fff3002200b7ea8809b95d1.tar.gz rust-7d2d4e320294d69f6fff3002200b7ea8809b95d1.zip | |
Add InterpretInterner to StableHashingContext for AllocId serialization
Diffstat (limited to 'src/librustc/ich/impls_syntax.rs')
| -rw-r--r-- | src/librustc/ich/impls_syntax.rs | 48 |
1 files changed, 25 insertions, 23 deletions
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 |
