Use special DefIds for aliases#155025
Closed
ChayimFriedman2 wants to merge 1 commit intorust-lang:mainfrom
Closed
Conversation
Like we do for other things for better experience in rust-analyzer. It's possible now that the `AliasTyKind` contains the DefId. It does require a few unwraps since `AliasTermKind` still does not contain the DefId and some things only include a DefId with no kind, but IMO it's still better.
Member
|
LGTM but I want to r? lcnr |
lcnr
reviewed
Apr 13, 2026
Comment on lines
+43
to
+47
| type ProjectionTyId = DefId; | ||
| type ProjectionId = DefId; | ||
| type OpaqueId = DefId; | ||
| type FreeAliasId = DefId; | ||
| type ImplTyAliasId = DefId; |
Contributor
There was a problem hiding this comment.
Suggested change
| type ProjectionTyId = DefId; | |
| type ProjectionId = DefId; | |
| type OpaqueId = DefId; | |
| type FreeAliasId = DefId; | |
| type ImplTyAliasId = DefId; | |
| type DefinitionAssocTyId = DefId; | |
| type DefinitionAssocTermId = DefId; | |
| type OpaqueTyId = DefId; | |
| type FreeAliasId = DefId; | |
| type ImplAssocTyId = DefId; |
maybe?
generally r=me, I did consider the fact that we can do this with our AliasTy changes
lcnr
reviewed
Apr 13, 2026
lcnr
reviewed
Apr 13, 2026
Comment on lines
+628
to
+637
| AliasTermKind::ProjectionTy => { | ||
| AliasTyKind::Projection { def_id: self.def_id.try_into().unwrap() } | ||
| } | ||
| AliasTermKind::InherentTy => { | ||
| AliasTyKind::Inherent { def_id: self.def_id.try_into().unwrap() } | ||
| } | ||
| AliasTermKind::OpaqueTy => { | ||
| AliasTyKind::Opaque { def_id: self.def_id.try_into().unwrap() } | ||
| } | ||
| AliasTermKind::FreeTy => AliasTyKind::Free { def_id: self.def_id.try_into().unwrap() }, |
Contributor
There was a problem hiding this comment.
e.g. this is kind of a mess and will be unnecessary once AliasTermKind also contains the specific defIds
Contributor
Author
|
Whatever you prefer. I wasn't sure if it is planned for |
Contributor
|
ye, should happen soon, cc @WaffleLapkin :3 |
Member
|
I'm indeed working on refactoring |
Contributor
|
☔ The latest upstream changes (presumably #155223) made this pull request unmergeable. Please resolve the merge conflicts. |
Contributor
Author
|
I'm closing this for now then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Like we do for other things for better experience in rust-analyzer.
It's possible now that the
AliasTyKindcontains the DefId. It does require a few unwraps sinceAliasTermKindstill does not contain the DefId and some things only include a DefId with no kind, but IMO it's still better.r? types