Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public direct_supertraits(…) & all_supertraits(…) accessor methods to hir::Trait #18482

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

regexident
Copy link
Contributor

@regexident regexident commented Nov 6, 2024

Hi @Veykril,

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.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants