mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-11 22:43:42 +00:00
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.
This commit is contained in:
parent
15c7e59c05
commit
08c8caa524
@ -229,6 +229,22 @@ pub(crate) fn type_check<'mir, 'tcx>(
|
||||
);
|
||||
}
|
||||
|
||||
// Convert all regions to nll vars.
|
||||
let (opaque_type_key, hidden_type) =
|
||||
infcx.tcx.fold_regions((opaque_type_key, hidden_type), |region, _| {
|
||||
match region.kind() {
|
||||
ty::ReVar(_) => region,
|
||||
ty::RePlaceholder(placeholder) => checker
|
||||
.borrowck_context
|
||||
.constraints
|
||||
.placeholder_region(infcx, placeholder),
|
||||
_ => ty::Region::new_var(
|
||||
infcx.tcx,
|
||||
checker.borrowck_context.universal_regions.to_region_vid(region),
|
||||
),
|
||||
}
|
||||
});
|
||||
|
||||
(opaque_type_key, hidden_type)
|
||||
})
|
||||
.collect();
|
||||
|
Loading…
Reference in New Issue
Block a user