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

[ra-ap-hir] hir::VariantDef can be impl HasSource #19302

Open
snprajwal opened this issue Mar 6, 2025 · 2 comments · May be fixed by #19314
Open

[ra-ap-hir] hir::VariantDef can be impl HasSource #19302

snprajwal opened this issue Mar 6, 2025 · 2 comments · May be fixed by #19314
Labels
C-feature Category: feature request

Comments

@snprajwal
Copy link

Similar to how all variants of hir::Adt are HasSource, allowing the enum itself to be impl HasSource, the same can be done for hir::VariantDef. This would require introducing a new ast::VariantDef enum in ra-ap-syntax to be able to map the source between the two.

@snprajwal snprajwal added the C-feature Category: feature request label Mar 6, 2025
@ChayimFriedman2
Copy link
Contributor

Do you actually need this for your project, or do you just want it to be included for completeness?

@snprajwal
Copy link
Author

Purely for completeness. It's quite trivial to work around this with a match block - it just adds consistency to the API since every other sum type I'm aware of implements traits that all variants implement. If acceptable, I'd be happy to put a PR up!

@snprajwal snprajwal linked a pull request Mar 7, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants