aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-04-07 19:51:36 +0100
committerGitHub <[email protected]>2021-04-07 19:51:36 +0100
commit3191a93185b34c6deebca2aad0584d2840ad6d43 (patch)
tree1fad465381a5b9a9d0b77dbf68a246db1835f511 /crates/hir_ty/src/lib.rs
parent6379839c8203b6fbc9af947997a7f73a36ef15a2 (diff)
parentdc116f7ce2192433c9491441a11d294e7d294fbf (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.rs30
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
42pub use autoderef::autoderef; 42pub use autoderef::autoderef;
43pub use builder::TyBuilder; 43pub use builder::TyBuilder;
44pub use chalk_ext::{ProjectionTyExt, TyExt}; 44pub use chalk_ext::*;
45pub use infer::{could_unify, InferenceResult}; 45pub use infer::{could_unify, InferenceResult};
46pub use lower::{ 46pub 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
110impl TraitRef { 110// FIXME: get rid of this
111 pub fn hir_trait_id(&self) -> TraitId { 111pub 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| {
116impl<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