1
Fork 0

Make some region folders a little stricter.

Because certain regions cannot occur in them.
This commit is contained in:
Nicholas Nethercote 2023-04-26 10:14:16 +10:00
parent 458d4dae84
commit 8216b7f229
6 changed files with 27 additions and 23 deletions

View file

@ -3006,16 +3006,16 @@ fn bind_generator_hidden_types_above<'tcx>(
// Only remap erased regions if we use them.
if considering_regions {
ty = tcx.fold_regions(ty, |mut r, current_depth| {
if let ty::ReErased = r.kind() {
ty = tcx.fold_regions(ty, |r, current_depth| match r.kind() {
ty::ReErased => {
let br = ty::BoundRegion {
var: ty::BoundVar::from_u32(counter),
kind: ty::BrAnon(None),
};
counter += 1;
r = tcx.mk_re_late_bound(current_depth, br);
tcx.mk_re_late_bound(current_depth, br)
}
r
r => bug!("unexpected region: {r:?}"),
})
}