diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-07 19:51:36 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-07 19:51:36 +0100 |
commit | 3191a93185b34c6deebca2aad0584d2840ad6d43 (patch) | |
tree | 1fad465381a5b9a9d0b77dbf68a246db1835f511 /crates/hir_ty/src/lib.rs | |
parent | 6379839c8203b6fbc9af947997a7f73a36ef15a2 (diff) | |
parent | dc116f7ce2192433c9491441a11d294e7d294fbf (diff) |
Merge #8409
8409: Various remaining fixes for Chalk IR move r=flodiebold a=flodiebold
CC #8313
Co-authored-by: Florian Diebold <[email protected]>
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 |