Support more kinds of Regions in TypeIdHasher.

This commit is contained in:
Michael Woerister 2017-03-20 15:24:30 +01:00
parent 8c4f2c64c6
commit 439bf132d9
1 changed files with 9 additions and 8 deletions

View File

@ -509,18 +509,19 @@ impl<'a, 'gcx, 'tcx, W> TypeVisitor<'tcx> for TypeIdHasher<'a, 'gcx, 'tcx, W>
} }
fn visit_region(&mut self, r: &'tcx ty::Region) -> bool { fn visit_region(&mut self, r: &'tcx ty::Region) -> bool {
self.hash_discriminant_u8(r);
match *r { match *r {
ty::ReErased => { ty::ReErased |
self.hash::<u32>(0); ty::ReStatic |
} ty::ReEmpty => {}
ty::ReLateBound(db, ty::BrAnon(i)) => { ty::ReLateBound(db, ty::BrAnon(i)) => {
assert!(db.depth > 0); self.hash(db.depth);
self.hash::<u32>(db.depth);
self.hash(i); self.hash(i);
} }
ty::ReStatic | ty::ReEarlyBound(ty::EarlyBoundRegion { index, name }) => {
ty::ReEmpty | self.hash(index);
ty::ReEarlyBound(..) | self.hash(name.as_str());
}
ty::ReLateBound(..) | ty::ReLateBound(..) |
ty::ReFree(..) | ty::ReFree(..) |
ty::ReScope(..) | ty::ReScope(..) |