diff options
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 2e851d3e0..87f10e9d5 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs | |||
@@ -41,7 +41,7 @@ use crate::{db::HirDatabase, display::HirDisplay, utils::generics}; | |||
41 | 41 | ||
42 | pub use autoderef::autoderef; | 42 | pub use autoderef::autoderef; |
43 | pub use builder::TyBuilder; | 43 | pub use builder::TyBuilder; |
44 | pub use chalk_ext::{ProjectionTyExt, TyExt}; | 44 | pub use chalk_ext::*; |
45 | pub use infer::{could_unify, InferenceResult}; | 45 | pub use infer::{could_unify, InferenceResult}; |
46 | pub use lower::{ | 46 | pub use lower::{ |
47 | associated_type_shorthand_candidates, callable_item_sig, CallableDefId, ImplTraitLoweringMode, | 47 | associated_type_shorthand_candidates, callable_item_sig, CallableDefId, ImplTraitLoweringMode, |
@@ -107,22 +107,18 @@ pub fn make_only_type_binders<T>(num_vars: usize, value: T) -> Binders<T> { | |||
107 | ) | 107 | ) |
108 | } | 108 | } |
109 | 109 | ||
110 | impl TraitRef { | 110 | // FIXME: get rid of this |
111 | pub fn hir_trait_id(&self) -> TraitId { | 111 | pub fn make_canonical<T>( |
112 | from_chalk_trait_id(self.trait_id) | 112 | value: T, |
113 | } | 113 | kinds: impl IntoIterator<Item = TyVariableKind>, |
114 | } | 114 | ) -> Canonical<T> { |
115 | 115 | let kinds = kinds.into_iter().map(|tk| { | |
116 | impl<T> Canonical<T> { | 116 | chalk_ir::CanonicalVarKind::new( |
117 | pub fn new(value: T, kinds: impl IntoIterator<Item = TyVariableKind>) -> Self { | 117 | chalk_ir::VariableKind::Ty(tk), |
118 | let kinds = kinds.into_iter().map(|tk| { | 118 | chalk_ir::UniverseIndex::ROOT, |
119 | chalk_ir::CanonicalVarKind::new( | 119 | ) |
120 | chalk_ir::VariableKind::Ty(tk), | 120 | }); |
121 | chalk_ir::UniverseIndex::ROOT, | 121 | Canonical { value, binders: chalk_ir::CanonicalVarKinds::from_iter(&Interner, kinds) } |
122 | ) | ||
123 | }); | ||
124 | Self { value, binders: chalk_ir::CanonicalVarKinds::from_iter(&Interner, kinds) } | ||
125 | } | ||
126 | } | 122 | } |
127 | 123 | ||
128 | /// A function signature as seen by type inference: Several parameter types and | 124 | /// A function signature as seen by type inference: Several parameter types and |