aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/lib.rs41
1 files changed, 28 insertions, 13 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index a325b6691..b7ab03edf 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -56,9 +56,9 @@ use hir_ty::{
56 primitive::UintTy, 56 primitive::UintTy,
57 to_assoc_type_id, 57 to_assoc_type_id,
58 traits::{FnTrait, Solution, SolutionVariables}, 58 traits::{FnTrait, Solution, SolutionVariables},
59 AliasEq, AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, Cast, DebruijnIndex, 59 AliasEq, AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, CanonicalVarKinds, Cast,
60 InEnvironment, Interner, ProjectionTy, QuantifiedWhereClause, Scalar, Substitution, Ty, 60 DebruijnIndex, InEnvironment, Interner, ProjectionTy, QuantifiedWhereClause, Scalar,
61 TyDefId, TyKind, TyVariableKind, WhereClause, 61 Substitution, Ty, TyDefId, TyKind, TyVariableKind, WhereClause,
62}; 62};
63use itertools::Itertools; 63use itertools::Itertools;
64use rustc_hash::FxHashSet; 64use rustc_hash::FxHashSet;
@@ -1723,7 +1723,10 @@ impl Type {
1723 None => return false, 1723 None => return false,
1724 }; 1724 };
1725 1725
1726 let canonical_ty = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) }; 1726 let canonical_ty = Canonical {
1727 value: self.ty.value.clone(),
1728 binders: CanonicalVarKinds::empty(&Interner),
1729 };
1727 method_resolution::implements_trait( 1730 method_resolution::implements_trait(
1728 &canonical_ty, 1731 &canonical_ty,
1729 db, 1732 db,
@@ -1745,7 +1748,10 @@ impl Type {
1745 None => return false, 1748 None => return false,
1746 }; 1749 };
1747 1750
1748 let canonical_ty = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) }; 1751 let canonical_ty = Canonical {
1752 value: self.ty.value.clone(),
1753 binders: CanonicalVarKinds::empty(&Interner),
1754 };
1749 method_resolution::implements_trait_unique( 1755 method_resolution::implements_trait_unique(
1750 &canonical_ty, 1756 &canonical_ty,
1751 db, 1757 db,
@@ -1769,7 +1775,7 @@ impl Type {
1769 self.ty.environment.clone(), 1775 self.ty.environment.clone(),
1770 trait_ref.cast(&Interner), 1776 trait_ref.cast(&Interner),
1771 ), 1777 ),
1772 kinds: Arc::new([]), 1778 binders: CanonicalVarKinds::empty(&Interner),
1773 }; 1779 };
1774 1780
1775 db.trait_solve(self.krate, goal).is_some() 1781 db.trait_solve(self.krate, goal).is_some()
@@ -1786,8 +1792,8 @@ impl Type {
1786 .push(self.ty.value.clone()) 1792 .push(self.ty.value.clone())
1787 .fill(args.iter().map(|t| t.ty.value.clone())) 1793 .fill(args.iter().map(|t| t.ty.value.clone()))
1788 .build(); 1794 .build();
1789 let goal = Canonical { 1795 let goal = Canonical::new(
1790 value: InEnvironment::new( 1796 InEnvironment::new(
1791 self.ty.environment.clone(), 1797 self.ty.environment.clone(),
1792 AliasEq { 1798 AliasEq {
1793 alias: AliasTy::Projection(ProjectionTy { 1799 alias: AliasTy::Projection(ProjectionTy {
@@ -1799,8 +1805,8 @@ impl Type {
1799 } 1805 }
1800 .cast(&Interner), 1806 .cast(&Interner),
1801 ), 1807 ),
1802 kinds: Arc::new([TyVariableKind::General]), 1808 [TyVariableKind::General].iter().copied(),
1803 }; 1809 );
1804 1810
1805 match db.trait_solve(self.krate, goal)? { 1811 match db.trait_solve(self.krate, goal)? {
1806 Solution::Unique(SolutionVariables(subst)) => { 1812 Solution::Unique(SolutionVariables(subst)) => {
@@ -1911,7 +1917,10 @@ impl Type {
1911 pub fn autoderef<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator<Item = Type> + 'a { 1917 pub fn autoderef<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator<Item = Type> + 'a {
1912 // There should be no inference vars in types passed here 1918 // There should be no inference vars in types passed here
1913 // FIXME check that? 1919 // FIXME check that?
1914 let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) }; 1920 let canonical = Canonical {
1921 value: self.ty.value.clone(),
1922 binders: CanonicalVarKinds::empty(&Interner),
1923 };
1915 let environment = self.ty.environment.clone(); 1924 let environment = self.ty.environment.clone();
1916 let ty = InEnvironment { value: canonical, environment }; 1925 let ty = InEnvironment { value: canonical, environment };
1917 autoderef(db, Some(self.krate), ty) 1926 autoderef(db, Some(self.krate), ty)
@@ -1962,7 +1971,10 @@ impl Type {
1962 // There should be no inference vars in types passed here 1971 // There should be no inference vars in types passed here
1963 // FIXME check that? 1972 // FIXME check that?
1964 // FIXME replace Unknown by bound vars here 1973 // FIXME replace Unknown by bound vars here
1965 let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) }; 1974 let canonical = Canonical {
1975 value: self.ty.value.clone(),
1976 binders: CanonicalVarKinds::empty(&Interner),
1977 };
1966 1978
1967 let env = self.ty.environment.clone(); 1979 let env = self.ty.environment.clone();
1968 let krate = krate.id; 1980 let krate = krate.id;
@@ -1993,7 +2005,10 @@ impl Type {
1993 // There should be no inference vars in types passed here 2005 // There should be no inference vars in types passed here
1994 // FIXME check that? 2006 // FIXME check that?
1995 // FIXME replace Unknown by bound vars here 2007 // FIXME replace Unknown by bound vars here
1996 let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) }; 2008 let canonical = Canonical {
2009 value: self.ty.value.clone(),
2010 binders: CanonicalVarKinds::empty(&Interner),
2011 };
1997 2012
1998 let env = self.ty.environment.clone(); 2013 let env = self.ty.environment.clone();
1999 let krate = krate.id; 2014 let krate = krate.id;