aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-03 16:49:29 +0100
committerFlorian Diebold <[email protected]>2021-04-08 13:08:55 +0100
commit7e541e69b1eaab3c242c864a0930cb263d2cbaf5 (patch)
tree88fb29aa7e0b782efc9f91ec5676d93e4db4ffd7 /crates/hir_ty/src/lib.rs
parent926bfef0efc5caca2a04a50beaba9127338e21e0 (diff)
Add HasInterner bounds
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs15
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;
33use std::sync::Arc; 33use std::sync::Arc;
34 34
35use base_db::salsa; 35use base_db::salsa;
36use chalk_ir::UintTy; 36use chalk_ir::{
37 cast::{CastTo, Caster},
38 interner::HasInterner,
39 UintTy,
40};
37use hir_def::{ 41use 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
116pub fn wrap_empty_binders<T>(value: T) -> Binders<T> 120pub fn wrap_empty_binders<T>(value: T) -> Binders<T>
117where 121where
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
123pub fn make_only_type_binders<T>(num_vars: usize, value: T) -> Binders<T> { 127pub 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
135pub fn make_canonical<T>( 142pub 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> {