Add specialized variants of mk_region
.
Much like there are specialized variants of `mk_ty`. This will enable some optimization in the next commit. Also rename the existing `re_error*` functions as `mk_re_error*`, for consistency.
This commit is contained in:
parent
7439028374
commit
cef9004f5a
39 changed files with 196 additions and 173 deletions
|
@ -180,20 +180,20 @@ trait TypeOpInfo<'tcx> {
|
|||
return;
|
||||
};
|
||||
|
||||
let placeholder_region = tcx.mk_region(ty::RePlaceholder(ty::Placeholder {
|
||||
let placeholder_region = tcx.mk_re_placeholder(ty::Placeholder {
|
||||
name: placeholder.name,
|
||||
universe: adjusted_universe.into(),
|
||||
}));
|
||||
});
|
||||
|
||||
let error_region =
|
||||
if let RegionElement::PlaceholderRegion(error_placeholder) = error_element {
|
||||
let adjusted_universe =
|
||||
error_placeholder.universe.as_u32().checked_sub(base_universe.as_u32());
|
||||
adjusted_universe.map(|adjusted| {
|
||||
tcx.mk_region(ty::RePlaceholder(ty::Placeholder {
|
||||
tcx.mk_re_placeholder(ty::Placeholder {
|
||||
name: error_placeholder.name,
|
||||
universe: adjusted.into(),
|
||||
}))
|
||||
})
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
@ -390,7 +390,7 @@ fn try_extract_error_from_fulfill_cx<'tcx>(
|
|||
error_region,
|
||||
®ion_constraints,
|
||||
|vid| ocx.infcx.region_var_origin(vid),
|
||||
|vid| ocx.infcx.universe_of_region(ocx.infcx.tcx.mk_region(ty::ReVar(vid))),
|
||||
|vid| ocx.infcx.universe_of_region(ocx.infcx.tcx.mk_re_var(vid)),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ fn try_extract_error_from_region_constraints<'tcx>(
|
|||
}
|
||||
// FIXME: Should this check the universe of the var?
|
||||
Constraint::VarSubReg(vid, sup) if sup == placeholder_region => {
|
||||
Some((infcx.tcx.mk_region(ty::ReVar(vid)), cause.clone()))
|
||||
Some((infcx.tcx.mk_re_var(vid), cause.clone()))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue