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 {
self.hash_discriminant_u8(r);
match *r {
ty::ReErased => {
self.hash::<u32>(0);
}
ty::ReErased |
ty::ReStatic |
ty::ReEmpty => {}
ty::ReLateBound(db, ty::BrAnon(i)) => {
assert!(db.depth > 0);
self.hash::<u32>(db.depth);
self.hash(db.depth);
self.hash(i);
}
ty::ReStatic |
ty::ReEmpty |
ty::ReEarlyBound(..) |
ty::ReEarlyBound(ty::EarlyBoundRegion { index, name }) => {
self.hash(index);
self.hash(name.as_str());
}
ty::ReLateBound(..) |
ty::ReFree(..) |
ty::ReScope(..) |