Skip to content

Diagnose trait impl items that don't exist in the implementing trait #15958

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

Closed
Veykril opened this issue Nov 24, 2023 · 3 comments · Fixed by #16223
Closed

Diagnose trait impl items that don't exist in the implementing trait #15958

Veykril opened this issue Nov 24, 2023 · 3 comments · Fixed by #16223
Assignees
Labels
A-diagnostics diagnostics / error reporting C-feature Category: feature request

Comments

@Veykril
Copy link
Member

Veykril commented Nov 24, 2023

And offer a quickfix to add the corresponding trait item to the trait

@Veykril Veykril added A-diagnostics diagnostics / error reporting C-feature Category: feature request labels Nov 24, 2023
@Young-Flash
Copy link
Member

@rustbot claim

@Young-Flash
Copy link
Member

Young-Flash commented Dec 7, 2023

hi, I am thinking about "add the corresponding trait item to the trait", we could get hir::Trait when we construct that diagnostic, but how could we get the corresponding ast::Trait to add some trait item into it? search in the codebase but can't find some related internal api to do that(I still not familar enough with internal api in RA), any suggestion?

EDIT: found fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> in hir::Trait, which help to got the corresponding ast::Trait (with the help of bloop)

@Veykril
Copy link
Member Author

Veykril commented Dec 7, 2023

Might be good to check what the add missing impl members assist does here as that is basically the same thing but in the other direction

bors added a commit that referenced this issue Dec 7, 2023
…=Veykril

feat: add trait_impl_reduntant_assoc_item diagnostic

part of #15958, will try to add quickfix for the diagnostic if this PR is ok with you guys
@bors bors closed this as completed in 2980d54 Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting C-feature Category: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants