0000: 2f 2f 21 20 54 68 69 73 20 6d 6f 64 75 6c 65 20 //! This module
0010: 63 6f 6e 74 61 69 6e 73 20 60 48 61 73 68 53 74 contains `HashSt
0020: 61 62 6c 65 60 20 69 6d 70 6c 65 6d 65 6e 74 61 able` implementa
0030: 74 69 6f 6e 73 20 66 6f 72 20 76 61 72 69 6f 75 tions for variou
0040: 73 20 64 61 74 61 20 74 79 70 65 73 0a 2f 2f 21 s data types.//!
0050: 20 66 72 6f 6d 20 72 75 73 74 63 3a 3a 74 79 20 from rustc::ty
0060: 69 6e 20 6e 6f 20 70 61 72 74 69 63 75 6c 61 72 in no particular
0070: 20 6f 72 64 65 72 2e 0a 0a 75 73 65 20 63 72 61 order...use cra
0080: 74 65 3a 3a 69 63 68 3a 3a 7b 46 69 6e 67 65 72 te::ich::{Finger
0090: 70 72 69 6e 74 2c 20 53 74 61 62 6c 65 48 61 73 print, StableHas
00a0: 68 69 6e 67 43 6f 6e 74 65 78 74 2c 20 4e 6f 64 hingContext, Nod
00b0: 65 49 64 48 61 73 68 69 6e 67 4d 6f 64 65 7d 3b eIdHashingMode};
00c0: 0a 75 73 65 20 72 75 73 74 63 5f 64 61 74 61 5f .use rustc_data_
00d0: 73 74 72 75 63 74 75 72 65 73 3a 3a 66 78 3a 3a structures::fx::
00e0: 46 78 48 61 73 68 4d 61 70 3b 0a 75 73 65 20 72 FxHashMap;.use r
00f0: 75 73 74 63 5f 64 61 74 61 5f 73 74 72 75 63 74 ustc_data_struct
0100: 75 72 65 73 3a 3a 73 74 61 62 6c 65 5f 68 61 73 ures::stable_has
0110: 68 65 72 3a 3a 7b 48 61 73 68 53 74 61 62 6c 65 her::{HashStable
0120: 2c 20 54 6f 53 74 61 62 6c 65 48 61 73 68 4b 65 , ToStableHashKe
0130: 79 2c 20 53 74 61 62 6c 65 48 61 73 68 65 72 7d y, StableHasher}
0140: 3b 0a 75 73 65 20 73 74 64 3a 3a 63 65 6c 6c 3a ;.use std::cell:
0150: 3a 52 65 66 43 65 6c 6c 3b 0a 75 73 65 20 73 74 :RefCell;.use st
0160: 64 3a 3a 6d 65 6d 3b 0a 75 73 65 20 63 72 61 74 d::mem;.use crat
0170: 65 3a 3a 6d 69 64 64 6c 65 3a 3a 72 65 67 69 6f e::middle::regio
0180: 6e 3b 0a 75 73 65 20 63 72 61 74 65 3a 3a 74 79 n;.use crate::ty
0190: 3b 0a 75 73 65 20 63 72 61 74 65 3a 3a 6d 69 72 ;.use crate::mir
01a0: 3b 0a 0a 69 6d 70 6c 3c 27 61 2c 20 27 74 63 78 ;..impl<'a, 'tcx
01b0: 2c 20 54 3e 20 48 61 73 68 53 74 61 62 6c 65 3c , T> HashStable<
01c0: 53 74 61 62 6c 65 48 61 73 68 69 6e 67 43 6f 6e StableHashingCon
01d0: 74 65 78 74 3c 27 61 3e 3e 20 66 6f 72 20 26 27 text<'a>> for &'
01e0: 74 63 78 20 74 79 3a 3a 4c 69 73 74 3c 54 3e 0a tcx ty::List<T>.
01f0: 77 68 65 72 65 0a 20 20 20 20 54 3a 20 48 61 73 where. T: Has
0200: 68 53 74 61 62 6c 65 3c 53 74 61 62 6c 65 48 61 hStable<StableHa
0210: 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e shingContext<'a>
0220: 3e 2c 0a 7b 0a 20 20 20 20 66 6e 20 68 61 73 68 >,.{. fn hash
0230: 5f 73 74 61 62 6c 65 28 26 73 65 6c 66 2c 20 68 _stable(&self, h
0240: 63 78 3a 20 26 6d 75 74 20 53 74 61 62 6c 65 48 cx: &mut StableH
0250: 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 ashingContext<'a
0260: 3e 2c 20 68 61 73 68 65 72 3a 20 26 6d 75 74 20 >, hasher: &mut
0270: 53 74 61 62 6c 65 48 61 73 68 65 72 29 20 7b 0a StableHasher) {.
0280: 20 20 20 20 20 20 20 20 74 68 72 65 61 64 5f 6c thread_l
0290: 6f 63 61 6c 21 20 7b 0a 20 20 20 20 20 20 20 20 ocal! {.
02a0: 20 20 20 20 73 74 61 74 69 63 20 43 41 43 48 45 static CACHE
02b0: 3a 20 52 65 66 43 65 6c 6c 3c 46 78 48 61 73 68 : RefCell<FxHash
02c0: 4d 61 70 3c 28 75 73 69 7a 65 2c 20 75 73 69 7a Map<(usize, usiz
02d0: 65 29 2c 20 46 69 6e 67 65 72 70 72 69 6e 74 3e e), Fingerprint>
02e0: 3e 20 3d 0a 20 20 20 20 20 20 20 20 20 20 20 20 > =.
02f0: 20 20 20 20 52 65 66 43 65 6c 6c 3a 3a 6e 65 77 RefCell::new
0300: 28 44 65 66 61 75 6c 74 3a 3a 64 65 66 61 75 6c (Default::defaul
0310: 74 28 29 29 3b 0a 20 20 20 20 20 20 20 20 7d 0a t());. }.
0320: 0a 20 20 20 20 20 20 20 20 6c 65 74 20 68 61 73 . let has
0330: 68 20 3d 20 43 41 43 48 45 2e 77 69 74 68 28 7c h = CACHE.with(|
0340: 63 61 63 68 65 7c 20 7b 0a 20 20 20 20 20 20 20 cache| {.
0350: 20 20 20 20 20 6c 65 74 20 6b 65 79 20 3d 20 28 let key = (
0360: 73 65 6c 66 2e 61 73 5f 70 74 72 28 29 20 61 73 self.as_ptr() as
0370: 20 75 73 69 7a 65 2c 20 73 65 6c 66 2e 6c 65 6e usize, self.len
0380: 28 29 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 ());.
0390: 20 69 66 20 6c 65 74 20 53 6f 6d 65 28 26 68 61 if let Some(&ha
03a0: 73 68 29 20 3d 20 63 61 63 68 65 2e 62 6f 72 72 sh) = cache.borr
03b0: 6f 77 28 29 2e 67 65 74 28 26 6b 65 79 29 20 7b ow().get(&key) {
03c0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
03d0: 20 72 65 74 75 72 6e 20 68 61 73 68 3b 0a 20 20 return hash;.
03e0: 20 20 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 }..
03f0: 20 20 20 20 20 20 20 20 20 6c 65 74 20 6d 75 74 let mut
0400: 20 68 61 73 68 65 72 20 3d 20 53 74 61 62 6c 65 hasher = Stable
0410: 48 61 73 68 65 72 3a 3a 6e 65 77 28 29 3b 0a 20 Hasher::new();.
0420: 20 20 20 20 20 20 20 20 20 20 20 28 26 73 65 6c (&sel
0430: 66 5b 2e 2e 5d 29 2e 68 61 73 68 5f 73 74 61 62 f[..]).hash_stab
0440: 6c 65 28 68 63 78 2c 20 26 6d 75 74 20 68 61 73 le(hcx, &mut has
0450: 68 65 72 29 3b 0a 0a 20 20 20 20 20 20 20 20 20 her);..
0460: 20 20 20 6c 65 74 20 68 61 73 68 3a 20 46 69 6e let hash: Fin
0470: 67 65 72 70 72 69 6e 74 20 3d 20 68 61 73 68 65 gerprint = hashe
0480: 72 2e 66 69 6e 69 73 68 28 29 3b 0a 20 20 20 20 r.finish();.
0490: 20 20 20 20 20 20 20 20 63 61 63 68 65 2e 62 6f cache.bo
04a0: 72 72 6f 77 5f 6d 75 74 28 29 2e 69 6e 73 65 72 rrow_mut().inser
04b0: 74 28 6b 65 79 2c 20 68 61 73 68 29 3b 0a 20 20 t(key, hash);.
04c0: 20 20 20 20 20 20 20 20 20 20 68 61 73 68 0a 20 hash.
04d0: 20 20 20 20 20 20 20 7d 29 3b 0a 0a 20 20 20 20 });..
04e0: 20 20 20 20 68 61 73 68 2e 68 61 73 68 5f 73 74 hash.hash_st
04f0: 61 62 6c 65 28 68 63 78 2c 20 68 61 73 68 65 72 able(hcx, hasher
0500: 29 3b 0a 20 20 20 20 7d 0a 7d 0a 0a 69 6d 70 6c );. }.}..impl
0510: 3c 27 61 2c 20 27 74 63 78 2c 20 54 3e 20 54 6f <'a, 'tcx, T> To
0520: 53 74 61 62 6c 65 48 61 73 68 4b 65 79 3c 53 74 StableHashKey<St
0530: 61 62 6c 65 48 61 73 68 69 6e 67 43 6f 6e 74 65 ableHashingConte
0540: 78 74 3c 27 61 3e 3e 20 66 6f 72 20 26 27 74 63 xt<'a>> for &'tc
0550: 78 20 74 79 3a 3a 4c 69 73 74 3c 54 3e 0a 77 68 x ty::List<T>.wh
0560: 65 72 65 0a 20 20 20 20 54 3a 20 48 61 73 68 53 ere. T: HashS
0570: 74 61 62 6c 65 3c 53 74 61 62 6c 65 48 61 73 68 table<StableHash
0580: 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e 3e 2c ingContext<'a>>,
0590: 0a 7b 0a 20 20 20 20 74 79 70 65 20 4b 65 79 54 .{. type KeyT
05a0: 79 70 65 20 3d 20 46 69 6e 67 65 72 70 72 69 6e ype = Fingerprin
05b0: 74 3b 0a 0a 20 20 20 20 23 5b 69 6e 6c 69 6e 65 t;.. #[inline
05c0: 5d 0a 20 20 20 20 66 6e 20 74 6f 5f 73 74 61 62 ]. fn to_stab
05d0: 6c 65 5f 68 61 73 68 5f 6b 65 79 28 26 73 65 6c le_hash_key(&sel
05e0: 66 2c 20 68 63 78 3a 20 26 53 74 61 62 6c 65 48 f, hcx: &StableH
05f0: 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 ashingContext<'a
0600: 3e 29 20 2d 3e 20 46 69 6e 67 65 72 70 72 69 6e >) -> Fingerprin
0610: 74 20 7b 0a 20 20 20 20 20 20 20 20 6c 65 74 20 t {. let
0620: 6d 75 74 20 68 61 73 68 65 72 20 3d 20 53 74 61 mut hasher = Sta
0630: 62 6c 65 48 61 73 68 65 72 3a 3a 6e 65 77 28 29 bleHasher::new()
0640: 3b 0a 20 20 20 20 20 20 20 20 6c 65 74 20 6d 75 ;. let mu
0650: 74 20 68 63 78 3a 20 53 74 61 62 6c 65 48 61 73 t hcx: StableHas
0660: 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e 20 hingContext<'a>
0670: 3d 20 68 63 78 2e 63 6c 6f 6e 65 28 29 3b 0a 20 = hcx.clone();.
0680: 20 20 20 20 20 20 20 73 65 6c 66 2e 68 61 73 68 self.hash
0690: 5f 73 74 61 62 6c 65 28 26 6d 75 74 20 68 63 78 _stable(&mut hcx
06a0: 2c 20 26 6d 75 74 20 68 61 73 68 65 72 29 3b 0a , &mut hasher);.
06b0: 20 20 20 20 20 20 20 20 68 61 73 68 65 72 2e 66 hasher.f
06c0: 69 6e 69 73 68 28 29 0a 20 20 20 20 7d 0a 7d 0a inish(). }.}.
06d0: 0a 69 6d 70 6c 3c 27 61 2c 20 27 74 63 78 3e 20 .impl<'a, 'tcx>
06e0: 48 61 73 68 53 74 61 62 6c 65 3c 53 74 61 62 6c HashStable<Stabl
06f0: 65 48 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c eHashingContext<
0700: 27 61 3e 3e 20 66 6f 72 20 74 79 3a 3a 73 75 62 'a>> for ty::sub
0710: 73 74 3a 3a 47 65 6e 65 72 69 63 41 72 67 3c 27 st::GenericArg<'
0720: 74 63 78 3e 20 7b 0a 20 20 20 20 66 6e 20 68 61 tcx> {. fn ha
0730: 73 68 5f 73 74 61 62 6c 65 28 26 73 65 6c 66 2c sh_stable(&self,
0740: 20 68 63 78 3a 20 26 6d 75 74 20 53 74 61 62 6c hcx: &mut Stabl
0750: 65 48 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c eHashingContext<
0760: 27 61 3e 2c 20 68 61 73 68 65 72 3a 20 26 6d 75 'a>, hasher: &mu
0770: 74 20 53 74 61 62 6c 65 48 61 73 68 65 72 29 20 t StableHasher)
0780: 7b 0a 20 20 20 20 20 20 20 20 73 65 6c 66 2e 75 {. self.u
0790: 6e 70 61 63 6b 28 29 2e 68 61 73 68 5f 73 74 61 npack().hash_sta
07a0: 62 6c 65 28 68 63 78 2c 20 68 61 73 68 65 72 29 ble(hcx, hasher)
07b0: 3b 0a 20 20 20 20 7d 0a 7d 0a 0a 69 6d 70 6c 3c ;. }.}..impl<
07c0: 27 61 3e 20 48 61 73 68 53 74 61 62 6c 65 3c 53 'a> HashStable<S
07d0: 74 61 62 6c 65 48 61 73 68 69 6e 67 43 6f 6e 74 tableHashingCont
07e0: 65 78 74 3c 27 61 3e 3e 0a 66 6f 72 20 74 79 3a ext<'a>>.for ty:
07f0: 3a 52 65 67 69 6f 6e 4b 69 6e 64 20 7b 0a 20 20 :RegionKind {.
0800: 20 20 66 6e 20 68 61 73 68 5f 73 74 61 62 6c 65 fn hash_stable
0810: 28 26 73 65 6c 66 2c 20 68 63 78 3a 20 26 6d 75 (&self, hcx: &mu
0820: 74 20 53 74 61 62 6c 65 48 61 73 68 69 6e 67 43 t StableHashingC
0830: 6f 6e 74 65 78 74 3c 27 61 3e 2c 20 68 61 73 68 ontext<'a>, hash
0840: 65 72 3a 20 26 6d 75 74 20 53 74 61 62 6c 65 48 er: &mut StableH
0850: 61 73 68 65 72 29 20 7b 0a 20 20 20 20 20 20 20 asher) {.
0860: 20 6d 65 6d 3a 3a 64 69 73 63 72 69 6d 69 6e 61 mem::discrimina
0870: 6e 74 28 73 65 6c 66 29 2e 68 61 73 68 5f 73 74 nt(self).hash_st
0880: 61 62 6c 65 28 68 63 78 2c 20 68 61 73 68 65 72 able(hcx, hasher
0890: 29 3b 0a 20 20 20 20 20 20 20 20 6d 61 74 63 68 );. match
08a0: 20 2a 73 65 6c 66 20 7b 0a 20 20 20 20 20 20 20 *self {.
08b0: 20 20 20 20 20 74 79 3a 3a 52 65 45 72 61 73 65 ty::ReErase
08c0: 64 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 d |.
08d0: 74 79 3a 3a 52 65 53 74 61 74 69 63 20 7c 0a 20 ty::ReStatic |.
08e0: 20 20 20 20 20 20 20 20 20 20 20 74 79 3a 3a 52 ty::R
08f0: 65 45 6d 70 74 79 20 3d 3e 20 7b 0a 20 20 20 20 eEmpty => {.
0900: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e // N
0910: 6f 20 76 61 72 69 61 6e 74 20 66 69 65 6c 64 73 o variant fields
0920: 20 74 6f 20 68 61 73 68 20 66 6f 72 20 74 68 65 to hash for the
0930: 73 65 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 se ....
0940: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 }.
0950: 20 74 79 3a 3a 52 65 4c 61 74 65 42 6f 75 6e 64 ty::ReLateBound
0960: 28 64 62 2c 20 74 79 3a 3a 42 72 41 6e 6f 6e 28 (db, ty::BrAnon(
0970: 69 29 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 i)) => {.
0980: 20 20 20 20 20 20 20 20 20 64 62 2e 68 61 73 68 db.hash
0990: 5f 73 74 61 62 6c 65 28 68 63 78 2c 20 68 61 73 _stable(hcx, has
09a0: 68 65 72 29 3b 0a 20 20 20 20 20 20 20 20 20 20 her);.
09b0: 20 20 20 20 20 20 69 2e 68 61 73 68 5f 73 74 61 i.hash_sta
09c0: 62 6c 65 28 68 63 78 2c 20 68 61 73 68 65 72 29 ble(hcx, hasher)
09d0: 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a ;. }.
09e0: 20 20 20 20 20 20 20 20 20 20 20 20 74 79 3a 3a ty::
09f0: 52 65 4c 61 74 65 42 6f 75 6e 64 28 64 62 2c 20 ReLateBound(db,
0a00: 74 79 3a 3a 42 72 4e 61 6d 65 64 28 64 65 66 5f ty::BrNamed(def_
0a10: 69 64 2c 20 6e 61 6d 65 29 29 20 3d 3e 20 7b 0a id, name)) => {.
0a20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0a30: 64 62 2e 68 61 73 68 5f 73 74 61 62 6c 65 28 68 db.hash_stable(h
0a40: 63 78 2c 20 68 61 73 68 65 72 29 3b 0a 20 20 20 cx, hasher);.
0a50: 20 20 20 20 20 20 20 20 20 20 20 20 20 64 65 66 def
0a60: 5f 69 64 2e 68 61 73 68 5f 73 74 61 62 6c 65 28 _id.hash_stable(
0a70: 68 63 78 2c 20 68 61 73 68 65 72 29 3b 0a 20 20 hcx, hasher);.
0a80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 61 na
0a90: 6d 65 2e 68 61 73 68 5f 73 74 61 62 6c 65 28 68 me.hash_stable(h
0aa0: 63 78 2c 20 68 61 73 68 65 72 29 3b 0a 20 20 20 cx, hasher);.
0ab0: 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 }.
0ac0: 20 20 20 20 20 20 20 74 79 3a 3a 52 65 4c 61 74 ty::ReLat
0ad0: 65 42 6f 75 6e 64 28 64 62 2c 20 74 79 3a 3a 42 eBound(db, ty::B
0ae0: 72 45 6e 76 29 20 3d 3e 20 7b 0a 20 20 20 20 20 rEnv) => {.
0af0: 20 20 20 20 20 20 20 20 20 20 20 64 62 2e 68 61 db.ha
0b00: 73 68 5f 73 74 61 62 6c 65 28 68 63 78 2c 20 68 sh_stable(hcx, h
0b10: 61 73 68 65 72 29 3b 0a 20 20 20 20 20 20 20 20 asher);.
0b20: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 }.
0b30: 20 20 74 79 3a 3a 52 65 45 61 72 6c 79 42 6f 75 ty::ReEarlyBou
0b40: 6e 64 28 74 79 3a 3a 45 61 72 6c 79 42 6f 75 6e nd(ty::EarlyBoun
0b50: 64 52 65 67 69 6f 6e 20 7b 20 64 65 66 5f 69 64 dRegion { def_id
0b60: 2c 20 69 6e 64 65 78 2c 20 6e 61 6d 65 20 7d 29 , index, name })
0b70: 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 20 20 => {.
0b80: 20 20 20 20 20 20 64 65 66 5f 69 64 2e 68 61 73 def_id.has
0b90: 68 5f 73 74 61 62 6c 65 28 68 63 78 2c 20 68 61 h_stable(hcx, ha
0ba0: 73 68 65 72 29 3b 0a 20 20 20 20 20 20 20 20 20 sher);.
0bb0: 20 20 20 20 20 20 20 69 6e 64 65 78 2e 68 61 73 index.has
0bc0: 68 5f 73 74 61 62 6c 65 28 68 63 78 2c 20 68 61 h_stable(hcx, ha
0bd0: 73 68 65 72 29 3b 0a 20 20 20 20 20 20 20 20 20 sher);.
0be0: 20 20 20 20 20 20 20 6e 61 6d 65 2e 68 61 73 68 name.hash
0bf0: 5f 73 74 61 62 6c 65 28 68 63 78 2c 20 68 61 73 _stable(hcx, has
0c00: 68 65 72 29 3b 0a 20 20 20 20 20 20 20 20 20 20 her);.
0c10: 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }.
0c20: 74 79 3a 3a 52 65 53 63 6f 70 65 28 73 63 6f 70 ty::ReScope(scop
0c30: 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 e) => {.
0c40: 20 20 20 20 20 20 20 20 73 63 6f 70 65 2e 68 61 scope.ha
0c50: 73 68 5f 73 74 61 62 6c 65 28 68 63 78 2c 20 68 sh_stable(hcx, h
0c60: 61 73 68 65 72 29 3b 0a 20 20 20 20 20 20 20 20 asher);.
0c70: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 }.
0c80: 20 20 74 79 3a 3a 52 65 46 72 65 65 28 72 65 66 ty::ReFree(ref
0c90: 20 66 72 65 65 5f 72 65 67 69 6f 6e 29 20 3d 3e free_region) =>
0ca0: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {.
0cb0: 20 20 20 66 72 65 65 5f 72 65 67 69 6f 6e 2e 68 free_region.h
0cc0: 61 73 68 5f 73 74 61 62 6c 65 28 68 63 78 2c 20 ash_stable(hcx,
0cd0: 68 61 73 68 65 72 29 3b 0a 20 20 20 20 20 20 20 hasher);.
0ce0: 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 }.
0cf0: 20 20 20 74 79 3a 3a 52 65 43 6c 6f 73 75 72 65 ty::ReClosure
0d00: 42 6f 75 6e 64 28 76 69 64 29 20 3d 3e 20 7b 0a Bound(vid) => {.
0d10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0d20: 76 69 64 2e 68 61 73 68 5f 73 74 61 62 6c 65 28 vid.hash_stable(
0d30: 68 63 78 2c 20 68 61 73 68 65 72 29 3b 0a 20 20 hcx, hasher);.
0d40: 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 }.
0d50: 20 20 20 20 20 20 20 20 74 79 3a 3a 52 65 56 61 ty::ReVa
0d60: 72 28 2e 2e 29 20 7c 0a 20 20 20 20 20 20 20 20 r(..) |.
0d70: 20 20 20 20 74 79 3a 3a 52 65 50 6c 61 63 65 68 ty::RePlaceh
0d80: 6f 6c 64 65 72 28 2e 2e 29 20 3d 3e 20 7b 0a 20 older(..) => {.
0d90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 b
0da0: 75 67 21 28 22 53 74 61 62 6c 65 48 61 73 68 65 ug!("StableHashe
0db0: 72 3a 20 75 6e 65 78 70 65 63 74 65 64 20 72 65 r: unexpected re
0dc0: 67 69 6f 6e 20 7b 3a 3f 7d 22 2c 20 2a 73 65 6c gion {:?}", *sel
0dd0: 66 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d f). }
0de0: 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 7d . }. }
0df0: 0a 7d 0a 0a 69 6d 70 6c 3c 27 61 3e 20 48 61 73 .}..impl<'a> Has
0e00: 68 53 74 61 62 6c 65 3c 53 74 61 62 6c 65 48 61 hStable<StableHa
0e10: 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e shingContext<'a>
0e20: 3e 20 66 6f 72 20 74 79 3a 3a 52 65 67 69 6f 6e > for ty::Region
0e30: 56 69 64 20 7b 0a 20 20 20 20 23 5b 69 6e 6c 69 Vid {. #[inli
0e40: 6e 65 5d 0a 20 20 20 20 66 6e 20 68 61 73 68 5f ne]. fn hash_
0e50: 73 74 61 62 6c 65 28 26 73 65 6c 66 2c 20 68 63 stable(&self, hc
0e60: 78 3a 20 26 6d 75 74 20 53 74 61 62 6c 65 48 61 x: &mut StableHa
0e70: 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e shingContext<'a>
0e80: 2c 20 68 61 73 68 65 72 3a 20 26 6d 75 74 20 53 , hasher: &mut S
0e90: 74 61 62 6c 65 48 61 73 68 65 72 29 20 7b 0a 20 tableHasher) {.
0ea0: 20 20 20 20 20 20 20 73 65 6c 66 2e 69 6e 64 65 self.inde
0eb0: 78 28 29 2e 68 61 73 68 5f 73 74 61 62 6c 65 28 x().hash_stable(
0ec0: 68 63 78 2c 20 68 61 73 68 65 72 29 3b 0a 20 20 hcx, hasher);.
0ed0: 20 20 7d 0a 7d 0a 0a 69 6d 70 6c 3c 27 61 2c 20 }.}..impl<'a,
0ee0: 27 74 63 78 3e 20 48 61 73 68 53 74 61 62 6c 65 'tcx> HashStable
0ef0: 3c 53 74 61 62 6c 65 48 61 73 68 69 6e 67 43 6f <StableHashingCo
0f00: 6e 74 65 78 74 3c 27 61 3e 3e 20 66 6f 72 20 74 ntext<'a>> for t
0f10: 79 3a 3a 43 6f 6e 73 74 56 69 64 3c 27 74 63 78 y::ConstVid<'tcx
0f20: 3e 20 7b 0a 20 20 20 20 23 5b 69 6e 6c 69 6e 65 > {. #[inline
0f30: 5d 0a 20 20 20 20 66 6e 20 68 61 73 68 5f 73 74 ]. fn hash_st
0f40: 61 62 6c 65 28 26 73 65 6c 66 2c 20 68 63 78 3a able(&self, hcx:
0f50: 20 26 6d 75 74 20 53 74 61 62 6c 65 48 61 73 68 &mut StableHash
0f60: 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e 2c 20 ingContext<'a>,
0f70: 68 61 73 68 65 72 3a 20 26 6d 75 74 20 53 74 61 hasher: &mut Sta
0f80: 62 6c 65 48 61 73 68 65 72 29 20 7b 0a 20 20 20 bleHasher) {.
0f90: 20 20 20 20 20 73 65 6c 66 2e 69 6e 64 65 78 2e self.index.
0fa0: 68 61 73 68 5f 73 74 61 62 6c 65 28 68 63 78 2c hash_stable(hcx,
0fb0: 20 68 61 73 68 65 72 29 3b 0a 20 20 20 20 7d 0a hasher);. }.
0fc0: 7d 0a 0a 69 6d 70 6c 3c 27 74 63 78 3e 20 48 61 }..impl<'tcx> Ha
0fd0: 73 68 53 74 61 62 6c 65 3c 53 74 61 62 6c 65 48 shStable<StableH
0fe0: 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 74 ashingContext<'t
0ff0: 63 78 3e 3e 20 66 6f 72 20 74 79 3a 3a 42 6f 75 cx>> for ty::Bou
1000: 6e 64 56 61 72 20 7b 0a 20 20 20 20 23 5b 69 6e ndVar {. #[in
1010: 6c 69 6e 65 5d 0a 20 20 20 20 66 6e 20 68 61 73 line]. fn has
1020: 68 5f 73 74 61 62 6c 65 28 26 73 65 6c 66 2c 20 h_stable(&self,
1030: 68 63 78 3a 20 26 6d 75 74 20 53 74 61 62 6c 65 hcx: &mut Stable
1040: 48 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 HashingContext<'
1050: 74 63 78 3e 2c 20 68 61 73 68 65 72 3a 20 26 6d tcx>, hasher: &m
1060: 75 74 20 53 74 61 62 6c 65 48 61 73 68 65 72 29 ut StableHasher)
1070: 20 7b 0a 20 20 20 20 20 20 20 20 73 65 6c 66 2e {. self.
1080: 69 6e 64 65 78 28 29 2e 68 61 73 68 5f 73 74 61 index().hash_sta
1090: 62 6c 65 28 68 63 78 2c 20 68 61 73 68 65 72 29 ble(hcx, hasher)
10a0: 3b 0a 20 20 20 20 7d 0a 7d 0a 0a 69 6d 70 6c 3c ;. }.}..impl<
10b0: 27 61 2c 20 54 3e 20 48 61 73 68 53 74 61 62 6c 'a, T> HashStabl
10c0: 65 3c 53 74 61 62 6c 65 48 61 73 68 69 6e 67 43 e<StableHashingC
10d0: 6f 6e 74 65 78 74 3c 27 61 3e 3e 20 66 6f 72 20 ontext<'a>> for
10e0: 74 79 3a 3a 42 69 6e 64 65 72 3c 54 3e 0a 77 68 ty::Binder<T>.wh
10f0: 65 72 65 0a 20 20 20 20 54 3a 20 48 61 73 68 53 ere. T: HashS
1100: 74 61 62 6c 65 3c 53 74 61 62 6c 65 48 61 73 68 table<StableHash
1110: 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e 3e 2c ingContext<'a>>,
1120: 0a 7b 0a 20 20 20 20 66 6e 20 68 61 73 68 5f 73 .{. fn hash_s
1130: 74 61 62 6c 65 28 26 73 65 6c 66 2c 20 68 63 78 table(&self, hcx
1140: 3a 20 26 6d 75 74 20 53 74 61 62 6c 65 48 61 73 : &mut StableHas
1150: 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e 2c hingContext<'a>,
1160: 20 68 61 73 68 65 72 3a 20 26 6d 75 74 20 53 74 hasher: &mut St
1170: 61 62 6c 65 48 61 73 68 65 72 29 20 7b 0a 20 20 ableHasher) {.
1180: 20 20 20 20 20 20 73 65 6c 66 2e 73 6b 69 70 5f self.skip_
1190: 62 69 6e 64 65 72 28 29 2e 68 61 73 68 5f 73 74 binder().hash_st
11a0: 61 62 6c 65 28 68 63 78 2c 20 68 61 73 68 65 72 able(hcx, hasher
11b0: 29 3b 0a 20 20 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 );. }.}..// A
11c0: 6c 6c 6f 63 49 64 73 20 67 65 74 20 72 65 73 6f llocIds get reso
11d0: 6c 76 65 64 20 74 6f 20 77 68 61 74 65 76 65 72 lved to whatever
11e0: 20 74 68 65 79 20 70 6f 69 6e 74 20 74 6f 20 28 they point to (
11f0: 74 6f 20 62 65 20 73 74 61 62 6c 65 29 0a 69 6d to be stable).im
1200: 70 6c 3c 27 61 3e 20 48 61 73 68 53 74 61 62 6c pl<'a> HashStabl
1210: 65 3c 53 74 61 62 6c 65 48 61 73 68 69 6e 67 43 e<StableHashingC
1220: 6f 6e 74 65 78 74 3c 27 61 3e 3e 20 66 6f 72 20 ontext<'a>> for
1230: 6d 69 72 3a 3a 69 6e 74 65 72 70 72 65 74 3a 3a mir::interpret::
1240: 41 6c 6c 6f 63 49 64 20 7b 0a 20 20 20 20 66 6e AllocId {. fn
1250: 20 68 61 73 68 5f 73 74 61 62 6c 65 28 26 73 65 hash_stable(&se
1260: 6c 66 2c 20 68 63 78 3a 20 26 6d 75 74 20 53 74 lf, hcx: &mut St
1270: 61 62 6c 65 48 61 73 68 69 6e 67 43 6f 6e 74 65 ableHashingConte
1280: 78 74 3c 27 61 3e 2c 20 68 61 73 68 65 72 3a 20 xt<'a>, hasher:
1290: 26 6d 75 74 20 53 74 61 62 6c 65 48 61 73 68 65 &mut StableHashe
12a0: 72 29 20 7b 0a 20 20 20 20 20 20 20 20 74 79 3a r) {. ty:
12b0: 3a 74 6c 73 3a 3a 77 69 74 68 5f 6f 70 74 28 7c :tls::with_opt(|
12c0: 74 63 78 7c 20 7b 0a 20 20 20 20 20 20 20 20 20 tcx| {.
12d0: 20 20 20 74 72 61 63 65 21 28 22 68 61 73 68 69 trace!("hashi
12e0: 6e 67 20 7b 3a 3f 7d 22 2c 20 2a 73 65 6c 66 29 ng {:?}", *self)
12f0: 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c 65 ;. le
1300: 74 20 74 63 78 20 3d 20 74 63 78 2e 65 78 70 65 t tcx = tcx.expe
1310: 63 74 28 22 63 61 6e 27 74 20 68 61 73 68 20 41 ct("can't hash A
1320: 6c 6c 6f 63 49 64 73 20 64 75 72 69 6e 67 20 68 llocIds during h
1330: 69 72 20 6c 6f 77 65 72 69 6e 67 22 29 3b 0a 20 ir lowering");.
1340: 20 20 20 20 20 20 20 20 20 20 20 6c 65 74 20 61 let a
1350: 6c 6c 6f 63 5f 6b 69 6e 64 20 3d 20 74 63 78 2e lloc_kind = tcx.
1360: 61 6c 6c 6f 63 5f 6d 61 70 2e 6c 6f 63 6b 28 29 alloc_map.lock()
1370: 2e 67 65 74 28 2a 73 65 6c 66 29 3b 0a 20 20 20 .get(*self);.
1380: 20 20 20 20 20 20 20 20 20 61 6c 6c 6f 63 5f 6b alloc_k
1390: 69 6e 64 2e 68 61 73 68 5f 73 74 61 62 6c 65 28 ind.hash_stable(
13a0: 68 63 78 2c 20 68 61 73 68 65 72 29 3b 0a 20 20 hcx, hasher);.
13b0: 20 20 20 20 20 20 7d 29 3b 0a 20 20 20 20 7d 0a });. }.
13c0: 7d 0a 0a 2f 2f 20 60 52 65 6c 6f 63 61 74 69 6f }..// `Relocatio
13d0: 6e 73 60 20 77 69 74 68 20 64 65 66 61 75 6c 74 ns` with default
13e0: 20 74 79 70 65 20 70 61 72 61 6d 65 74 65 72 73 type parameters
13f0: 20 69 73 20 61 20 73 6f 72 74 65 64 20 6d 61 70 is a sorted map
1400: 2e 0a 69 6d 70 6c 3c 27 61 2c 20 54 61 67 3e 20 ..impl<'a, Tag>
1410: 48 61 73 68 53 74 61 62 6c 65 3c 53 74 61 62 6c HashStable<Stabl
1420: 65 48 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c eHashingContext<
1430: 27 61 3e 3e 0a 66 6f 72 20 6d 69 72 3a 3a 69 6e 'a>>.for mir::in
1440: 74 65 72 70 72 65 74 3a 3a 52 65 6c 6f 63 61 74 terpret::Relocat
1450: 69 6f 6e 73 3c 54 61 67 3e 0a 77 68 65 72 65 0a ions<Tag>.where.
1460: 20 20 20 20 54 61 67 3a 20 48 61 73 68 53 74 61 Tag: HashSta
1470: 62 6c 65 3c 53 74 61 62 6c 65 48 61 73 68 69 6e ble<StableHashin
1480: 67 43 6f 6e 74 65 78 74 3c 27 61 3e 3e 2c 0a 7b gContext<'a>>,.{
1490: 0a 20 20 20 20 66 6e 20 68 61 73 68 5f 73 74 61 . fn hash_sta
14a0: 62 6c 65 28 26 73 65 6c 66 2c 20 68 63 78 3a 20 ble(&self, hcx:
14b0: 26 6d 75 74 20 53 74 61 62 6c 65 48 61 73 68 69 &mut StableHashi
14c0: 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e 2c 20 68 ngContext<'a>, h
14d0: 61 73 68 65 72 3a 20 26 6d 75 74 20 53 74 61 62 asher: &mut Stab
14e0: 6c 65 48 61 73 68 65 72 29 20 7b 0a 20 20 20 20 leHasher) {.
14f0: 20 20 20 20 73 65 6c 66 2e 6c 65 6e 28 29 2e 68 self.len().h
1500: 61 73 68 5f 73 74 61 62 6c 65 28 68 63 78 2c 20 ash_stable(hcx,
1510: 68 61 73 68 65 72 29 3b 0a 20 20 20 20 20 20 20 hasher);.
1520: 20 66 6f 72 20 72 65 6c 6f 63 20 69 6e 20 73 65 for reloc in se
1530: 6c 66 2e 69 74 65 72 28 29 20 7b 0a 20 20 20 20 lf.iter() {.
1540: 20 20 20 20 20 20 20 20 72 65 6c 6f 63 2e 68 61 reloc.ha
1550: 73 68 5f 73 74 61 62 6c 65 28 68 63 78 2c 20 68 sh_stable(hcx, h
1560: 61 73 68 65 72 29 3b 0a 20 20 20 20 20 20 20 20 asher);.
1570: 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 69 6d 70 6c 3c }. }.}..impl<
1580: 27 61 3e 20 54 6f 53 74 61 62 6c 65 48 61 73 68 'a> ToStableHash
1590: 4b 65 79 3c 53 74 61 62 6c 65 48 61 73 68 69 6e Key<StableHashin
15a0: 67 43 6f 6e 74 65 78 74 3c 27 61 3e 3e 20 66 6f gContext<'a>> fo
15b0: 72 20 72 65 67 69 6f 6e 3a 3a 53 63 6f 70 65 20 r region::Scope
15c0: 7b 0a 20 20 20 20 74 79 70 65 20 4b 65 79 54 79 {. type KeyTy
15d0: 70 65 20 3d 20 72 65 67 69 6f 6e 3a 3a 53 63 6f pe = region::Sco
15e0: 70 65 3b 0a 0a 20 20 20 20 23 5b 69 6e 6c 69 6e pe;.. #[inlin
15f0: 65 5d 0a 20 20 20 20 66 6e 20 74 6f 5f 73 74 61 e]. fn to_sta
1600: 62 6c 65 5f 68 61 73 68 5f 6b 65 79 28 26 73 65 ble_hash_key(&se
1610: 6c 66 2c 20 5f 3a 20 26 53 74 61 62 6c 65 48 61 lf, _: &StableHa
1620: 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e shingContext<'a>
1630: 29 20 2d 3e 20 72 65 67 69 6f 6e 3a 3a 53 63 6f ) -> region::Sco
1640: 70 65 20 7b 0a 20 20 20 20 20 20 20 20 2a 73 65 pe {. *se
1650: 6c 66 0a 20 20 20 20 7d 0a 7d 0a 0a 69 6d 70 6c lf. }.}..impl
1660: 3c 27 61 3e 20 48 61 73 68 53 74 61 62 6c 65 3c <'a> HashStable<
1670: 53 74 61 62 6c 65 48 61 73 68 69 6e 67 43 6f 6e StableHashingCon
1680: 74 65 78 74 3c 27 61 3e 3e 20 66 6f 72 20 74 79 text<'a>> for ty
1690: 3a 3a 54 79 56 69 64 20 7b 0a 20 20 20 20 66 6e ::TyVid {. fn
16a0: 20 68 61 73 68 5f 73 74 61 62 6c 65 28 26 73 65 hash_stable(&se
16b0: 6c 66 2c 20 5f 68 63 78 3a 20 26 6d 75 74 20 53 lf, _hcx: &mut S
16c0: 74 61 62 6c 65 48 61 73 68 69 6e 67 43 6f 6e 74 tableHashingCont
16d0: 65 78 74 3c 27 61 3e 2c 20 5f 68 61 73 68 65 72 ext<'a>, _hasher
16e0: 3a 20 26 6d 75 74 20 53 74 61 62 6c 65 48 61 73 : &mut StableHas
16f0: 68 65 72 29 20 7b 0a 20 20 20 20 20 20 20 20 2f her) {. /
1700: 2f 20 60 54 79 56 69 64 60 20 76 61 6c 75 65 73 / `TyVid` values
1710: 20 61 72 65 20 63 6f 6e 66 69 6e 65 64 20 74 6f are confined to
1720: 20 61 6e 20 69 6e 66 65 72 65 6e 63 65 20 63 6f an inference co
1730: 6e 74 65 78 74 20 61 6e 64 20 68 65 6e 63 65 0a ntext and hence.
1740: 20 20 20 20 20 20 20 20 2f 2f 20 73 68 6f 75 6c // shoul
1750: 64 20 6e 6f 74 20 62 65 20 68 61 73 68 65 64 2e d not be hashed.
1760: 0a 20 20 20 20 20 20 20 20 62 75 67 21 28 22 74 . bug!("t
1770: 79 3a 3a 54 79 4b 69 6e 64 3a 3a 68 61 73 68 5f y::TyKind::hash_
1780: 73 74 61 62 6c 65 28 29 20 2d 20 63 61 6e 27 74 stable() - can't
1790: 20 68 61 73 68 20 61 20 54 79 56 69 64 20 7b 3a hash a TyVid {:
17a0: 3f 7d 2e 22 2c 20 2a 73 65 6c 66 29 0a 20 20 20 ?}.", *self).
17b0: 20 7d 0a 7d 0a 0a 69 6d 70 6c 3c 27 61 3e 20 48 }.}..impl<'a> H
17c0: 61 73 68 53 74 61 62 6c 65 3c 53 74 61 62 6c 65 ashStable<Stable
17d0: 48 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 HashingContext<'
17e0: 61 3e 3e 20 66 6f 72 20 74 79 3a 3a 49 6e 74 56 a>> for ty::IntV
17f0: 69 64 20 7b 0a 20 20 20 20 66 6e 20 68 61 73 68 id {. fn hash
1800: 5f 73 74 61 62 6c 65 28 26 73 65 6c 66 2c 20 5f _stable(&self, _
1810: 68 63 78 3a 20 26 6d 75 74 20 53 74 61 62 6c 65 hcx: &mut Stable
1820: 48 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 HashingContext<'
1830: 61 3e 2c 20 5f 68 61 73 68 65 72 3a 20 26 6d 75 a>, _hasher: &mu
1840: 74 20 53 74 61 62 6c 65 48 61 73 68 65 72 29 20 t StableHasher)
1850: 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 60 49 6e {. // `In
1860: 74 56 69 64 60 20 76 61 6c 75 65 73 20 61 72 65 tVid` values are
1870: 20 63 6f 6e 66 69 6e 65 64 20 74 6f 20 61 6e 20 confined to an
1880: 69 6e 66 65 72 65 6e 63 65 20 63 6f 6e 74 65 78 inference contex
1890: 74 20 61 6e 64 20 68 65 6e 63 65 0a 20 20 20 20 t and hence.
18a0: 20 20 20 20 2f 2f 20 73 68 6f 75 6c 64 20 6e 6f // should no
18b0: 74 20 62 65 20 68 61 73 68 65 64 2e 0a 20 20 20 t be hashed..
18c0: 20 20 20 20 20 62 75 67 21 28 22 74 79 3a 3a 54 bug!("ty::T
18d0: 79 4b 69 6e 64 3a 3a 68 61 73 68 5f 73 74 61 62 yKind::hash_stab
18e0: 6c 65 28 29 20 2d 20 63 61 6e 27 74 20 68 61 73 le() - can't has
18f0: 68 20 61 6e 20 49 6e 74 56 69 64 20 7b 3a 3f 7d h an IntVid {:?}
1900: 2e 22 2c 20 2a 73 65 6c 66 29 0a 20 20 20 20 7d .", *self). }
1910: 0a 7d 0a 0a 69 6d 70 6c 3c 27 61 3e 20 48 61 73 .}..impl<'a> Has
1920: 68 53 74 61 62 6c 65 3c 53 74 61 62 6c 65 48 61 hStable<StableHa
1930: 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e shingContext<'a>
1940: 3e 20 66 6f 72 20 74 79 3a 3a 46 6c 6f 61 74 56 > for ty::FloatV
1950: 69 64 20 7b 0a 20 20 20 20 66 6e 20 68 61 73 68 id {. fn hash
1960: 5f 73 74 61 62 6c 65 28 26 73 65 6c 66 2c 20 5f _stable(&self, _
1970: 68 63 78 3a 20 26 6d 75 74 20 53 74 61 62 6c 65 hcx: &mut Stable
1980: 48 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 HashingContext<'
1990: 61 3e 2c 20 5f 68 61 73 68 65 72 3a 20 26 6d 75 a>, _hasher: &mu
19a0: 74 20 53 74 61 62 6c 65 48 61 73 68 65 72 29 20 t StableHasher)
19b0: 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 60 46 6c {. // `Fl
19c0: 6f 61 74 56 69 64 60 20 76 61 6c 75 65 73 20 61 oatVid` values a
19d0: 72 65 20 63 6f 6e 66 69 6e 65 64 20 74 6f 20 61 re confined to a
19e0: 6e 20 69 6e 66 65 72 65 6e 63 65 20 63 6f 6e 74 n inference cont
19f0: 65 78 74 20 61 6e 64 20 68 65 6e 63 65 0a 20 20 ext and hence.
1a00: 20 20 20 20 20 20 2f 2f 20 73 68 6f 75 6c 64 20 // should
1a10: 6e 6f 74 20 62 65 20 68 61 73 68 65 64 2e 0a 20 not be hashed..
1a20: 20 20 20 20 20 20 20 62 75 67 21 28 22 74 79 3a bug!("ty:
1a30: 3a 54 79 4b 69 6e 64 3a 3a 68 61 73 68 5f 73 74 :TyKind::hash_st
1a40: 61 62 6c 65 28 29 20 2d 20 63 61 6e 27 74 20 68 able() - can't h
1a50: 61 73 68 20 61 20 46 6c 6f 61 74 56 69 64 20 7b ash a FloatVid {
1a60: 3a 3f 7d 2e 22 2c 20 2a 73 65 6c 66 29 0a 20 20 :?}.", *self).
1a70: 20 20 7d 0a 7d 0a 0a 69 6d 70 6c 3c 27 61 2c 20 }.}..impl<'a,
1a80: 54 3e 20 48 61 73 68 53 74 61 62 6c 65 3c 53 74 T> HashStable<St
1a90: 61 62 6c 65 48 61 73 68 69 6e 67 43 6f 6e 74 65 ableHashingConte
1aa0: 78 74 3c 27 61 3e 3e 20 66 6f 72 20 74 79 3a 3a xt<'a>> for ty::
1ab0: 73 74 65 61 6c 3a 3a 53 74 65 61 6c 3c 54 3e 0a steal::Steal<T>.
1ac0: 77 68 65 72 65 0a 20 20 20 20 54 3a 20 48 61 73 where. T: Has
1ad0: 68 53 74 61 62 6c 65 3c 53 74 61 62 6c 65 48 61 hStable<StableHa
1ae0: 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e shingContext<'a>
1af0: 3e 2c 0a 7b 0a 20 20 20 20 66 6e 20 68 61 73 68 >,.{. fn hash
1b00: 5f 73 74 61 62 6c 65 28 26 73 65 6c 66 2c 20 68 _stable(&self, h
1b10: 63 78 3a 20 26 6d 75 74 20 53 74 61 62 6c 65 48 cx: &mut StableH
1b20: 61 73 68 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 ashingContext<'a
1b30: 3e 2c 20 68 61 73 68 65 72 3a 20 26 6d 75 74 20 >, hasher: &mut
1b40: 53 74 61 62 6c 65 48 61 73 68 65 72 29 20 7b 0a StableHasher) {.
1b50: 20 20 20 20 20 20 20 20 73 65 6c 66 2e 62 6f 72 self.bor
1b60: 72 6f 77 28 29 2e 68 61 73 68 5f 73 74 61 62 6c row().hash_stabl
1b70: 65 28 68 63 78 2c 20 68 61 73 68 65 72 29 3b 0a e(hcx, hasher);.
1b80: 20 20 20 20 7d 0a 7d 0a 0a 69 6d 70 6c 3c 27 61 }.}..impl<'a
1b90: 3e 20 48 61 73 68 53 74 61 62 6c 65 3c 53 74 61 > HashStable<Sta
1ba0: 62 6c 65 48 61 73 68 69 6e 67 43 6f 6e 74 65 78 bleHashingContex
1bb0: 74 3c 27 61 3e 3e 0a 66 6f 72 20 63 72 61 74 65 t<'a>>.for crate
1bc0: 3a 3a 6d 69 64 64 6c 65 3a 3a 70 72 69 76 61 63 ::middle::privac
1bd0: 79 3a 3a 41 63 63 65 73 73 4c 65 76 65 6c 73 20 y::AccessLevels
1be0: 7b 0a 20 20 20 20 66 6e 20 68 61 73 68 5f 73 74 {. fn hash_st
1bf0: 61 62 6c 65 28 26 73 65 6c 66 2c 20 68 63 78 3a able(&self, hcx:
1c00: 20 26 6d 75 74 20 53 74 61 62 6c 65 48 61 73 68 &mut StableHash
1c10: 69 6e 67 43 6f 6e 74 65 78 74 3c 27 61 3e 2c 20 ingContext<'a>,
1c20: 68 61 73 68 65 72 3a 20 26 6d 75 74 20 53 74 61 hasher: &mut Sta
1c30: 62 6c 65 48 61 73 68 65 72 29 20 7b 0a 20 20 20 bleHasher) {.
1c40: 20 20 20 20 20 68 63 78 2e 77 69 74 68 5f 6e 6f hcx.with_no
1c50: 64 65 5f 69 64 5f 68 61 73 68 69 6e 67 5f 6d 6f de_id_hashing_mo
1c60: 64 65 28 4e 6f 64 65 49 64 48 61 73 68 69 6e 67 de(NodeIdHashing
1c70: 4d 6f 64 65 3a 3a 48 61 73 68 44 65 66 50 61 74 Mode::HashDefPat
1c80: 68 2c 20 7c 68 63 78 7c 20 7b 0a 20 20 20 20 20 h, |hcx| {.
1c90: 20 20 20 20 20 20 20 6c 65 74 20 63 72 61 74 65 let crate
1ca0: 3a 3a 6d 69 64 64 6c 65 3a 3a 70 72 69 76 61 63 ::middle::privac
1cb0: 79 3a 3a 41 63 63 65 73 73 4c 65 76 65 6c 73 20 y::AccessLevels
1cc0: 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 {.
1cd0: 20 20 72 65 66 20 6d 61 70 0a 20 20 20 20 20 20 ref map.
1ce0: 20 20 20 20 20 20 7d 20 3d 20 2a 73 65 6c 66 3b } = *self;
1cf0: 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 6d 61 .. ma
1d00: 70 2e 68 61 73 68 5f 73 74 61 62 6c 65 28 68 63 p.hash_stable(hc
1d10: 78 2c 20 68 61 73 68 65 72 29 3b 0a 20 20 20 20 x, hasher);.
1d20: 20 20 20 20 7d 29 3b 0a 20 20 20 20 7d 0a 7d 0a });. }.}.