From b24e6f60300300125ff353073a36d1ef7a64e37f Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 7 Apr 2021 21:10:28 +0200 Subject: Impl Fold for CallableSig --- crates/hir_ty/src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crates') diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 23dec7040..0954d495c 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs @@ -35,6 +35,7 @@ use std::sync::Arc; use base_db::salsa; use chalk_ir::{ cast::{CastTo, Caster}, + fold::Fold, interner::HasInterner, UintTy, }; @@ -203,6 +204,23 @@ impl CallableSig { } } +impl Fold for CallableSig { + type Result = CallableSig; + + fn fold_with<'i>( + self, + folder: &mut dyn chalk_ir::fold::Folder<'i, Interner>, + outer_binder: DebruijnIndex, + ) -> chalk_ir::Fallible + where + Interner: 'i, + { + let vec = self.params_and_return.to_vec(); + let folded = vec.fold_with(folder, outer_binder)?; + Ok(CallableSig { params_and_return: folded.into(), is_varargs: self.is_varargs }) + } +} + #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] pub enum ImplTraitId { ReturnTypeImplTrait(hir_def::FunctionId, u16), -- cgit v1.2.3