Skip to content

Commit 63ad5d0

Browse files
committed
Rename folder traits' tcx method to interner
1 parent 459e142 commit 63ad5d0

File tree

33 files changed

+91
-87
lines changed

33 files changed

+91
-87
lines changed

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ struct RemapLateBound<'a, 'tcx> {
465465
}
466466

467467
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RemapLateBound<'_, 'tcx> {
468-
fn tcx(&self) -> TyCtxt<'tcx> {
468+
fn interner(&self) -> TyCtxt<'tcx> {
469469
self.tcx
470470
}
471471

@@ -830,13 +830,13 @@ impl<'a, 'tcx> ImplTraitInTraitCollector<'a, 'tcx> {
830830
}
831831

832832
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'_, 'tcx> {
833-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
833+
fn interner(&self) -> TyCtxt<'tcx> {
834834
self.ocx.infcx.tcx
835835
}
836836

837837
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
838838
if let ty::Alias(ty::Projection, proj) = ty.kind()
839-
&& self.tcx().def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder
839+
&& self.interner().def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder
840840
{
841841
if let Some((ty, _)) = self.types.get(&proj.def_id) {
842842
return *ty;
@@ -852,7 +852,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'_, 'tcx> {
852852
});
853853
self.types.insert(proj.def_id, (infer_ty, proj.substs));
854854
// Recurse into bounds
855-
for (pred, pred_span) in self.tcx().bound_explicit_item_bounds(proj.def_id).subst_iter_copied(self.tcx(), proj.substs) {
855+
for (pred, pred_span) in self.interner().bound_explicit_item_bounds(proj.def_id).subst_iter_copied(self.interner(), proj.substs) {
856856
let pred = pred.fold_with(self);
857857
let pred = self.ocx.normalize(
858858
&ObligationCause::misc(self.span, self.body_id),
@@ -861,7 +861,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'_, 'tcx> {
861861
);
862862

863863
self.ocx.register_obligation(traits::Obligation::new(
864-
self.tcx(),
864+
self.interner(),
865865
ObligationCause::new(
866866
self.span,
867867
self.body_id,

compiler/rustc_hir_analysis/src/collect/type_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ fn infer_placeholder_type<'a>(
851851
}
852852

853853
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for MakeNameable<'tcx> {
854-
fn tcx(&self) -> TyCtxt<'tcx> {
854+
fn interner(&self) -> TyCtxt<'tcx> {
855855
self.tcx
856856
}
857857

compiler/rustc_hir_analysis/src/hir_wf_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ struct EraseAllBoundRegions<'tcx> {
190190
// lead to unsoundness (we call `delay_span_bug` at the start
191191
// of `diagnostic_hir_wf_check`).
192192
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for EraseAllBoundRegions<'tcx> {
193-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
193+
fn interner(&self) -> TyCtxt<'tcx> {
194194
self.tcx
195195
}
196196
fn fold_region(&mut self, r: Region<'tcx>) -> Region<'tcx> {

compiler/rustc_hir_typeck/src/op.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ fn is_builtin_binop<'tcx>(lhs: Ty<'tcx>, rhs: Ty<'tcx>, op: hir::BinOp) -> bool
964964
struct TypeParamEraser<'a, 'tcx>(&'a FnCtxt<'a, 'tcx>, Span);
965965

966966
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for TypeParamEraser<'_, 'tcx> {
967-
fn tcx(&self) -> TyCtxt<'tcx> {
967+
fn interner(&self) -> TyCtxt<'tcx> {
968968
self.0.tcx
969969
}
970970

compiler/rustc_hir_typeck/src/writeback.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ struct EraseEarlyRegions<'tcx> {
764764
}
765765

766766
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for EraseEarlyRegions<'tcx> {
767-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
767+
fn interner(&self) -> TyCtxt<'tcx> {
768768
self.tcx
769769
}
770770
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
@@ -780,7 +780,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for EraseEarlyRegions<'tcx> {
780780
}
781781

782782
impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Resolver<'cx, 'tcx> {
783-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
783+
fn interner(&self) -> TyCtxt<'tcx> {
784784
self.tcx
785785
}
786786

@@ -797,7 +797,7 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Resolver<'cx, 'tcx> {
797797
debug!("Resolver::fold_ty: input type `{:?}` not fully resolvable", t);
798798
let e = self.report_error(t);
799799
self.replaced_with_error = Some(e);
800-
self.tcx().ty_error_with_guaranteed(e)
800+
self.interner().ty_error_with_guaranteed(e)
801801
}
802802
}
803803
}
@@ -814,7 +814,7 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Resolver<'cx, 'tcx> {
814814
debug!("Resolver::fold_const: input const `{:?}` not fully resolvable", ct);
815815
let e = self.report_error(ct);
816816
self.replaced_with_error = Some(e);
817-
self.tcx().const_error_with_guaranteed(ct.ty(), e)
817+
self.interner().const_error_with_guaranteed(ct.ty(), e)
818818
}
819819
}
820820
}

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ struct Canonicalizer<'cx, 'tcx> {
327327
}
328328

