Skip to content

Commit d1b645d

Browse files
committed
Make Canonical::new a free-standing function
1 parent 9b4ecd3 commit d1b645d

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

crates/hir/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ impl Type {
18081808
.push(self.ty.clone())
18091809
.fill(args.iter().map(|t| t.ty.clone()))
18101810
.build();
1811-
let goal = Canonical::new(
1811+
let goal = hir_ty::make_canonical(
18121812
InEnvironment::new(
18131813
self.env.env.clone(),
18141814
AliasEq {

crates/hir_ty/src/lib.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,18 @@ pub fn make_only_type_binders<T>(num_vars: usize, value: T) -> Binders<T> {
107107
)
108108
}
109109

110-
impl<T> Canonical<T> {
111-
pub fn new(value: T, kinds: impl IntoIterator<Item = TyVariableKind>) -> Self {
112-
let kinds = kinds.into_iter().map(|tk| {
113-
chalk_ir::CanonicalVarKind::new(
114-
chalk_ir::VariableKind::Ty(tk),
115-
chalk_ir::UniverseIndex::ROOT,
116-
)
117-
});
118-
Self { value, binders: chalk_ir::CanonicalVarKinds::from_iter(&Interner, kinds) }
119-
}
110+
// FIXME: get rid of this
111+
pub fn make_canonical<T>(
112+
value: T,
113+
kinds: impl IntoIterator<Item = TyVariableKind>,
114+
) -> Canonical<T> {
115+
let kinds = kinds.into_iter().map(|tk| {
116+
chalk_ir::CanonicalVarKind::new(
117+
chalk_ir::VariableKind::Ty(tk),
118+
chalk_ir::UniverseIndex::ROOT,
119+
)
120+
});
121+
Canonical { value, binders: chalk_ir::CanonicalVarKinds::from_iter(&Interner, kinds) }
120122
}
121123

122124
/// A function signature as seen by type inference: Several parameter types and

0 commit comments

Comments
 (0)