about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/diagnostics
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-16 16:11:54 +0000
committerbors <bors@rust-lang.org>2023-02-16 16:11:54 +0000
commitc5d1b3ea9665e77e3af2f17b311bf65469eedc19 (patch)
tree86493d29ad1fbfdf42869d9c848c8b4336f42360 /compiler/rustc_borrowck/src/diagnostics
parentaf3c8b27266e290cf65704284f6862d0f90ee4fc (diff)
parent9a53cee8681348a7ba46158a4e80d36b1b9789d8 (diff)
downloadrust-c5d1b3ea9665e77e3af2f17b311bf65469eedc19.tar.gz
rust-c5d1b3ea9665e77e3af2f17b311bf65469eedc19.zip
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`
Diffstat (limited to 'compiler/rustc_borrowck/src/diagnostics')
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
index 1550958ab8e..d51cc652bfd 100644
--- a/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
@@ -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,
         &region_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,
             }