From fa65d6ba855fb2da68840b987bfdec258239a59b Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 17 Dec 2020 22:01:42 +0100 Subject: Higher-ranked trait bounds for where clauses --- crates/hir_ty/src/lower.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'crates/hir_ty/src/lower.rs') diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 8392cb770..8da56cd11 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -675,7 +675,8 @@ impl GenericPredicate { where_predicate: &'a WherePredicate, ) -> impl Iterator + 'a { match where_predicate { - WherePredicate::TypeBound { target, bound } => { + WherePredicate::ForLifetime { target, bound, .. } + | WherePredicate::TypeBound { target, bound } => { let self_ty = match target { WherePredicateTypeTarget::TypeRef(type_ref) => Ty::from_hir(ctx, type_ref), WherePredicateTypeTarget::TypeParam(param_id) => { @@ -888,14 +889,13 @@ pub(crate) fn generic_predicates_for_param_query( .where_predicates_in_scope() // we have to filter out all other predicates *first*, before attempting to lower them .filter(|pred| match pred { - WherePredicate::TypeBound { - target: WherePredicateTypeTarget::TypeRef(type_ref), - .. - } => Ty::from_hir_only_param(&ctx, type_ref) == Some(param_id), - WherePredicate::TypeBound { - target: WherePredicateTypeTarget::TypeParam(local_id), - .. - } => *local_id == param_id.local_id, + WherePredicate::ForLifetime { target, .. } + | WherePredicate::TypeBound { target, .. } => match target { + WherePredicateTypeTarget::TypeRef(type_ref) => { + Ty::from_hir_only_param(&ctx, type_ref) == Some(param_id) + } + WherePredicateTypeTarget::TypeParam(local_id) => *local_id == param_id.local_id, + }, WherePredicate::Lifetime { .. } => false, }) .flat_map(|pred| { -- cgit v1.2.3