aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/utils.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-03-24 22:07:54 +0000
committerFlorian Diebold <[email protected]>2021-03-24 22:10:13 +0000
commitb4c20e3589372ba1536cec1bfe7de6acd2f40a4d (patch)
tree18a40f362334376c31afbc41cdd8a304f6b6d23d /crates/hir_ty/src/utils.rs
parent4a1f5d367db3b5c6ec27d96c96c98b89988c0b3a (diff)
Fix chalk_ir assertion
Fixes #8150.
Diffstat (limited to 'crates/hir_ty/src/utils.rs')
-rw-r--r--crates/hir_ty/src/utils.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs
index 19874e42b..42d7af146 100644
--- a/crates/hir_ty/src/utils.rs
+++ b/crates/hir_ty/src/utils.rs
@@ -2,6 +2,7 @@
2//! query, but can't be computed directly from `*Data` (ie, which need a `db`). 2//! query, but can't be computed directly from `*Data` (ie, which need a `db`).
3use std::sync::Arc; 3use std::sync::Arc;
4 4
5use chalk_ir::DebruijnIndex;
5use hir_def::{ 6use hir_def::{
6 adt::VariantData, 7 adt::VariantData,
7 db::DefDatabase, 8 db::DefDatabase,
@@ -15,7 +16,7 @@ use hir_def::{
15}; 16};
16use hir_expand::name::{name, Name}; 17use hir_expand::name::{name, Name};
17 18
18use crate::{db::HirDatabase, TraitRef, WhereClause}; 19use crate::{db::HirDatabase, TraitRef, TypeWalk, WhereClause};
19 20
20fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> { 21fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> {
21 let resolver = trait_.resolver(db); 22 let resolver = trait_.resolver(db);
@@ -64,7 +65,10 @@ fn direct_super_trait_refs(db: &dyn HirDatabase, trait_ref: &TraitRef) -> Vec<Tr
64 .iter() 65 .iter()
65 .filter_map(|pred| { 66 .filter_map(|pred| {
66 pred.as_ref().filter_map(|pred| match pred.skip_binders() { 67 pred.as_ref().filter_map(|pred| match pred.skip_binders() {
67 WhereClause::Implemented(tr) => Some(tr.clone()), 68 // FIXME: how to correctly handle higher-ranked bounds here?
69 WhereClause::Implemented(tr) => {
70 Some(tr.clone().shift_bound_vars_out(DebruijnIndex::ONE))
71 }
68 _ => None, 72 _ => None,
69 }) 73 })
70 }) 74 })