From edc59d897d56815e8b9814cdc4ff084100e4f3b4 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 22:23:16 +0200 Subject: Align FnPointer with Chalk --- crates/hir_ty/src/infer/expr.rs | 8 ++++---- crates/hir_ty/src/infer/unify.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/hir_ty/src/infer') diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 185a2dfc3..a2a7236a8 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs @@ -22,8 +22,8 @@ use crate::{ to_chalk_trait_id, traits::{chalk::from_chalk, FnTrait}, utils::{generics, variant_data, Generics}, - AdtId, Binders, CallableDefId, FnPointer, FnSig, InEnvironment, Interner, ProjectionTyExt, - Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyKind, + AdtId, Binders, CallableDefId, FnPointer, FnSig, FnSubst, InEnvironment, Interner, + ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyKind, }; use super::{ @@ -260,9 +260,9 @@ impl<'a> InferenceContext<'a> { }; sig_tys.push(ret_ty.clone()); let sig_ty = TyKind::Function(FnPointer { - num_args: sig_tys.len() - 1, + num_binders: 0, sig: FnSig { abi: (), safety: chalk_ir::Safety::Safe, variadic: false }, - substs: Substitution::from_iter(&Interner, sig_tys.clone()), + substitution: FnSubst(Substitution::from_iter(&Interner, sig_tys.clone())), }) .intern(&Interner); let closure_id = self.db.intern_closure((self.owner, tgt_expr)).into(); diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index c90a16720..2f9523325 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs @@ -7,7 +7,7 @@ use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; use super::{DomainGoal, InferenceContext}; use crate::{ - AliasEq, AliasTy, BoundVar, Canonical, CanonicalVarKinds, DebruijnIndex, FnPointer, + AliasEq, AliasTy, BoundVar, Canonical, CanonicalVarKinds, DebruijnIndex, FnPointer, FnSubst, InEnvironment, InferenceVar, Interner, Scalar, Substitution, Ty, TyKind, TypeWalk, WhereClause, }; @@ -308,8 +308,8 @@ impl InferenceTable { (TyKind::Adt(_, substs1), TyKind::Adt(_, substs2)) | (TyKind::FnDef(_, substs1), TyKind::FnDef(_, substs2)) | ( - TyKind::Function(FnPointer { substs: substs1, .. }), - TyKind::Function(FnPointer { substs: substs2, .. }), + TyKind::Function(FnPointer { substitution: FnSubst(substs1), .. }), + TyKind::Function(FnPointer { substitution: FnSubst(substs2), .. }), ) | (TyKind::Tuple(_, substs1), TyKind::Tuple(_, substs2)) | (TyKind::OpaqueType(_, substs1), TyKind::OpaqueType(_, substs2)) -- cgit v1.2.3