Auto merge of #108020 - nnethercote:opt-mk_region, r=compiler-errors

Optimize `mk_region`

PR #107869 avoiding some interning under `mk_ty` by special-casing `Ty` variants with simple (integer) bodies. This PR does something similar for regions.

r? `@compiler-errors`
This commit is contained in:
bors
2023-02-16 16:11:54 +00:00
40 changed files with 254 additions and 186 deletions

View File

@@ -1093,7 +1093,7 @@ impl<'tcx> InferCtxt<'tcx> {
) -> ty::Region<'tcx> {
let region_var =
self.inner.borrow_mut().unwrap_region_constraints().new_region_var(universe, origin);
self.tcx.mk_region(ty::ReVar(region_var))
self.tcx.mk_re_var(region_var)
}
/// Return the universe that the region `r` was created in. For