diff options
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/lib.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index e3ac37e4c..a325b6691 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -57,8 +57,8 @@ use hir_ty::{ | |||
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, Cast, DebruijnIndex, |
60 | InEnvironment, Interner, ProjectionTy, Scalar, Substitution, Ty, TyDefId, TyKind, | 60 | InEnvironment, Interner, ProjectionTy, QuantifiedWhereClause, Scalar, Substitution, Ty, |
61 | TyVariableKind, WhereClause, | 61 | TyDefId, TyKind, TyVariableKind, WhereClause, |
62 | }; | 62 | }; |
63 | use itertools::Itertools; | 63 | use itertools::Itertools; |
64 | use rustc_hash::FxHashSet; | 64 | use rustc_hash::FxHashSet; |
@@ -1460,7 +1460,7 @@ impl TypeParam { | |||
1460 | pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait> { | 1460 | pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait> { |
1461 | db.generic_predicates_for_param(self.id) | 1461 | db.generic_predicates_for_param(self.id) |
1462 | .into_iter() | 1462 | .into_iter() |
1463 | .filter_map(|pred| match &pred.value { | 1463 | .filter_map(|pred| match &pred.skip_binders().skip_binders() { |
1464 | hir_ty::WhereClause::Implemented(trait_ref) => { | 1464 | hir_ty::WhereClause::Implemented(trait_ref) => { |
1465 | Some(Trait::from(trait_ref.hir_trait_id())) | 1465 | Some(Trait::from(trait_ref.hir_trait_id())) |
1466 | } | 1466 | } |
@@ -2022,7 +2022,7 @@ impl Type { | |||
2022 | pub fn as_impl_traits(&self, db: &dyn HirDatabase) -> Option<Vec<Trait>> { | 2022 | pub fn as_impl_traits(&self, db: &dyn HirDatabase) -> Option<Vec<Trait>> { |
2023 | self.ty.value.impl_trait_bounds(db).map(|it| { | 2023 | self.ty.value.impl_trait_bounds(db).map(|it| { |
2024 | it.into_iter() | 2024 | it.into_iter() |
2025 | .filter_map(|pred| match pred { | 2025 | .filter_map(|pred| match pred.skip_binders() { |
2026 | hir_ty::WhereClause::Implemented(trait_ref) => { | 2026 | hir_ty::WhereClause::Implemented(trait_ref) => { |
2027 | Some(Trait::from(trait_ref.hir_trait_id())) | 2027 | Some(Trait::from(trait_ref.hir_trait_id())) |
2028 | } | 2028 | } |
@@ -2061,11 +2061,11 @@ impl Type { | |||
2061 | fn walk_bounds( | 2061 | fn walk_bounds( |
2062 | db: &dyn HirDatabase, | 2062 | db: &dyn HirDatabase, |
2063 | type_: &Type, | 2063 | type_: &Type, |
2064 | bounds: &[WhereClause], | 2064 | bounds: &[QuantifiedWhereClause], |
2065 | cb: &mut impl FnMut(Type), | 2065 | cb: &mut impl FnMut(Type), |
2066 | ) { | 2066 | ) { |
2067 | for pred in bounds { | 2067 | for pred in bounds { |
2068 | match pred { | 2068 | match pred.skip_binders() { |
2069 | WhereClause::Implemented(trait_ref) => { | 2069 | WhereClause::Implemented(trait_ref) => { |
2070 | cb(type_.clone()); | 2070 | cb(type_.clone()); |
2071 | // skip the self type. it's likely the type we just got the bounds from | 2071 | // skip the self type. it's likely the type we just got the bounds from |
@@ -2107,7 +2107,12 @@ impl Type { | |||
2107 | } | 2107 | } |
2108 | } | 2108 | } |
2109 | TyKind::Dyn(bounds) => { | 2109 | TyKind::Dyn(bounds) => { |
2110 | walk_bounds(db, &type_.derived(ty.clone()), bounds.as_ref(), cb); | 2110 | walk_bounds( |
2111 | db, | ||
2112 | &type_.derived(ty.clone()), | ||
2113 | bounds.bounds.skip_binders().interned(), | ||
2114 | cb, | ||
2115 | ); | ||
2111 | } | 2116 | } |
2112 | 2117 | ||
2113 | TyKind::Ref(_, ty) | TyKind::Raw(_, ty) | TyKind::Array(ty) | TyKind::Slice(ty) => { | 2118 | TyKind::Ref(_, ty) | TyKind::Raw(_, ty) | TyKind::Array(ty) | TyKind::Slice(ty) => { |