1
Fork 0

Make anonymous binders start at 0

This commit is contained in:
Jack Huey 2020-10-29 18:42:31 -04:00
parent a53fb30e3b
commit 41ce397990
12 changed files with 24 additions and 32 deletions

View file

@ -684,7 +684,7 @@ impl<'tcx> TyCtxt<'tcx> {
}
/// Rewrite any late-bound regions so that they are anonymous. Region numbers are
/// assigned starting at 1 and increasing monotonically in the order traversed
/// assigned starting at 0 and increasing monotonically in the order traversed
/// by the fold operation.
///
/// The chief purpose of this function is to canonicalize regions so that two
@ -698,8 +698,9 @@ impl<'tcx> TyCtxt<'tcx> {
let mut counter = 0;
Binder::bind(
self.replace_late_bound_regions(sig, |_| {
let r = self.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(counter)));
counter += 1;
self.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(counter)))
r
})
.0,
)