Remove reuse_or_mk_region
.
It's not used on any hot paths, and so has little perf benefit, and it interferes with the optimizations in the following commits.
This commit is contained in:
parent
6e0115778b
commit
7439028374
@ -363,7 +363,7 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
|
||||
opportunistically resolved to {:?}",
|
||||
vid, resolved_vid
|
||||
);
|
||||
let r = self.tcx.reuse_or_mk_region(r, ty::ReVar(resolved_vid));
|
||||
let r = self.tcx.mk_region(ty::ReVar(resolved_vid));
|
||||
self.canonicalize_mode.canonicalize_free_region(self, r)
|
||||
}
|
||||
|
||||
|
@ -651,7 +651,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
||||
let unified_region = self.unification_table().probe_value(rid);
|
||||
unified_region.0.unwrap_or_else(|| {
|
||||
let root = self.unification_table().find(rid).vid;
|
||||
tcx.reuse_or_mk_region(region, ty::ReVar(root))
|
||||
tcx.mk_region(ty::ReVar(root))
|
||||
})
|
||||
}
|
||||
_ => region,
|
||||
|
@ -95,7 +95,7 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for OpportunisticRegionResolver<'a, 'tcx
|
||||
.borrow_mut()
|
||||
.unwrap_region_constraints()
|
||||
.opportunistic_resolve_var(rid);
|
||||
TypeFolder::interner(self).reuse_or_mk_region(r, ty::ReVar(resolved))
|
||||
TypeFolder::interner(self).mk_region(ty::ReVar(resolved))
|
||||
}
|
||||
_ => r,
|
||||
}
|
||||
|
@ -1631,13 +1631,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Same a `self.mk_region(kind)`, but avoids accessing the interners if
|
||||
/// `*r == kind`.
|
||||
#[inline]
|
||||
pub fn reuse_or_mk_region(self, r: Region<'tcx>, kind: RegionKind<'tcx>) -> Region<'tcx> {
|
||||
if *r == kind { r } else { self.mk_region(kind) }
|
||||
}
|
||||
|
||||
// Avoid this in favour of more specific `mk_*` methods, where possible.
|
||||
#[allow(rustc::usage_of_ty_tykind)]
|
||||
#[inline]
|
||||
|
@ -234,7 +234,7 @@ where
|
||||
// debruijn index. Then we adjust it to the
|
||||
// correct depth.
|
||||
assert_eq!(debruijn1, ty::INNERMOST);
|
||||
self.tcx.reuse_or_mk_region(region, ty::ReLateBound(debruijn, br))
|
||||
self.tcx.mk_region(ty::ReLateBound(debruijn, br))
|
||||
} else {
|
||||
region
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user