feat(rdl): add #[nested(OuterTypeName)] attribute for roundtripping nested types#4185
Draft
feat(rdl): add #[nested(OuterTypeName)] attribute for roundtripping nested types#4185
#[nested(OuterTypeName)] attribute for roundtripping nested types#4185Conversation
…ested types Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/6f230065-b98b-4bc2-a7f6-1e2da476fdbe Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
kennykerr
April 14, 2026 18:34
View session
Collaborator
|
@copilot fmt failed |
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/d35c2ba0-9fbd-4fc2-95b8-f355ba13f68a Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
Contributor
Author
Collaborator
|
@copilot please run |
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/28c8e21b-ac8b-4e6b-80ad-7844954a8b35 Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
Contributor
Author
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.
Windows metadata uses nested types (anonymous inner structs/unions) that
windows-rdlflattens when writing RDL, but previously had no mechanism to reconstruct the nesting relationship when reading back. This adds a#[nested(OuterTypeName)]pseudo-attribute that roundtrips theNestedPublicflag andNestedClassmetadata records.Writer (
writer/struct.rs)collect_nestednow emits#[nested(OuterFlatName)]on every un-nested helper type:Reader (
reader/)mod.rs: Addedtypedef_ids: HashMap<String, TypeDef>toEncodertracking TypeDef row IDs in encoding order. Addedread_nestedhelper parsing#[nested(Ident)].struct.rs:encode_structreads#[nested], setsNestedPublicflag (instead ofPublic) with empty namespace on the TypeDef, emits aNestedClassrecord linking inner→outer using the tracked ID map, and excludes"nested"fromencode_attrs. Errors if the outer type hasn't been encoded yet.union.rs: Same treatment forencode_union.Tests
nested-packing.rdlandnested-arches.rdlto include the new#[nested]attributes.nested-flat.rdlcovering single and double nesting levels.#[nested](no argument) and out-of-order outer type declaration.Formatting
cargo fmtacross the entire workspace.