Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/display.rs')
-rw-r--r--crates/hir-ty/src/display.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/crates/hir-ty/src/display.rs b/crates/hir-ty/src/display.rs
index 39d6083b35..128dd42f73 100644
--- a/crates/hir-ty/src/display.rs
+++ b/crates/hir-ty/src/display.rs
@@ -16,9 +16,7 @@ use hir_def::{
db::DefDatabase,
expr_store::{ExpressionStore, path::Path},
find_path::{self, PrefixKind},
- hir::generics::{
- TypeOrConstParamData, TypeParamProvenance, WherePredicate, WherePredicateTypeTarget,
- },
+ hir::generics::{TypeOrConstParamData, TypeParamProvenance, WherePredicate},
item_scope::ItemInNs,
item_tree::FieldsShape,
lang_item::{LangItem, LangItemTarget},
@@ -2119,15 +2117,15 @@ impl HirDisplayWithExpressionStore for TypeRefId {
generic_params
.where_predicates()
.filter_map(|it| match it {
- WherePredicate::TypeBound {
- target: WherePredicateTypeTarget::TypeOrConstParam(p),
- bound,
+ WherePredicate::TypeBound { target, bound }
+ | WherePredicate::ForLifetime { lifetimes: _, target, bound }
+ if matches!(
+ store[*target],
+ TypeRef::TypeParam(t) if t == *param
+ ) =>
+ {
+ Some(bound)
}
- | WherePredicate::ForLifetime {
- lifetimes: _,
- target: WherePredicateTypeTarget::TypeOrConstParam(p),
- bound,
- } if *p == param.local_id() => Some(bound),
_ => None,
})
.map(ExpressionStoreAdapter::wrap(store)),