Skip to content

refactor: fix nondeterministic ordering for foreign items - #1930

Open
ahomescu wants to merge 2 commits into
ahomescu/fix_reorganize_definitions/compare_extern_fn_sigsfrom
ahomescu/fix_reorganize_definitions/deterministic_externs
Open

ahomescu wants to merge 2 commits into
ahomescu/fix_reorganize_definitions/compare_extern_fn_sigsfrom
ahomescu/fix_reorganize_definitions/deterministic_externs

Conversation

@ahomescu

Copy link
Copy Markdown
Contributor

Stack created with GitHub Stacks CLIGive Feedback 💬

@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from a977cb9 to 6215ac5 Compare July 25, 2026 01:40
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 6215ac5 to 52adae1 Compare July 25, 2026 01:57
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 52adae1 to 6a8430a Compare July 25, 2026 02:07
@ahomescu
ahomescu changed the base branch from ahomescu/fix_reorganize_definitions/move_impls to ahomescu/fix_reorganize_definitions/multi_namespace_import_splitting July 25, 2026 02:11
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 6a8430a to 1606a2e Compare July 25, 2026 02:11
@ahomescu
ahomescu requested a review from thedataking July 25, 2026 02:23
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 1606a2e to 544e434 Compare July 25, 2026 05:09
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 544e434 to e433011 Compare July 25, 2026 05:33
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from e433011 to 52aa47f Compare July 25, 2026 05:41
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 52aa47f to 2ce43e0 Compare July 25, 2026 05:42
@ahomescu
ahomescu changed the base branch from ahomescu/fix_reorganize_definitions/multi_namespace_import_splitting to ahomescu/fix_reorganize_definitions/extern_abi_fallback July 25, 2026 05:48
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 2ce43e0 to ed36074 Compare July 25, 2026 05:48
@ahomescu
ahomescu changed the base branch from ahomescu/fix_reorganize_definitions/extern_abi_fallback to ahomescu/fix_reorganize_definitions/non_ascii_idents July 25, 2026 05:52
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from ed36074 to 0dad64a Compare July 25, 2026 05:52
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch 2 times, most recently from ebfa817 to a24258d Compare July 25, 2026 06:05
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from a24258d to 57d0cdc Compare July 25, 2026 06:16
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 57d0cdc to 6c83565 Compare July 25, 2026 06:26
@ahomescu
ahomescu removed the request for review from thedataking July 25, 2026 06:28
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch 2 times, most recently from 619c11b to 6737ee6 Compare August 4, 2026 02:41
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch 2 times, most recently from c13616e to 37567a7 Compare August 5, 2026 00:19
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 37567a7 to b23392a Compare August 5, 2026 00:22
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from b23392a to e166ab7 Compare August 5, 2026 00:43

@thedataking thedataking left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One additional finding from checking CI before recommending approvals for stack 1953: the new extern-block ordering fixture is not portable to the supported macOS ARM target.

Comment thread c2rust-refactor/tests/snapshots/reorganize_extern_block_order.rs Outdated
@ahomescu
ahomescu removed this pull request from stack #1953 September 9, 2026 01:38
@ahomescu
ahomescu changed the base branch from ahomescu/fix_reorganize_definitions/non_ascii_idents to ahomescu/fix_reorganize_definitions/use_comments September 9, 2026 01:38
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from e166ab7 to f66241e Compare September 9, 2026 01:41
@ahomescu
ahomescu added this pull request to stack #2004 September 9, 2026 01:42
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from f66241e to 21382cc Compare September 9, 2026 02:18
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from 21382cc to a82de55 Compare September 9, 2026 02:33
@ahomescu
ahomescu removed this pull request from stack #2004 September 17, 2026 00:38
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from a82de55 to f0fb7f9 Compare September 17, 2026 00:39
@ahomescu
ahomescu changed the base branch from ahomescu/fix_reorganize_definitions/use_comments to ahomescu/fix_reorganize_definitions/compare_extern_fn_sigs September 17, 2026 00:39
@ahomescu
ahomescu added this pull request to stack #2016 September 17, 2026 00:42
Add a snapshot test that merges two system headers into the same stdlib module, mixing regular items with foreign declarations using C and system ABIs.

The fixture exposes nondeterministic ABI group ordering and misplaced header boundary comments caused by hoisting extern blocks after assigning comments.
Group foreign items by header and ABI in an IndexMap to emit extern blocks
in deterministic source order and keep each block within a single header.
Assign BEGIN/END comments after hoisting the blocks so the comments match
the final item order.

Register fresh node IDs for generated extern blocks so their header
comments survive emission. Update the affected snapshots and the extern
block ordering test documentation.
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/deterministic_externs branch from f0fb7f9 to b25b028 Compare September 17, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants