1
Fork 0

Opportunistically resolve region var in canonicalizer

This commit is contained in:
Michael Goulet 2023-12-15 05:02:32 +00:00
parent 03515c6a22
commit 146e345d8b
7 changed files with 70 additions and 35 deletions

View file

@ -381,17 +381,13 @@ impl<'tcx> ty::InferCtxtLike for InferCtxt<'tcx> {
self.probe_ty_var(vid).ok()
}
fn root_lt_var(&self, vid: ty::RegionVid) -> ty::RegionVid {
self.root_region_var(vid)
}
fn probe_lt_var(&self, vid: ty::RegionVid) -> Option<ty::Region<'tcx>> {
fn opportunistic_resolve_lt_var(&self, vid: ty::RegionVid) -> Option<ty::Region<'tcx>> {
let re = self
.inner
.borrow_mut()
.unwrap_region_constraints()
.opportunistic_resolve_var(self.tcx, vid);
if re.is_var() { None } else { Some(re) }
if *re == ty::ReVar(vid) { None } else { Some(re) }
}
fn root_ct_var(&self, vid: ConstVid) -> ConstVid {
@ -1367,10 +1363,6 @@ impl<'tcx> InferCtxt<'tcx> {
self.inner.borrow_mut().type_variables().root_var(var)
}
pub fn root_region_var(&self, var: ty::RegionVid) -> ty::RegionVid {
self.inner.borrow_mut().unwrap_region_constraints().root_var(var)
}
pub fn root_const_var(&self, var: ty::ConstVid) -> ty::ConstVid {
self.inner.borrow_mut().const_unification_table().find(var).vid
}