Skip to content

Commit

Permalink
Support more kinds of Regions in TypeIdHasher.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Mar 22, 2017
1 parent 8c4f2c6 commit 439bf13
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/librustc/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..) |
Expand Down

0 comments on commit 439bf13

Please sign in to comment.