Skip to content

Commit 8754bd3

Browse files
committed
Make folding generic over the interner
1 parent 8fcd967 commit 8754bd3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+442
-334
lines changed

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<'tcx> ToUniverseInfo<'tcx>
106106
}
107107
}
108108

109-
impl<'tcx, T: Copy + fmt::Display + TypeFoldable<'tcx> + 'tcx> ToUniverseInfo<'tcx>
109+
impl<'tcx, T: Copy + fmt::Display + TypeFoldable<TyCtxt<'tcx>> + 'tcx> ToUniverseInfo<'tcx>
110110
for Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::Normalize<T>>>
111111
{
112112
fn to_universe_info(self, base_universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
@@ -258,7 +258,7 @@ struct NormalizeQuery<'tcx, T> {
258258

259259
impl<'tcx, T> TypeOpInfo<'tcx> for NormalizeQuery<'tcx, T>
260260
where
261-
T: Copy + fmt::Display + TypeFoldable<'tcx> + 'tcx,
261+
T: Copy + fmt::Display + TypeFoldable<TyCtxt<'tcx>> + 'tcx,
262262
{
263263
fn fallback_error(
264264
&self,

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
12781278
/// we use this kind of hacky solution.
12791279
fn normalize_to_scc_representatives<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
12801280
where
1281-
T: TypeFoldable<'tcx>,
1281+
T: TypeFoldable<TyCtxt<'tcx>>,
12821282
{
12831283
tcx.fold_regions(value, |r, _db| {
12841284
let vid = self.to_region_vid(r);

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
179179
/// region names in error messages.
180180
pub(crate) fn name_regions<T>(&self, tcx: TyCtxt<'tcx>, ty: T) -> T
181181
where
182-
T: TypeFoldable<'tcx>,
182+
T: TypeFoldable<TyCtxt<'tcx>>,
183183
{
184184
tcx.fold_regions(ty, |region, _| match *region {
185185
ty::ReVar(vid) => {

compiler/rustc_borrowck/src/renumber.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn renumber_mir<'tcx>(
3232
#[instrument(skip(infcx), level = "debug")]
3333
pub fn renumber_regions<'tcx, T>(infcx: &InferCtxt<'tcx>, value: T) -> T
3434
where
35-
T: TypeFoldable<'tcx>,
35+
T: TypeFoldable<TyCtxt<'tcx>>,
3636
{
3737
infcx.tcx.fold_regions(value, |_region, _depth| {
3838
let origin = NllRegionVariableOrigin::Existential { from_forall: false };
@@ -47,7 +47,7 @@ struct NllVisitor<'a, 'tcx> {
4747
impl<'a, 'tcx> NllVisitor<'a, 'tcx> {
4848
fn renumber_regions<T>(&mut self, value: T) -> T
4949
where
50-
T: TypeFoldable<'tcx>,
50+
T: TypeFoldable<TyCtxt<'tcx>>,
5151
{
5252
renumber_regions(self.infcx, value)
5353
}

compiler/rustc_borrowck/src/type_check/canonical.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fmt;
22

33
use rustc_infer::infer::{canonical::Canonical, InferOk};
44
use rustc_middle::mir::ConstraintCategory;
5-
use rustc_middle::ty::{self, ToPredicate, Ty, TypeFoldable};
5+
use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable};
66
use rustc_span::def_id::DefId;
77
use rustc_span::Span;
88
use rustc_trait_selection::traits::query::type_op::{self, TypeOpOutput};
@@ -66,7 +66,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
6666
canonical: &Canonical<'tcx, T>,
6767
) -> T
6868
where
69-
T: TypeFoldable<'tcx>,
69+
T: TypeFoldable<TyCtxt<'tcx>>,
7070
{
7171
let old_universe = self.infcx.universe();
7272

compiler/rustc_borrowck/src/type_check/constraint_conversion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
179179
///
180180
/// FIXME: This should get removed once higher ranked region obligations
181181
/// are dealt with during trait solving.
182-
fn replace_placeholders_with_nll<T: TypeFoldable<'tcx>>(&mut self, value: T) -> T {
182+
fn replace_placeholders_with_nll<T: TypeFoldable<TyCtxt<'tcx>>>(&mut self, value: T) -> T {
183183
if value.has_placeholders() {
184184
self.tcx.fold_regions(value, |r, _| match *r {
185185
ty::RePlaceholder(placeholder) => {

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ trait InferCtxtExt<'tcx> {
695695
value: T,
696696
) -> T
697697
where
698-
T: TypeFoldable<'tcx>;
698+
T: TypeFoldable<TyCtxt<'tcx>>;
699699

700700
fn replace_bound_regions_with_nll_infer_vars<T>(
701701
&self,
@@ -705,7 +705,7 @@ trait InferCtxtExt<'tcx> {
705705
indices: &mut UniversalRegionIndices<'tcx>,
706706
) -> T
707707
where
708-
T: TypeFoldable<'tcx>;
708+
T: TypeFoldable<TyCtxt<'tcx>>;
709709

710710
fn replace_late_bound_regions_with_nll_infer_vars_in_recursive_scope(
711711
&self,
@@ -727,7 +727,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
727727
value: T,
728728
) -> T
729729
where
730-
T: TypeFoldable<'tcx>,
730+
T: TypeFoldable<TyCtxt<'tcx>>,
731731
{
732732
self.tcx.fold_regions(value, |_region, _depth| self.next_nll_region_var(origin))
733733
}
@@ -741,7 +741,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
741741
indices: &mut UniversalRegionIndices<'tcx>,
742742
) -> T
743743
where
744-
T: TypeFoldable<'tcx>,
744+
T: TypeFoldable<TyCtxt<'tcx>>,
745745
{
746746
let (value, _map) = self.tcx.replace_late_bound_regions(value, |br| {
747747
debug!(?br);
@@ -833,7 +833,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
833833
/// returned by `to_region_vid`.
834834
pub fn fold_to_region_vids<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
835835
where
836-
T: TypeFoldable<'tcx>,
836+
T: TypeFoldable<TyCtxt<'tcx>>,
837837
{
838838
tcx.fold_regions(value, |region, _| tcx.mk_region(ty::ReVar(self.to_region_vid(region))))
839839
}

compiler/rustc_codegen_cranelift/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ impl<'tcx> HasTargetSpec for FunctionCx<'_, '_, 'tcx> {
336336
impl<'tcx> FunctionCx<'_, '_, 'tcx> {
337337
pub(crate) fn monomorphize<T>(&self, value: T) -> T
338338
where
339-
T: TypeFoldable<'tcx> + Copy,
339+
T: TypeFoldable<TyCtxt<'tcx>> + Copy,
340340
{
341341
self.instance.subst_mir_and_normalize_erasing_regions(
342342
self.tcx,

compiler/rustc_codegen_ssa/src/mir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::traits::*;
33
use rustc_middle::mir;
44
use rustc_middle::mir::interpret::ErrorHandled;
55
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout};
6-
use rustc_middle::ty::{self, Instance, Ty, TypeFoldable, TypeVisitable};
6+
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable, TypeVisitable};
77
use rustc_target::abi::call::{FnAbi, PassMode};
88

99
use std::iter;
@@ -105,7 +105,7 @@ pub struct FunctionCx<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> {
105105
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
106106
pub fn monomorphize<T>(&self, value: T) -> T
107107
where
108-
T: Copy + TypeFoldable<'tcx>,
108+
T: Copy + TypeFoldable<TyCtxt<'tcx>>,
109109
{
110110
debug!("monomorphize: self.instance={:?}", self.instance);
111111
self.instance.subst_mir_and_normalize_erasing_regions(

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
489489

490490
/// Call this on things you got out of the MIR (so it is as generic as the current
491491
/// stack frame), to bring it into the proper environment for this interpreter.
492-
pub(super) fn subst_from_current_frame_and_normalize_erasing_regions<T: TypeFoldable<'tcx>>(
492+
pub(super) fn subst_from_current_frame_and_normalize_erasing_regions<
493+
T: TypeFoldable<TyCtxt<'tcx>>,
494+
>(
493495
&self,
494496
value: T,
495497
) -> Result<T, InterpError<'tcx>> {
@@ -498,7 +500,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
498500

499501
/// Call this on things you got out of the MIR (so it is as generic as the provided
500502
/// stack frame), to bring it into the proper environment for this interpreter.
501-
pub(super) fn subst_from_frame_and_normalize_erasing_regions<T: TypeFoldable<'tcx>>(
503+
pub(super) fn subst_from_frame_and_normalize_erasing_regions<T: TypeFoldable<TyCtxt<'tcx>>>(
502504
&self,
503505
frame: &Frame<'mir, 'tcx, M::Provenance, M::FrameExtra>,
504506
value: T,

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ struct RemapLateBound<'a, 'tcx> {
464464
mapping: &'a FxHashMap<ty::BoundRegionKind, ty::BoundRegionKind>,
465465
}
466466

467-
impl<'tcx> TypeFolder<'tcx> for RemapLateBound<'_, 'tcx> {
467+
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RemapLateBound<'_, 'tcx> {
468468
fn tcx(&self) -> TyCtxt<'tcx> {
469469
self.tcx
470470
}
@@ -835,7 +835,7 @@ impl<'a, 'tcx> ImplTraitInTraitCollector<'a, 'tcx> {
835835
}
836836
}
837837

838-
impl<'tcx> TypeFolder<'tcx> for ImplTraitInTraitCollector<'_, 'tcx> {
838+
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'_, 'tcx> {
839839
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
840840
self.ocx.infcx.tcx
841841
}

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
5656
// `ObligationCtxt::normalize`, but provides a nice `ObligationCauseCode`.
5757
fn normalize<T>(&self, span: Span, loc: Option<WellFormedLoc>, value: T) -> T
5858
where
59-
T: TypeFoldable<'tcx>,
59+
T: TypeFoldable<TyCtxt<'tcx>>,
6060
{
6161
self.ocx.normalize(
6262
&ObligationCause::new(span, self.body_def_id, ObligationCauseCode::WellFormed(loc)),
@@ -560,7 +560,7 @@ fn augment_param_env<'tcx>(
560560
/// fn into_iter<'a>(&'a self) -> Self::Iter<'a>;
561561
/// }
562562
/// ```
563-
fn gather_gat_bounds<'tcx, T: TypeFoldable<'tcx>>(
563+
fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
564564
tcx: TyCtxt<'tcx>,
565565
param_env: ty::ParamEnv<'tcx>,
566566
item_def_id: hir::OwnerId,
@@ -762,7 +762,7 @@ struct GATSubstCollector<'tcx> {
762762
}
763763

764764
impl<'tcx> GATSubstCollector<'tcx> {
765-
fn visit<T: TypeFoldable<'tcx>>(
765+
fn visit<T: TypeFoldable<TyCtxt<'tcx>>>(
766766
gat: DefId,
767767
t: T,
768768
) -> (FxHashSet<(ty::Region<'tcx>, usize)>, FxHashSet<(Ty<'tcx>, usize)>) {

compiler/rustc_hir_analysis/src/collect/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ fn infer_placeholder_type<'a>(
850850
tcx: TyCtxt<'tcx>,
851851
}
852852

853-
impl<'tcx> TypeFolder<'tcx> for MakeNameable<'tcx> {
853+
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for MakeNameable<'tcx> {
854854
fn tcx(&self) -> TyCtxt<'tcx> {
855855
self.tcx
856856
}

compiler/rustc_hir_analysis/src/hir_wf_check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ struct EraseAllBoundRegions<'tcx> {
189189
// us an inaccurate span for an error message, but cannot
190190
// lead to unsoundness (we call `delay_span_bug` at the start
191191
// of `diagnostic_hir_wf_check`).
192-
impl<'tcx> TypeFolder<'tcx> for EraseAllBoundRegions<'tcx> {
192+
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for EraseAllBoundRegions<'tcx> {
193193
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
194194
self.tcx
195195
}

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
315315

316316
pub(in super::super) fn normalize<T>(&self, span: Span, value: T) -> T
317317
where
318-
T: TypeFoldable<'tcx>,
318+
T: TypeFoldable<TyCtxt<'tcx>>,
319319
{
320320
self.register_infer_ok_obligations(
321321
self.at(&self.misc(span), self.param_env).normalize(value),

compiler/rustc_hir_typeck/src/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
127127

128128
fn resolve_vars_if_possible<T>(&self, value: T) -> T
129129
where
130-
T: TypeFoldable<'tcx>,
130+
T: TypeFoldable<TyCtxt<'tcx>>,
131131
{
132132
self.infcx.resolve_vars_if_possible(value)
133133
}

compiler/rustc_hir_typeck/src/method/confirm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_middle::ty::adjustment::{Adjust, Adjustment, PointerCast};
1414
use rustc_middle::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
1515
use rustc_middle::ty::fold::TypeFoldable;
1616
use rustc_middle::ty::subst::{self, SubstsRef};
17-
use rustc_middle::ty::{self, GenericParamDefKind, Ty};
17+
use rustc_middle::ty::{self, GenericParamDefKind, Ty, TyCtxt};
1818
use rustc_middle::ty::{InternalSubsts, UserSubsts, UserType};
1919
use rustc_span::{Span, DUMMY_SP};
2020
use rustc_trait_selection::traits;
@@ -627,7 +627,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
627627

628628
fn replace_bound_vars_with_fresh_vars<T>(&self, value: ty::Binder<'tcx, T>) -> T
629629
where
630-
T: TypeFoldable<'tcx> + Copy,
630+
T: TypeFoldable<TyCtxt<'tcx>> + Copy,
631631
{
632632
self.fcx.replace_bound_vars_with_fresh_vars(self.span, infer::FnCall, value)
633633
}

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
19681968
/// so forth.
19691969
fn erase_late_bound_regions<T>(&self, value: ty::Binder<'tcx, T>) -> T
19701970
where
1971-
T: TypeFoldable<'tcx>,
1971+
T: TypeFoldable<TyCtxt<'tcx>>,
19721972
{
19731973
self.tcx.erase_late_bound_regions(value)
19741974
}

compiler/rustc_hir_typeck/src/op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ fn is_builtin_binop<'tcx>(lhs: Ty<'tcx>, rhs: Ty<'tcx>, op: hir::BinOp) -> bool
963963

964964
struct TypeParamEraser<'a, 'tcx>(&'a FnCtxt<'a, 'tcx>, Span);
965965

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

compiler/rustc_hir_typeck/src/writeback.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
685685

686686
fn resolve<T>(&mut self, x: T, span: &dyn Locatable) -> T
687687
where
688-
T: TypeFoldable<'tcx>,
688+
T: TypeFoldable<TyCtxt<'tcx>>,
689689
{
690690
let mut resolver = Resolver::new(self.fcx, span, self.body);
691691
let x = x.fold_with(&mut resolver);
@@ -763,7 +763,7 @@ struct EraseEarlyRegions<'tcx> {
763763
tcx: TyCtxt<'tcx>,
764764
}
765765

766-
impl<'tcx> TypeFolder<'tcx> for EraseEarlyRegions<'tcx> {
766+
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for EraseEarlyRegions<'tcx> {
767767
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
768768
self.tcx
769769
}
@@ -779,7 +779,7 @@ impl<'tcx> TypeFolder<'tcx> for EraseEarlyRegions<'tcx> {
779779
}
780780
}
781781

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

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl<'tcx> InferCtxt<'tcx> {
4141
query_state: &mut OriginalQueryValues<'tcx>,
4242
) -> Canonical<'tcx, V>
4343
where
44-
V: TypeFoldable<'tcx>,
44+
V: TypeFoldable<TyCtxt<'tcx>>,
4545
{
4646
self.tcx.sess.perf_stats.queries_canonicalized.fetch_add(1, Ordering::Relaxed);
4747

@@ -60,7 +60,7 @@ impl<'tcx> InferCtxt<'tcx> {
6060
query_state: &mut OriginalQueryValues<'tcx>,
6161
) -> Canonical<'tcx, V>
6262
where
63-
V: TypeFoldable<'tcx>,
63+
V: TypeFoldable<TyCtxt<'tcx>>,
6464
{
6565
self.tcx.sess.perf_stats.queries_canonicalized.fetch_add(1, Ordering::Relaxed);
6666

@@ -100,7 +100,7 @@ impl<'tcx> InferCtxt<'tcx> {
100100
/// [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html#canonicalizing-the-query-result
101101
pub fn canonicalize_response<V>(&self, value: V) -> Canonical<'tcx, V>
102102
where
103-
V: TypeFoldable<'tcx>,
103+
V: TypeFoldable<TyCtxt<'tcx>>,
104104
{
105105
let mut query_state = OriginalQueryValues::default();
106106
Canonicalizer::canonicalize(
@@ -114,7 +114,7 @@ impl<'tcx> InferCtxt<'tcx> {
114114

115115
pub fn canonicalize_user_type_annotation<V>(&self, value: V) -> Canonical<'tcx, V>
116116
where
117-
V: TypeFoldable<'tcx>,
117+
V: TypeFoldable<TyCtxt<'tcx>>,
118118
{
119119
let mut query_state = OriginalQueryValues::default();
120120
Canonicalizer::canonicalize(
@@ -136,7 +136,7 @@ impl<'tcx> InferCtxt<'tcx> {
136136
query_state: &mut OriginalQueryValues<'tcx>,
137137
) -> Canonical<'tcx, V>
138138
where
139-
V: TypeFoldable<'tcx>,
139+
V: TypeFoldable<TyCtxt<'tcx>>,
140140
{
141141
self.tcx.sess.perf_stats.queries_canonicalized.fetch_add(1, Ordering::Relaxed);
142142

@@ -328,14 +328,14 @@ struct Canonicalizer<'cx, 'tcx> {
328328
binder_index: ty::DebruijnIndex,
329329
}
330330

331-
impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
331+
impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
332332
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
333333
self.tcx
334334
}
335335

336336
fn fold_binder<T>(&mut self, t: ty::Binder<'tcx, T>) -> ty::Binder<'tcx, T>
337337
where
338-
T: TypeFoldable<'tcx>,
338+
T: TypeFoldable<TyCtxt<'tcx>>,
339339
{
340340
self.binder_index.shift_in(1);
341341
let t = t.super_fold_with(self);
@@ -526,7 +526,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
526526
query_state: &mut OriginalQueryValues<'tcx>,
527527
) -> Canonical<'tcx, V>
528528
where
529-
V: TypeFoldable<'tcx>,
529+
V: TypeFoldable<TyCtxt<'tcx>>,
530530
{
531531
let needs_canonical_flags = if canonicalize_region_mode.any() {
532532
TypeFlags::NEEDS_INFER |

0 commit comments

Comments
 (0)