Skip to content

Commit 439bf13

Browse files
Support more kinds of Regions in TypeIdHasher.
1 parent 8c4f2c6 commit 439bf13

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/librustc/ty/util.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -509,18 +509,19 @@ impl<'a, 'gcx, 'tcx, W> TypeVisitor<'tcx> for TypeIdHasher<'a, 'gcx, 'tcx, W>
509509
}
510510

511511
fn visit_region(&mut self, r: &'tcx ty::Region) -> bool {
512+
self.hash_discriminant_u8(r);
512513
match *r {
513-
ty::ReErased => {
514-
self.hash::<u32>(0);
515-
}
514+
ty::ReErased |
515+
ty::ReStatic |
516+
ty::ReEmpty => {}
516517
ty::ReLateBound(db, ty::BrAnon(i)) => {
517-
assert!(db.depth > 0);
518-
self.hash::<u32>(db.depth);
518+
self.hash(db.depth);
519519
self.hash(i);
520520
}
521-
ty::ReStatic |
522-
ty::ReEmpty |
523-
ty::ReEarlyBound(..) |
521+
ty::ReEarlyBound(ty::EarlyBoundRegion { index, name }) => {
522+
self.hash(index);
523+
self.hash(name.as_str());
524+
}
524525
ty::ReLateBound(..) |
525526
ty::ReFree(..) |
526527
ty::ReScope(..) |

0 commit comments

Comments
 (0)