feat: Implement default-field-values#19001
Merged
Veykril merged 8 commits intorust-lang:masterfrom Jan 27, 2025
Merged
Conversation
4adec34 to
3b0f463
Compare
Veykril
reviewed
Jan 25, 2025
Veykril
reviewed
Jan 25, 2025
64677bb to
88b70c8
Compare
Veykril
approved these changes
Jan 27, 2025
Member
Veykril
left a comment
There was a problem hiding this comment.
One small thing but otherwise lgtm!
crates/hir-def/src/lib.rs
Outdated
| pub struct FieldId { | ||
| pub parent: VariantId, | ||
| pub local_id: LocalFieldId, | ||
| pub has_default: bool, |
Member
There was a problem hiding this comment.
I just realized we have t his in FieldData already, so we can't we reuse that instead? If we have the ID we can trivially index into the variant_data where required.
crates/hir/src/lib.rs
Outdated
| .fields() | ||
| .iter() | ||
| .map(|(id, _)| Field { parent: self.into(), id }) | ||
| .map(|(id, d)| Field { parent: self.into(), id, has_default: d.has_default }) |
Member
There was a problem hiding this comment.
That is here we can fetch it via variant_data[id] since we already have db.struct_data(self.id).variant_data anyways
Member
Author
|
I'm rebasing to resolve conflicts 😄 |
Member
|
Ah, sorry :) |
c7949cf to
8aa6c09
Compare
Member
Author
|
Nevermind. They were quite easy to resolve |
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 28, 2025
…-default-fields internal: backout `hir-*` changes from #19001
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.
Resolves #18938