aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-07 19:47:04 +0100
committerFlorian Diebold <[email protected]>2021-04-07 19:47:04 +0100
commitd1b645d2360fb6e74aaa774ff713af02f685a110 (patch)
tree338d5e5fb998a6cec35cf3d4c89bfbfe70c2f89f /crates/hir_ty/src/lib.rs
parent9b4ecd3723c0184706d1276759846ebf3fdff944 (diff)
Make Canonical::new a free-standing function
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index 7538e0874..915b1028f 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -107,16 +107,18 @@ pub fn make_only_type_binders<T>(num_vars: usize, value: T) -> Binders<T> {
107 ) 107 )
108} 108}
109 109
110impl<T> Canonical<T> { 110// FIXME: get rid of this
111 pub fn new(value: T, kinds: impl IntoIterator<Item = TyVariableKind>) -> Self { 111pub fn make_canonical<T>(
112 let kinds = kinds.into_iter().map(|tk| { 112 value: T,
113 chalk_ir::CanonicalVarKind::new( 113 kinds: impl IntoIterator<Item = TyVariableKind>,
114 chalk_ir::VariableKind::Ty(tk), 114) -> Canonical<T> {
115 chalk_ir::UniverseIndex::ROOT, 115 let kinds = kinds.into_iter().map(|tk| {
116 ) 116 chalk_ir::CanonicalVarKind::new(
117 }); 117 chalk_ir::VariableKind::Ty(tk),
118 Self { value, binders: chalk_ir::CanonicalVarKinds::from_iter(&Interner, kinds) } 118 chalk_ir::UniverseIndex::ROOT,
119 } 119 )
120 });
121 Canonical { value, binders: chalk_ir::CanonicalVarKinds::from_iter(&Interner, kinds) }
120} 122}
121 123
122/// 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