Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/generic_arg.rs')
| -rw-r--r-- | crates/hir-ty/src/next_solver/generic_arg.rs | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/crates/hir-ty/src/next_solver/generic_arg.rs b/crates/hir-ty/src/next_solver/generic_arg.rs index 22b34b379d..483811f9e6 100644 --- a/crates/hir-ty/src/next_solver/generic_arg.rs +++ b/crates/hir-ty/src/next_solver/generic_arg.rs @@ -21,7 +21,8 @@ use rustc_type_ir::{ }; use crate::next_solver::{ - ConstInterned, RegionInterned, TyInterned, impl_foldable_for_interned_slice, interned_slice, + ConstInterned, RegionInterned, TyInterned, impl_foldable_for_interned_slice, + impl_foldable_for_stored_type, interned_slice, }; use super::{ @@ -194,24 +195,7 @@ impl std::fmt::Debug for StoredGenericArg { } } -impl<'db> TypeVisitable<DbInterner<'db>> for StoredGenericArg { - fn visit_with<V: TypeVisitor<DbInterner<'db>>>(&self, visitor: &mut V) -> V::Result { - self.as_ref().visit_with(visitor) - } -} - -impl<'db> TypeFoldable<DbInterner<'db>> for StoredGenericArg { - fn try_fold_with<F: FallibleTypeFolder<DbInterner<'db>>>( - self, - folder: &mut F, - ) -> Result<Self, F::Error> { - Ok(self.as_ref().try_fold_with(folder)?.store()) - } - - fn fold_with<F: TypeFolder<DbInterner<'db>>>(self, folder: &mut F) -> Self { - self.as_ref().fold_with(folder).store() - } -} +impl_foldable_for_stored_type!(StoredGenericArg); #[derive(Copy, Clone, PartialEq, Eq, Hash)] pub struct GenericArg<'db> { @@ -473,28 +457,10 @@ interned_slice!( GenericArg<'static>, ); impl_foldable_for_interned_slice!(GenericArgs); +impl_foldable_for_stored_type!(StoredGenericArgs); impl<'db> rustc_type_ir::inherent::GenericArg<DbInterner<'db>> for GenericArg<'db> {} -impl<'db> TypeVisitable<DbInterner<'db>> for StoredGenericArgs { - fn visit_with<V: TypeVisitor<DbInterner<'db>>>(&self, visitor: &mut V) -> V::Result { - self.as_ref().visit_with(visitor) - } -} - -impl<'db> TypeFoldable<DbInterner<'db>> for StoredGenericArgs { - fn try_fold_with<F: FallibleTypeFolder<DbInterner<'db>>>( - self, - folder: &mut F, - ) -> Result<Self, F::Error> { - Ok(self.as_ref().try_fold_with(folder)?.store()) - } - - fn fold_with<F: TypeFolder<DbInterner<'db>>>(self, folder: &mut F) -> Self { - self.as_ref().fold_with(folder).store() - } -} - trait GenericArgsBuilder<'db>: AsRef<[GenericArg<'db>]> { fn push(&mut self, arg: GenericArg<'db>); } |