329329
impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
330-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
330+
fn interner(&self) -> TyCtxt<'tcx> {
331331
self.tcx
332332
}
333333

@@ -738,7 +738,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
738738
let var = self.canonical_var(info, r.into());
739739
let br = ty::BoundRegion { var, kind: ty::BrAnon(var.as_u32(), None) };
740740
let region = ty::ReLateBound(self.binder_index, br);
741-
self.tcx().mk_region(region)
741+
self.interner().mk_region(region)
742742
}
743743

744744
/// Given a type variable `ty_var` of the given kind, first check
@@ -752,7 +752,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
752752
self.fold_ty(bound_to)
753753
} else {
754754
let var = self.canonical_var(info, ty_var.into());
755-
self.tcx().mk_bound(self.binder_index, var.into())
755+
self.interner().mk_bound(self.binder_index, var.into())
756756
}
757757
}
758758

@@ -771,7 +771,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
771771
self.fold_const(bound_to)
772772
} else {
773773
let var = self.canonical_var(info, const_var.into());
774-
self.tcx().mk_const(
774+
self.interner().mk_const(
775775
ty::ConstKind::Bound(self.binder_index, var),
776776
self.fold_ty(const_var.ty()),
777777
)

compiler/rustc_infer/src/infer/combine.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ struct ConstInferUnifier<'cx, 'tcx> {
847847
impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ConstInferUnifier<'_, 'tcx> {
848848
type Error = TypeError<'tcx>;
849849

850-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
850+
fn interner(&self) -> TyCtxt<'tcx> {
851851
self.infcx.tcx
852852
}
853853

@@ -875,7 +875,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ConstInferUnifier<'_, 'tcx> {
875875
.borrow_mut()
876876
.type_variables()
877877
.new_var(self.for_universe, origin);
878-
Ok(self.tcx().mk_ty_var(new_var_id))
878+
Ok(self.interner().mk_ty_var(new_var_id))
879879
}
880880
}
881881
}
@@ -953,7 +953,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ConstInferUnifier<'_, 'tcx> {
953953
},
954954
},
955955
);
956-
Ok(self.tcx().mk_const(new_var_id, c.ty()))
956+
Ok(self.interner().mk_const(new_var_id, c.ty()))
957957
}
958958
}
959959
}

compiler/rustc_infer/src/infer/freshen.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
106106
}
107107

108108
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
109-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
109+
fn interner(&self) -> TyCtxt<'tcx> {
110110
self.infcx.tcx
111111
}
112112

@@ -124,13 +124,13 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
124124
| ty::ReError(_)
125125
| ty::ReErased => {
126126
// replace all free regions with 'erased
127-
self.tcx().lifetimes.re_erased
127+
self.interner().lifetimes.re_erased
128128
}
129129
ty::ReStatic => {
130130
if self.keep_static {
131131
r
132132
} else {
133-
self.tcx().lifetimes.re_erased
133+
self.interner().lifetimes.re_erased
134134
}
135135
}
136136
}

