1
Fork 0

Make folding traits generic over the Interner

This commit is contained in:
Alan Egerton 2023-02-11 09:13:27 +00:00
parent dea342d861
commit 9783fcc13b
No known key found for this signature in database
GPG key ID: 7D4C2F6C22122532
39 changed files with 160 additions and 130 deletions

View file

@ -326,7 +326,7 @@ struct Canonicalizer<'cx, 'tcx> {
binder_index: ty::DebruijnIndex,
}
impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.tcx
}

View file

@ -844,7 +844,7 @@ struct ConstInferUnifier<'cx, 'tcx> {
target_vid: ty::ConstVid<'tcx>,
}
impl<'tcx> FallibleTypeFolder<'tcx> for ConstInferUnifier<'_, 'tcx> {
impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ConstInferUnifier<'_, 'tcx> {
type Error = TypeError<'tcx>;
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {

View file

@ -105,7 +105,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
}
}
impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -175,7 +175,7 @@ pub struct InferenceFudger<'a, 'tcx> {
const_vars: (Range<ConstVid<'tcx>>, Vec<ConstVariableOrigin>),
}
impl<'a, 'tcx> TypeFolder<'tcx> for InferenceFudger<'a, 'tcx> {
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for InferenceFudger<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -1852,7 +1852,7 @@ struct InferenceLiteralEraser<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl<'tcx> TypeFolder<'tcx> for InferenceLiteralEraser<'tcx> {
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for InferenceLiteralEraser<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
}
@ -1870,7 +1870,7 @@ struct ShallowResolver<'a, 'tcx> {
infcx: &'a InferCtxt<'tcx>,
}
impl<'a, 'tcx> TypeFolder<'tcx> for ShallowResolver<'a, 'tcx> {
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for ShallowResolver<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -2064,7 +2064,7 @@ fn replace_param_and_infer_substs_with_placeholder<'tcx>(
idx: u32,
}
impl<'tcx> TypeFolder<'tcx> for ReplaceParamAndInferWithPlaceholder<'tcx> {
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReplaceParamAndInferWithPlaceholder<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
}

View file

@ -31,7 +31,7 @@ impl<'a, 'tcx> OpportunisticVarResolver<'a, 'tcx> {
}
}
impl<'a, 'tcx> TypeFolder<'tcx> for 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)
}
@ -73,7 +73,7 @@ impl<'a, 'tcx> OpportunisticRegionResolver<'a, 'tcx> {
}
}
impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticRegionResolver<'a, 'tcx> {
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for OpportunisticRegionResolver<'a, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -211,7 +211,7 @@ struct FullTypeResolver<'a, 'tcx> {
infcx: &'a InferCtxt<'tcx>,
}
impl<'a, 'tcx> FallibleTypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
impl<'a, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for FullTypeResolver<'a, 'tcx> {
type Error = FixupError<'tcx>;
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {

View file

@ -61,7 +61,7 @@ impl<'tcx> fmt::Debug for traits::MismatchedProjectionTypes<'tcx> {
///////////////////////////////////////////////////////////////////////////
// TypeFoldable implementations.
impl<'tcx, O: TypeFoldable<'tcx>> ir::TypeFoldable<'tcx> for traits::Obligation<'tcx, O> {
impl<'tcx, O: TypeFoldable<'tcx>> ir::TypeFoldable<TyCtxt<'tcx>> for traits::Obligation<'tcx, O> {
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
Ok(traits::Obligation {
cause: self.cause,