Skip to content

Remove dead Windows error tables#31995

Open
alii wants to merge 5 commits into
mainfrom
claude/split/windows-tables
Open

Remove dead Windows error tables#31995
alii wants to merge 5 commits into
mainfrom
claude/split/windows-tables

Conversation

@alii

@alii alii commented Jun 8, 2026

Copy link
Copy Markdown
Member

What this does

Removes dead Windows error-handling code and dedups the errno enum listings. Zero intended behavior change.

  • src/sys/windows/mod.rs: deletes the #[cfg(any())]-parked 1,188-variant MS-ERREF reference table (never compiled) and win_sock_error_to_zig_error, which had no callers.
  • src/windows_sys/externs.rs: deletes the WinsockError newtype, whose only consumer was that converter. bun_windows_sys::Win32Error remains the single compiled WSA table (already the one bun_errno uses).
  • src/errno/windows_errno.rs: enum E and enum SystemErrno were two hand-maintained 138-variant listings that must stay in lockstep (ordinals drive SystemErrno::to_e). Both are now emitted from one shared for_each_linux_errno! X-macro list, the same pattern the existing for_each_uv_errno! tail already uses.

Net -3.2k lines. Split from #31912 (closed in favor of module-scoped splits).

Verification

  • win_sock_error_to_zig_error and WinsockError have no references outside their own definition sites on main.
  • Macro expansion of bun_errno (-Zunpretty=expanded, x86_64-pc-windows-msvc) before and after: the enum E and enum SystemErrno bodies are identical in variant names, values, and order. The only textual difference is a doc comment on ENOTSUP that became a regular comment in the macro list.
  • cargo check --workspace passes for x86_64-pc-windows-msvc and aarch64-pc-windows-msvc, the only targets that compile windows_errno.rs and sys/windows/mod.rs (both #[cfg(windows)]-gated; the externs.rs hunk removes declarations only). rust-check-all also passed all 10 targets on the original commit.

No runtime test accompanies this PR because there is no behavior to pin down: the deleted items had zero references, and the enum dedup expands to identical code, so no test can distinguish before from after on any platform. The expansion diff above is the equivalence proof.

@robobun

robobun commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator
Updated 12:05 AM PT - Jun 10th, 2026

@robobun, your commit fdf490b has 2 failures in Build #61611 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 31995

That installs a local version of the PR into your bun-31995 executable, so you can run:

bun-31995 --bun

@alii alii marked this pull request as ready for review June 9, 2026 20:18
@alii

alii commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

@robobun adopt

@alii alii force-pushed the claude/split/windows-tables branch from b500c6b to 4e22c28 Compare June 9, 2026 20:19
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5cfcceb6-fa50-4dda-ab53-370263d9fa30

📥 Commits

Reviewing files that changed from the base of the PR and between c49743f and f6f3c1b.

📒 Files selected for processing (1)
  • src/windows_sys/externs.rs

Walkthrough

The pull request refactors Windows errno enum generation to use a unified X-macro scheme combining Linux and UV error lists, removes the WinsockError public type from Winsock bindings, and clarifies the design intent for Win32Error API stability.

Changes

Windows errno enum generation refactoring

Layer / File(s) Summary
Errno macro system documentation and design
src/errno/windows_errno.rs
Expanded comments explain how the Linux error head and UV error tail lists remain in lockstep and drive discriminant/ordinal assignment for both enum E and enum SystemErrno.
Errno X-macro implementation and E enum generation
src/errno/windows_errno.rs
Introduces for_each_linux_errno!, __errno_enum_add_uv_tail, and __errno_enum macros that generate #[repr(u16)] enums from the combined Linux head and UV tail variants; replaces the prior explicit E enum body with macro-driven emission.
SystemErrno enum generation via unified macros
src/errno/windows_errno.rs
Replaces explicit SystemErrno enum definition with a macro invocation that emits the prefixed variant from the same Linux head plus UV tail mechanism.

Windows error API surface updates

Layer / File(s) Summary
WinsockError type and constants removal
src/windows_sys/externs.rs
Removes the WinsockError(pub u16) newtype and its table of WSA*/WSAE* Winsock constants from the ws2_32 extern module.
Win32Error API design clarification
src/windows_sys/externs.rs
Updates the Win32Error documentation to clarify that only the subset referenced by lower-tier crates is exposed and that new MS-ERREF constants can be added without ABI breakage.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Remove dead Windows error tables' accurately summarizes the main objective of deleting unused Windows error-handling code and deduplicating enum listings.
Description check ✅ Passed The pull request description covers both required sections: it explains what the PR does (deletions and refactoring) and provides detailed verification steps (checked references, macro expansion, cargo check results).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@robobun

robobun commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Adopted and verified: deleted symbols have no callers, the E/SystemErrno macro expansion matches main exactly (-Zunpretty=expanded, x86_64-pc-windows-msvc), both Windows triples pass cargo check, review feedback addressed. Full equivalence proof in the PR body.

Build 61611 finished: all Windows lanes passed, and they are the only lanes that compile this diff (all three files are Windows-gated or unreferenced declarations). The two red lanes are Linux-only flakes unrelated to the change: streams-leak.test.ts (wire-coalescing chunk count) on x64-baseline, and complex-workspace.test.ts (git killed with signal 9 during setup) plus html-rewriter-leak.test.ts (RSS threshold) on ASAN. Ready to merge.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/windows_sys/externs.rs`:
- Around line 952-954: Update the doc comment in externs.rs so it correctly
describes the tiering: state that the subset referenced by lower-tier crates is
the named subset, while errno/bun_errno mapping is a higher-tier concern (i.e.,
T0 must not depend on T1), not the other way around; specifically, replace the
sentence that says "`errno` is a lower-tier crate" with wording that identifies
`bun_errno`/`errno` as the higher-tier mapping and clarifies that new MS-ERREF
consts may be added without ABI change, matching the T0/T1 contract referenced
elsewhere.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4fd69d21-3e89-4ca9-a634-5e407a3ff86e

📥 Commits

Reviewing files that changed from the base of the PR and between a988615 and c49743f.

📒 Files selected for processing (3)
  • src/errno/windows_errno.rs
  • src/sys/windows/mod.rs
  • src/windows_sys/externs.rs

Comment thread src/windows_sys/externs.rs Outdated
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