Skip to content

Commit 08c8caa

Browse files
committed
convert all named regions in opaque types to nll vars
Do it in typeck before entering region inference routines particularly because we will no longer be able to convert placeholders.
1 parent 15c7e59 commit 08c8caa

File tree

1 file changed

+16
-0
lines changed
  • compiler/rustc_borrowck/src/type_check

1 file changed

+16
-0
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,22 @@ pub(crate) fn type_check<'mir, 'tcx>(
229229
);
230230
}
231231

232+
// Convert all regions to nll vars.
233+
let (opaque_type_key, hidden_type) =
234+
infcx.tcx.fold_regions((opaque_type_key, hidden_type), |region, _| {
235+
match region.kind() {
236+
ty::ReVar(_) => region,
237+
ty::RePlaceholder(placeholder) => checker
238+
.borrowck_context
239+
.constraints
240+
.placeholder_region(infcx, placeholder),
241+
_ => ty::Region::new_var(
242+
infcx.tcx,
243+
checker.borrowck_context.universal_regions.to_region_vid(region),
244+
),
245+
}
246+
});
247+
232248
(opaque_type_key, hidden_type)
233249
})
234250
.collect();

0 commit comments

Comments
 (0)