Make anonymous binders start at 0
This commit is contained in:
parent
a53fb30e3b
commit
41ce397990
12 changed files with 24 additions and 32 deletions
|
@ -200,15 +200,9 @@ impl SymbolMangler<'tcx> {
|
|||
|
||||
let lifetimes = regions
|
||||
.into_iter()
|
||||
.map(|br| {
|
||||
match br {
|
||||
ty::BrAnon(i) => {
|
||||
// FIXME(eddyb) for some reason, `anonymize_late_bound_regions` starts at `1`.
|
||||
assert_ne!(i, 0);
|
||||
i - 1
|
||||
}
|
||||
_ => bug!("symbol_names: non-anonymized region `{:?}` in `{:?}`", br, value),
|
||||
}
|
||||
.map(|br| match br {
|
||||
ty::BrAnon(i) => i,
|
||||
_ => bug!("symbol_names: non-anonymized region `{:?}` in `{:?}`", br, value),
|
||||
})
|
||||
.max()
|
||||
.map_or(0, |max| max + 1);
|
||||
|
@ -327,10 +321,6 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
|
|||
// Late-bound lifetimes use indices starting at 1,
|
||||
// see `BinderLevel` for more details.
|
||||
ty::ReLateBound(debruijn, ty::BrAnon(i)) => {
|
||||
// FIXME(eddyb) for some reason, `anonymize_late_bound_regions` starts at `1`.
|
||||
assert_ne!(i, 0);
|
||||
let i = i - 1;
|
||||
|
||||
let binder = &self.binders[self.binders.len() - 1 - debruijn.index()];
|
||||
let depth = binder.lifetime_depths.start + i;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue