Skip to content

Conversation

@ShoyuVanilla
Copy link
Member

Resolves #18938

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 22, 2025
@ShoyuVanilla ShoyuVanilla force-pushed the default-field-values branch 3 times, most recently from 4adec34 to 3b0f463 Compare January 24, 2025 16:07
@ShoyuVanilla ShoyuVanilla force-pushed the default-field-values branch 2 times, most recently from 64677bb to 88b70c8 Compare January 26, 2025 16:09
Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small thing but otherwise lgtm!

pub struct FieldId {
pub parent: VariantId,
pub local_id: LocalFieldId,
pub has_default: bool,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

.fields()
.iter()
.map(|(id, _)| Field { parent: self.into(), id })
.map(|(id, d)| Field { parent: self.into(), id, has_default: d.has_default })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is here we can fetch it via variant_data[id] since we already have db.struct_data(self.id).variant_data anyways

@ShoyuVanilla
Copy link
Member Author

I'm rebasing to resolve conflicts 😄

@Veykril
Copy link
Member

Veykril commented Jan 27, 2025

Ah, sorry :)

@ShoyuVanilla
Copy link
Member Author

Nevermind. They were quite easy to resolve

@Veykril Veykril added this pull request to the merge queue Jan 27, 2025
Merged via the queue into rust-lang:master with commit 6862329 Jan 27, 2025
9 checks passed
@ShoyuVanilla ShoyuVanilla deleted the default-field-values branch January 27, 2025 12:18
github-merge-queue bot pushed a commit that referenced this pull request Jan 28, 2025
…-default-fields

internal: backout `hir-*` changes from #19001
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.

default_field_values grammar

3 participants