diff options
author | Florian Diebold <[email protected]> | 2021-04-03 16:49:29 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-08 13:08:55 +0100 |
commit | 7e541e69b1eaab3c242c864a0930cb263d2cbaf5 (patch) | |
tree | 88fb29aa7e0b782efc9f91ec5676d93e4db4ffd7 /crates/hir_ty/src/lib.rs | |
parent | 926bfef0efc5caca2a04a50beaba9127338e21e0 (diff) |
Add HasInterner bounds
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 5fa8b3296..23dec7040 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs | |||
@@ -33,7 +33,11 @@ mod test_db; | |||
33 | use std::sync::Arc; | 33 | use std::sync::Arc; |
34 | 34 | ||
35 | use base_db::salsa; | 35 | use base_db::salsa; |
36 | use chalk_ir::UintTy; | 36 | use chalk_ir::{ |
37 | cast::{CastTo, Caster}, | ||
38 | interner::HasInterner, | ||
39 | UintTy, | ||
40 | }; | ||
37 | use hir_def::{ | 41 | use hir_def::{ |
38 | expr::ExprId, type_ref::Rawness, ConstParamId, LifetimeParamId, TraitId, TypeAliasId, | 42 | expr::ExprId, type_ref::Rawness, ConstParamId, LifetimeParamId, TraitId, TypeAliasId, |
39 | TypeParamId, | 43 | TypeParamId, |
@@ -115,12 +119,15 @@ pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option<usize> { | |||
115 | 119 | ||
116 | pub fn wrap_empty_binders<T>(value: T) -> Binders<T> | 120 | pub fn wrap_empty_binders<T>(value: T) -> Binders<T> |
117 | where | 121 | where |
118 | T: TypeWalk, | 122 | T: TypeWalk + HasInterner<Interner = Interner>, |
119 | { | 123 | { |
120 | Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE)) | 124 | Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE)) |
121 | } | 125 | } |
122 | 126 | ||
123 | pub fn make_only_type_binders<T>(num_vars: usize, value: T) -> Binders<T> { | 127 | pub fn make_only_type_binders<T: HasInterner<Interner = Interner>>( |
128 | num_vars: usize, | ||
129 | value: T, | ||
130 | ) -> Binders<T> { | ||
124 | Binders::new( | 131 | Binders::new( |
125 | VariableKinds::from_iter( | 132 | VariableKinds::from_iter( |
126 | &Interner, | 133 | &Interner, |
@@ -132,7 +139,7 @@ pub fn make_only_type_binders<T>(num_vars: usize, value: T) -> Binders<T> { | |||
132 | } | 139 | } |
133 | 140 | ||
134 | // FIXME: get rid of this | 141 | // FIXME: get rid of this |
135 | pub fn make_canonical<T>( | 142 | pub fn make_canonical<T: HasInterner<Interner = Interner>>( |
136 | value: T, | 143 | value: T, |
137 | kinds: impl IntoIterator<Item = TyVariableKind>, | 144 | kinds: impl IntoIterator<Item = TyVariableKind>, |
138 | ) -> Canonical<T> { | 145 | ) -> Canonical<T> { |