Repository navigation
Conversation
…nJSCModule.h No code uses these items on any target: - bun_windows_sys::externs: MAX_PATH, SYMBOLIC_LINK_FLAG_DIRECTORY, SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE and the ProcessParameters alias, with their re-exports in bun_sys::windows and bun_core::windows_sys. - bun_sys: the Windows posix::timespec struct. - bun_libuv_sys: open_handles::count. - BunJSCModule.h: the unused StringPrintStream local in functionStartSamplingProfiler.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: oven-sh/bun/.coderabbit.yaml Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review. WalkthroughThe changes remove unused public Windows declarations and re-exports, the Windows-only ChangesUnused public declaration removals
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No material in-repository behavior change or merge blocker was identified. Compatibility expectations for out-of-repository Rust consumers are not established by repository evidence. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.
Beyond the inline finding (which is pre-existing, not introduced here), I also checked the Windows-gated consumers that Linux CI does not type-check: the only bun_sys::posix::timespec user (src/io/posix_event_loop.rs:1507) is #[cfg(target_os = "macos")], the .bin launcher's pub use bun_windows_sys::* glob only touches the PEB.ProcessParameters field rather than the deleted alias, win_symlink_impl keeps its own private SYMBOLIC_LINK_FLAG_* copies, and StringPrintStream is still used later in BunJSCModule.h. The now-stale unused_pub slack in mordant-baseline.toml is harmless since the ratchet only fails when a count exceeds the baseline.
Extended reasoning...
Six-file dead-code removal (30 deletions, 2 insertions) across bun_windows_sys, bun_sys, bun_core, bun_libuv_sys and one unused C++ local; no security-sensitive surface. Every Rust hunk is Windows-gated so it is not type-checked on this Linux host, but grepping the glob importers and cfg gates found no remaining references to any removed item. Not approving because a verified finding is posted inline and further verified findings were withheld from posting.
|
Status: ready for review. How each deletion was verified:
|
…fixes open_handles::count was the one finding in src/libuv_sys/open_handles.rs. The Windows posix::timespec struct was one of the findings in src/sys/lib.rs.
…e counts - An open pull request uses bun_sys::windows::MAX_PATH, so the constant and its re-export stay. - Another open pull request already removes the StringPrintStream local in functionStartSamplingProfiler, so this change leaves that line alone. - mordant-baseline.toml: open_handles::count was the one unused_pub finding in src/libuv_sys/open_handles.rs, and the Windows posix::timespec struct was one of the findings in src/sys/lib.rs.
There was a problem hiding this comment.
LGTM — straightforward dead-code deletion, verified safe on the cfg-gated side.
What was reviewed:
- Grepped the whole tree (including
#[cfg(windows)]/debug-only code) for every removed name: no remaining references;bun_windows_sysre-exportsexterns::*by glob, so nothing names the deleted items individually. - The only
bun_sys::posix::timespecuser (src/io/posix_event_loop.rs:1507) is#[cfg(target_os = "macos")], so dropping the Windows struct cannot break the Windows build of that shared module. win_symlink_impl's private flag copies are independent and its "not exported bybun_windows_sys" comment is now accurate;OPEN.handles/filesstill have readers aftercount()goes.- One note: the description still lists
MAX_PATHand thepathOutlocal under "Fix", but f59b7c0 restored both, so the description is slightly stale relative to the final diff.
Extended reasoning...
The change deletes six unused pub Rust items across the bun_windows_sys, bun_sys, bun_core, and bun_libuv_sys leaf crates (+3/-29) and lowers two unused_pub entries in mordant-baseline.toml to match. It touches no security-sensitive surface: the removed items are Win32 constant duplicates, a type alias, a debug-only counter, and an unused struct, none of which are on an auth, crypto, or input-validation path. Every removed name was grepped repo-wide with no remaining users, the sole posix::timespec consumer is macOS-gated, and the baseline edits correspond one-to-one with the deletions, which is what decided approve. No CODEOWNERS entry covers the changed files and the timeline shows no outstanding third-party objection; the latest commit narrowed scope by restoring MAX_PATH and a C++ local, so the final diff is Rust-only.
|
Two more items in the crates of this PR have no user on
Evidence: History: #45698 withdrew both on 2026-10-18, because #42819 called the Windows |
Behaviour change: none
Problem
bun_windows_sys,bun_sysandbun_libuv_syshave no user on any target.dead_codeexempts exportedpubitems. Theunused_publint of mordant has two in its baseline and misses three, because a re-export counts as a use.Fix
bun_windows_sys::externs: removeSYMBOLIC_LINK_FLAG_DIRECTORY,SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATEand theProcessParametersalias, with their re-exports inbun_sys::windowsandbun_core::windows_sys.bun_sys: remove the Windowsposix::timespecstruct.bun_libuv_sys: removeopen_handles::count.mordant-baseline.toml: remove theopen_handles.rsentry and lower thesrc/sys/lib.rscount by one.bun run rust:check-all(12 targets),bun run rust:mordant, the launcher binary on both Windows targets, Windows--releaseand--all-targets,bun bd.Background
bun_windows_sysholds hand-written Win32 declarations.bun_sys::windows,bun_core::windows_sysand the.binlauncher (src/install/windows-shim) re-export them.mordantCI job.mordant-baseline.tomlholds its known findings per lint and file. The job fails only when a count rises.#[deprecated].cargo checkthen ran on 12 targets, the debug cfgs,--release,--all-targetsand the launcher binary. Each use of a marked item prints a warning. These items printed none, apart from the re-export lines that this PR removes.Downsides
Notes
Removed symbols
Each item below printed no use in any of the 17 configurations or in the launcher binary.
bun_windows_sys::externs::SYMBOLIC_LINK_FLAG_DIRECTORYandSYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE, and their re-exports.bun_sysuses private copies inwin_symlink_impl(src/sys/lib.rs). The comment there says thatbun_windows_sysdoes not export them.bun_windows_sys::externs::ProcessParameters(an alias ofRTL_USER_PROCESS_PARAMETERS) and its re-export inbun_core::windows_sys. EachProcessParametersin code is thePEBfield of that name.bun_sys::posix::timespecon Windows (src/sys/lib.rs). The Unix re-export oflibc::timespecstays.bun_libuv_sys::open_handles::count(#[cfg(debug_assertions)]). No caller.Kept, because an open pull request touches them
bun_windows_sys::externs::MAX_PATHand its re-export have no user on main. crash_handler: attribute a crash inside a native module to that module #39815 adds one, so they stay.StringPrintStream pathOutlocal infunctionStartSamplingProfiler(BunJSCModule.h) stays. Write the sampling profiler report at exit from Bun, not JSC's atexit hook #41137 removes that line.The mordant baseline
open_handles::countwas the oneunused_pubfinding insrc/libuv_sys/open_handles.rs, so that entry goes.bun run rust:mordant:baseline) reports 53 forsrc/sys/lib.rs. This PR writes 55, which is the old count minus the one item removed here. It also reports lower counts for three entries that this PR does not touch. Those stay as they are on main.bun_windows_sysitems were not in the baseline. Each had apub usere-export, and mordant counts a re-export as a use.What the scan covered
rust:check-all. Linux with--cfg bun_asan --cfg bun_debug --cfg socket_fault_injection.--releasewith--cfg bun_codegen_embedfor Linux, Windows and macOS.--all-targetson Linux.bun_jscandbun_ptrallowdeprecatedfor the whole crate, so they ran a second time without that allow. The launcher binary (bun_shim_impl --features shim_standalone) ran on both Windows triples.--gc-sections --print-gc-sections(971 unreachable functions of ours, 324 already in open pull requests), a syntax-only pass over 657 translation units with-Wunused-function -Wunused-member-function -Wunused-template -Wunused-macros -Wunreachable-code, and a check of 591 identifiers that occur once in the tree. No new certain finding.oxlintno-unused-varsoversrc/js,src/codegen,scriptsandsrc/runtime/bake, and a search forinternal/*exports that no other file names. No new certain finding.Unused, but left in place on purpose
src/errno/windows_errno.rs(25 are unused). The file says that they exist so the same source compiles on both targets.bun_core::strings::split_once.clippy.tomlnames it as the replacement forstr::split_once.host_fn_this_valueandhost_fn_setterinsrc/jsc/host_fn.rs.src/codegen/generate-classes.tsemits calls to them for class shapes that no class uses today.GetExitCodeProcessandwindows_enable_stdio_inheritanceinbun_windows_sys::externs. Each caller declares a localsafe fncopy. Which copy to keep is a design choice.JsClass::estimated_sizedefault and__IsFreeze::IS_FREEZE. Method resolution selects them for types that do not exist yet.O::EVTONLYfor macOS,posix::mode_tfor Linux,bun_spawn::Resultandfault::SHUTDOWN. Each is one member of a table that has an entry per platform or per crate.Dead after an open pull request merges
src/collections/array_list.rs(44 lines). Its only user issrc/jsc/bindgen.rs, which Remove dead code from bun_jsc, bun_core, the bindgenv2 codegen, 15 error types, and the C++ bindings #40915 deletes.uv_stream_get_write_queue_size,uv_is_readableanduv_is_writableinsrc/libuv_sys/libuv.rs. Their only callers are three wrapper methods that Remove dead code from bun_core, the JSC bindings, the debugger, and 24 other crates #41385 deletes.Tests run with the debug build
The Rust changes are Windows-only, so the Linux binary is the same as on main.
test/js/node/fs/fs-mkdir.test.ts: 21 pass, 3 skip.test/js/node/fs/fs-stats-truncate.test.ts: 3 pass.no test proof · iteration 0 · the description declares no behaviour change, so there is no failing test to prove; the existing suite in CI is the check