I need to access a trait's supertraits (as external user of ra_ap's APIs) and while hir_ty::all_super_traits() already provides such capabilities to a limited degree I'd like to propose the following accessors on hir::Trait itself, it only does provide access to the entire trait hierarchy (while I only want the direct supertraits) and requires a descent into hir_ty land. I'd thus like to propose adding the following methods: hir::Trait::direct_supertraits(db) & hir::Trait::all_supertraits(db).
There seems to be some naming inconsistency with regard to supertrait (43 occurrences) vs. super_trait (53 occurrences) in the codebase. (I'd be happy to open a follow-up PR unifying the project-wide naming, if so desired.)
I went with supertraits in this PR since that's what the already existing hir::Trait::items_with_supertraits(…) uses in close proximity to the newly added methods.
Hi @Veykril,
I need to access a trait's supertraits (as external user of
ra_ap
's APIs) and whilehir_ty::all_super_traits()
already provides such capabilities to a limited degree I'd like to propose the following accessors onhir::Trait
itself, it only does provide access to the entire trait hierarchy (while I only want the direct supertraits) and requires a descent intohir_ty
land. I'd thus like to propose adding the following methods:hir::Trait::direct_supertraits(db)
&hir::Trait::all_supertraits(db)
.There seems to be some naming inconsistency with regard to
supertrait
(43 occurrences) vs.super_trait
(53 occurrences) in the codebase. (I'd be happy to open a follow-up PR unifying the project-wide naming, if so desired.) I went withsupertraits
in this PR since that's what the already existinghir::Trait::items_with_supertraits(…)
uses in close proximity to the newly added methods.