From b4c20e3589372ba1536cec1bfe7de6acd2f40a4d Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 24 Mar 2021 23:07:54 +0100 Subject: Fix chalk_ir assertion Fixes #8150. --- crates/hir_ty/src/utils.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/hir_ty/src/utils.rs') 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 @@ //! query, but can't be computed directly from `*Data` (ie, which need a `db`). use std::sync::Arc; +use chalk_ir::DebruijnIndex; use hir_def::{ adt::VariantData, db::DefDatabase, @@ -15,7 +16,7 @@ use hir_def::{ }; use hir_expand::name::{name, Name}; -use crate::{db::HirDatabase, TraitRef, WhereClause}; +use crate::{db::HirDatabase, TraitRef, TypeWalk, WhereClause}; fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec { let resolver = trait_.resolver(db); @@ -64,7 +65,10 @@ fn direct_super_trait_refs(db: &dyn HirDatabase, trait_ref: &TraitRef) -> Vec Some(tr.clone()), + // FIXME: how to correctly handle higher-ranked bounds here? + WhereClause::Implemented(tr) => { + Some(tr.clone().shift_bound_vars_out(DebruijnIndex::ONE)) + } _ => None, }) }) -- cgit v1.2.3