compiler/rustc_infer/src/infer/fudge.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub struct InferenceFudger<'a, 'tcx> {
176176
}
177177

178178
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for InferenceFudger<'a, 'tcx> {
179-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
179+
fn interner(&self) -> TyCtxt<'tcx> {
180180
self.infcx.tcx
181181
}
182182

compiler/rustc_infer/src/infer/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ struct InferenceLiteralEraser<'tcx> {
18531853
}
18541854

18551855
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for InferenceLiteralEraser<'tcx> {
1856-
fn tcx(&self) -> TyCtxt<'tcx> {
1856+
fn interner(&self) -> TyCtxt<'tcx> {
18571857
self.tcx
18581858
}
18591859

@@ -1871,7 +1871,7 @@ struct ShallowResolver<'a, 'tcx> {
18711871
}
18721872

18731873
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for ShallowResolver<'a, 'tcx> {
1874-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
1874+
fn interner(&self) -> TyCtxt<'tcx> {
18751875
self.infcx.tcx
18761876
}
18771877

@@ -2065,7 +2065,7 @@ fn replace_param_and_infer_substs_with_placeholder<'tcx>(
20652065
}
20662066

20672067
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReplaceParamAndInferWithPlaceholder<'tcx> {
2068-
fn tcx(&self) -> TyCtxt<'tcx> {
2068+
fn interner(&self) -> TyCtxt<'tcx> {
20692069
self.tcx
20702070
}
20712071

compiler/rustc_infer/src/infer/resolve.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ impl<'a, 'tcx> OpportunisticVarResolver<'a, 'tcx> {
3232
}
3333

3434
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for OpportunisticVarResolver<'a, 'tcx> {
35-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
36-
TypeFolder::tcx(&self.shallow_resolver)
35+
fn interner(&self) -> TyCtxt<'tcx> {
36+
TypeFolder::interner(&self.shallow_resolver)
3737
}
3838

3939
#[inline]
@@ -74,7 +74,7 @@ impl<'a, 'tcx> OpportunisticRegionResolver<'a, 'tcx> {
7474
}
7575

7676
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for OpportunisticRegionResolver<'a, 'tcx> {
77-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
77+
fn interner(&self) -> TyCtxt<'tcx> {
7878
self.infcx.tcx
7979
}
8080

@@ -95,7 +95,7 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for OpportunisticRegionResolver<'a, 'tcx
9595
.borrow_mut()
9696
.unwrap_region_constraints()
9797
.opportunistic_resolve_var(rid);
98-
TypeFolder::tcx(self).reuse_or_mk_region(r, ty::ReVar(resolved))
98+
TypeFolder::interner(self).reuse_or_mk_region(r, ty::ReVar(resolved))
9999
}
100100
_ => r,
101101
}
@@ -214,7 +214,7 @@ struct FullTypeResolver<'a, 'tcx> {
214214
impl<'a, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for FullTypeResolver<'a, 'tcx> {
215215
type Error = FixupError<'tcx>;
216216

217-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
217+
fn interner(&self) -> TyCtxt<'tcx> {
218218
self.infcx.tcx
219219
}
220220

compiler/rustc_middle/src/traits/solve.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub struct ExternalConstraintsData<'tcx> {
2828

