windows-clang normalize unmerged scalar signatures - #4763
Merged
Merged
Conversation
8 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the windows-metadata cross-architecture merge logic to normalize certain unmanaged callback (delegate) signatures to native-sized integers when there is explicit native-sized evidence (isize/usize) in at least one architecture. This reduces arch-split surface area for callback typedefs like FARPROC/NEARPROC/PROC, and regenerates the downstream metadata and bindings accordingly.
Changes:
- Add a targeted merge reconciliation for unmanaged callback
Invokesignatures when fixed-width integers match pointer width and at least one arch usesisize/usize. - Regenerate Win32
minwindefmetadata +windows/windows-sys/windows-corebindings to remove x86-specific fixed-width callback variants. - Document the new merge rule and add tests covering acceptance and rejection cases.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| metadata/win32/minwindef.rdl | Removes per-arch callback signatures for FARPROC/NEARPROC/PROC in favor of a single native-sized signature. |
| docs/crates/windows-metadata.md | Documents the new unmanaged-callback native-sized reconciliation in the arch merge rules. |
| docs/crates/windows-clang.md | Updates the issue findings table to reflect that FARPROC normalization is now handled by the merger. |
| crates/tests/libs/metadata/tests/merge.rs | Adds unit tests validating the new reconciliation behavior and several rejection conditions. |
| crates/libs/windows/src/Windows/Win32/minwindef/mod.rs | Regenerates the windows crate projection so callback typedefs no longer vary by arch. |
| crates/libs/sys/src/Windows/Win32/minwindef/mod.rs | Regenerates the windows-sys projection so callback typedefs no longer vary by arch. |
| crates/libs/metadata/src/merge/mod.rs | Implements the callback-signature normalization and signature override plumbing when writing merged winmds. |
| crates/libs/core/src/imp/bindings.rs | Regenerates core bindings (FARPROC) to match the merged metadata output. |
Comment on lines
+53
to
+58
| Unmanaged callbacks have one narrow semantic reconciliation before that split. If at least one | ||
| architecture explicitly uses `isize` or `usize` and every other copy uses the same native-sized | ||
| integer for its architecture (`i32`/`u32` on x86, `i64`/`u64` on x64 or arm64), the callback keeps | ||
| the native-sized type and becomes arch-neutral. This handles SDK declarations such as `FARPROC`, | ||
| whose return is spelled `INT_PTR` on 64-bit but historical `int` on x86. A plain `i32`/`i64` pair | ||
| does not qualify: the explicit native-sized spelling is required as semantic evidence. |
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.
No description provided.