adjust hir_def::TypeBound::as_path

This commit is contained in:
Dawer 2021-06-14 17:36:56 +05:00
parent b217e9cc50
commit d9e6377b91
3 changed files with 13 additions and 6 deletions

View file

@ -13,7 +13,7 @@ use hir_def::{
intern::Interned,
path::Path,
resolver::{HasResolver, TypeNs},
type_ref::TypeRef,
type_ref::{TraitBoundModifier, TypeRef},
AssocContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, TypeParamId,
};
use hir_expand::name::{name, Name};
@ -58,6 +58,10 @@ fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> {
},
WherePredicate::Lifetime { .. } => None,
})
.filter_map(|(path, bound_modifier)| match bound_modifier {
TraitBoundModifier::None => Some(path),
TraitBoundModifier::Maybe => None,
})
.filter_map(|path| match resolver.resolve_path_in_type_ns_fully(db, path.mod_path()) {
Some(TypeNs::TraitId(t)) => Some(t),
_ => None,