1
Fork 0

Rollup merge of #78545 - jackh726:anonymous, r=oli-obk

Make anonymous binders start at 0

A few changes to some test outputs, but these actually look *more* correct to me.
This commit is contained in:
Yuki Okushi 2020-10-30 18:00:56 +09:00 committed by GitHub
commit 05f80f03a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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,
)