diff options
author | Florian Diebold <[email protected]> | 2021-04-07 20:10:28 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-08 13:08:55 +0100 |
commit | b24e6f60300300125ff353073a36d1ef7a64e37f (patch) | |
tree | 9821ff801f85e9e362993c5ac0505866d40c86d6 /crates | |
parent | 7e541e69b1eaab3c242c864a0930cb263d2cbaf5 (diff) |
Impl Fold for CallableSig
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 18 |
1 files changed, 18 insertions, 0 deletions
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; | |||
35 | use base_db::salsa; | 35 | use base_db::salsa; |
36 | use chalk_ir::{ | 36 | use chalk_ir::{ |
37 | cast::{CastTo, Caster}, | 37 | cast::{CastTo, Caster}, |
38 | fold::Fold, | ||
38 | interner::HasInterner, | 39 | interner::HasInterner, |
39 | UintTy, | 40 | UintTy, |
40 | }; | 41 | }; |
@@ -203,6 +204,23 @@ impl CallableSig { | |||
203 | } | 204 | } |
204 | } | 205 | } |
205 | 206 | ||
207 | impl Fold<Interner> for CallableSig { | ||
208 | type Result = CallableSig; | ||
209 | |||
210 | fn fold_with<'i>( | ||
211 | self, | ||
212 | folder: &mut dyn chalk_ir::fold::Folder<'i, Interner>, | ||
213 | outer_binder: DebruijnIndex, | ||
214 | ) -> chalk_ir::Fallible<Self::Result> | ||
215 | where | ||
216 | Interner: 'i, | ||
217 | { | ||
218 | let vec = self.params_and_return.to_vec(); | ||
219 | let folded = vec.fold_with(folder, outer_binder)?; | ||
220 | Ok(CallableSig { params_and_return: folded.into(), is_varargs: self.is_varargs }) | ||
221 | } | ||
222 | } | ||
223 | |||
206 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] | 224 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] |
207 | pub enum ImplTraitId { | 225 | pub enum ImplTraitId { |
208 | ReturnTypeImplTrait(hir_def::FunctionId, u16), | 226 | ReturnTypeImplTrait(hir_def::FunctionId, u16), |