1
Fork 0

Add an optional Span to BrAnon and use it to print better error for HRTB error from generator interior

This commit is contained in:
Jack Huey 2022-10-17 22:08:15 -04:00
parent 1e1e5b8d98
commit 00e314d5ed
23 changed files with 251 additions and 63 deletions

View file

@ -218,7 +218,7 @@ impl<'tcx> SymbolMangler<'tcx> {
let lifetimes = regions
.into_iter()
.map(|br| match br {
ty::BrAnon(i) => i,
ty::BrAnon(i, _) => i,
_ => bug!("symbol_names: non-anonymized region `{:?}` in `{:?}`", br, value),
})
.max()
@ -335,7 +335,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
// Late-bound lifetimes use indices starting at 1,
// see `BinderLevel` for more details.
ty::ReLateBound(debruijn, ty::BoundRegion { kind: ty::BrAnon(i), .. }) => {
ty::ReLateBound(debruijn, ty::BoundRegion { kind: ty::BrAnon(i, _), .. }) => {
let binder = &self.binders[self.binders.len() - 1 - debruijn.index()];
let depth = binder.lifetime_depths.start + i;