aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/utils.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-24 22:13:56 +0000
committerGitHub <[email protected]>2021-03-24 22:13:56 +0000
commit9d81618f11eb403cc0644a22f30648393ec77cf6 (patch)
treeebc9bc3b6d19b7d31e888239856dc336d729ffe3 /crates/hir_ty/src/utils.rs
parentaac6285f0bfe60e20e042963fdda9e454e08a7ad (diff)
parentb4c20e3589372ba1536cec1bfe7de6acd2f40a4d (diff)
Merge #8190
8190: Fix chalk_ir assertion r=flodiebold a=flodiebold Fixes #8150. I implemented a validator that catches this in the tests, but it'd need to get merged in Chalk first. Co-authored-by: Florian Diebold <[email protected]>
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 })