1
Fork 0

Rename folder traits' tcx method to interner

This commit is contained in:
Alan Egerton 2023-02-11 09:18:12 +00:00
parent 459e142413
commit 63ad5d0522
No known key found for this signature in database
GPG key ID: 7D4C2F6C22122532
33 changed files with 91 additions and 87 deletions

View file

@ -327,7 +327,7 @@ struct Canonicalizer<'cx, 'tcx> {
}
impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
self.tcx
}
@ -738,7 +738,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
let var = self.canonical_var(info, r.into());
let br = ty::BoundRegion { var, kind: ty::BrAnon(var.as_u32(), None) };
let region = ty::ReLateBound(self.binder_index, br);
self.tcx().mk_region(region)
self.interner().mk_region(region)
}
/// Given a type variable `ty_var` of the given kind, first check
@ -752,7 +752,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
self.fold_ty(bound_to)
} else {
let var = self.canonical_var(info, ty_var.into());
self.tcx().mk_bound(self.binder_index, var.into())
self.interner().mk_bound(self.binder_index, var.into())
}
}
@ -771,7 +771,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
self.fold_const(bound_to)
} else {
let var = self.canonical_var(info, const_var.into());
self.tcx().mk_const(
self.interner().mk_const(
ty::ConstKind::Bound(self.binder_index, var),
self.fold_ty(const_var.ty()),
)

View file

@ -847,7 +847,7 @@ struct ConstInferUnifier<'cx, 'tcx> {
impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ConstInferUnifier<'_, 'tcx> {
type Error = TypeError<'tcx>;
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -875,7 +875,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ConstInferUnifier<'_, 'tcx> {
.borrow_mut()
.type_variables()
.new_var(self.for_universe, origin);
Ok(self.tcx().mk_ty_var(new_var_id))
Ok(self.interner().mk_ty_var(new_var_id))
}
}
}
@ -953,7 +953,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ConstInferUnifier<'_, 'tcx> {
},
},
);
Ok(self.tcx().mk_const(new_var_id, c.ty()))
Ok(self.interner().mk_const(new_var_id, c.ty()))
}
}
}

View file

@ -106,7 +106,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
}
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -124,13 +124,13 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
| ty::ReError(_)
| ty::ReErased => {
// replace all free regions with 'erased
self.tcx().lifetimes.re_erased
self.interner().lifetimes.re_erased
}
ty::ReStatic => {
if self.keep_static {
r
} else {
self.tcx().lifetimes.re_erased
self.interner().lifetimes.re_erased
}
}
}

View file

@ -176,7 +176,7 @@ pub struct InferenceFudger<'a, 'tcx> {
}
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for InferenceFudger<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -1853,7 +1853,7 @@ struct InferenceLiteralEraser<'tcx> {
}
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for InferenceLiteralEraser<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
self.tcx
}
@ -1871,7 +1871,7 @@ struct ShallowResolver<'a, 'tcx> {
}
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for ShallowResolver<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -2065,7 +2065,7 @@ fn replace_param_and_infer_substs_with_placeholder<'tcx>(
}
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReplaceParamAndInferWithPlaceholder<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
self.tcx
}

View file

@ -32,8 +32,8 @@ impl<'a, 'tcx> OpportunisticVarResolver<'a, 'tcx> {
}
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for OpportunisticVarResolver<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
TypeFolder::tcx(&self.shallow_resolver)
fn interner(&self) -> TyCtxt<'tcx> {
TypeFolder::interner(&self.shallow_resolver)
}
#[inline]
@ -74,7 +74,7 @@ impl<'a, 'tcx> OpportunisticRegionResolver<'a, 'tcx> {
}
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for OpportunisticRegionResolver<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -95,7 +95,7 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for OpportunisticRegionResolver<'a, 'tcx
.borrow_mut()
.unwrap_region_constraints()
.opportunistic_resolve_var(rid);
TypeFolder::tcx(self).reuse_or_mk_region(r, ty::ReVar(resolved))
TypeFolder::interner(self).reuse_or_mk_region(r, ty::ReVar(resolved))
}
_ => r,
}
@ -214,7 +214,7 @@ struct FullTypeResolver<'a, 'tcx> {
impl<'a, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for FullTypeResolver<'a, 'tcx> {
type Error = FixupError<'tcx>;
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}