2929
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for ExternalConstraints<'tcx> {
3030
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
31-
Ok(ir::FallibleTypeFolder::tcx(folder).intern_external_constraints(
31+
Ok(ir::FallibleTypeFolder::interner(folder).intern_external_constraints(
3232
ExternalConstraintsData {
3333
regions: (),
3434
opaque_types: self
@@ -41,7 +41,7 @@ impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for ExternalConstraints<'tcx> {
4141
}
4242

4343
fn fold_with<F: TypeFolder<'tcx>>(self, folder: &mut F) -> Self {
44-
ir::TypeFolder::tcx(folder).intern_external_constraints(ExternalConstraintsData {
44+
ir::TypeFolder::interner(folder).intern_external_constraints(ExternalConstraintsData {
4545
regions: (),
4646
opaque_types: self.opaque_types.iter().map(|opaque| opaque.fold_with(folder)).collect(),
4747
})

compiler/rustc_middle/src/ty/abstract_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'tcx> TyCtxt<'tcx> {
5353
}
5454

5555
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Expander<'tcx> {
56-
fn tcx(&self) -> TyCtxt<'tcx> {
56+
fn interner(&self) -> TyCtxt<'tcx> {
5757
self.tcx
5858
}
5959
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {

compiler/rustc_middle/src/ty/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ pub struct MakeSuggestableFolder<'tcx> {
539539
impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for MakeSuggestableFolder<'tcx> {
540540
type Error = ();
541541

542-
fn tcx(&self) -> TyCtxt<'tcx> {
542+
fn interner(&self) -> TyCtxt<'tcx> {
543543
self.tcx
544544
}
545545

compiler/rustc_middle/src/ty/erase_regions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct RegionEraserVisitor<'tcx> {
3535
}
3636

3737
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RegionEraserVisitor<'tcx> {
38-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
38+
fn interner(&self) -> TyCtxt<'tcx> {
3939
self.tcx
4040
}
4141

compiler/rustc_middle/src/ty/fold.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ where
3636
G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>,
3737
H: FnMut(ty::Const<'tcx>) -> ty::Const<'tcx>,
3838
{
39-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
39+
fn interner(&self) -> TyCtxt<'tcx> {
4040
self.tcx
4141
}
4242

@@ -121,7 +121,7 @@ impl<'a, 'tcx> RegionFolder<'a, 'tcx> {
121121
}
122122

123123
impl<'a, 'tcx> ir::TypeFolder<TyCtxt<'tcx>> for RegionFolder<'a, 'tcx> {
124-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
124+
fn interner(&self) -> TyCtxt<'tcx> {
125125
self.tcx
126126
}
127127

@@ -198,7 +198,7 @@ impl<'tcx, D> ir::TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'tcx, D>
198198
where
199199
D: BoundVarReplacerDelegate<'tcx>,
200200
{
201-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
201+
fn interner(&self) -> TyCtxt<'tcx> {
202202
self.tcx
203203
}
204204

@@ -461,7 +461,7 @@ impl<'tcx> Shifter<'tcx> {
461461
}
462462

463463
impl<'tcx> ir::TypeFolder<TyCtxt<'tcx>> for Shifter<'tcx> {
464-
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
464+
fn interner(&self) -> TyCtxt<'tcx> {
465465
self.tcx
466466
}
467467

compiler/rustc_middle/src/ty/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ fn polymorphize<'tcx>(
675675
}
676676

677677
impl<'tcx> ty::ir::TypeFolder<TyCtxt<'tcx>> for PolymorphizationFolder<'tcx> {
678-
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
678+
fn interner(&self) -> TyCtxt<'tcx> {
679679
self.tcx
680680
}
681681

compiler/rustc_middle/src/ty/normalize_erasing_regions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl<'tcx> NormalizeAfterErasingRegionsFolder<'tcx> {
206206
}
207207

208208
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for NormalizeAfterErasingRegionsFolder<'tcx> {
209-
fn tcx(&self) -> TyCtxt<'tcx> {
209+
fn interner(&self) -> TyCtxt<'tcx> {
210210
self.tcx
211211
}
212212

@@ -244,7 +244,7 @@ impl<'tcx> TryNormalizeAfterErasingRegionsFolder<'tcx> {
244244
impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for TryNormalizeAfterErasingRegionsFolder<'tcx> {
245245
type Error = NormalizationError<'tcx>;
246246

247-
fn tcx(&self) -> TyCtxt<'tcx> {
247+
fn interner(&self) -> TyCtxt<'tcx> {
248248
self.tcx
249249
}
250250

0 commit comments

Comments
 (0)