Repository navigation
Conversation
…ckets, SecretsLinux, and five Rust crates Every item has zero references on any platform (rg over src/, generated code, packages/, scripts/, test/), and a relink of the debug binary with --gc-sections discards the C/C++/Rust symbols removed here. C++: inert ENABLE(BINDING_INTEGRITY) vtable blocks in 8 JS*.cpp wrappers, 15 dlsym'd libsecret/glib pointers nothing calls, the Solaris/z/OS cfmakeraw fallback, the uws_app_listen/uws_app_run C API and their uWS-only callees, four uSockets functions without callers, preadv2/pwritev2 ENOSYS stubs, write-only fields, unused constants, overloads, locals, duplicate includes and declarations, and long-dead commented-out code. Rust: unused JsEventLoop and ErrnoNames link-interface methods, the TransformOutstream plumbing in the transpiler, duplicate Win32 declarations in bun_windows_sys, and the unused libc dependency of bun_paths. JS and scripts: unused locals, type declarations, enum variants, and commented-out code.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 11 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe pull request removes unused public APIs, binding declarations, compatibility branches, stale comments, and redundant implementation code across networking, runtime, JavaScript, JSC bindings, SQLite, WebCrypto, V8, and Windows integrations. ChangesAPI and binding surface cleanup
Possibly related PRs
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
|
Status: scheduled dead-code sweep, rebuilt on main at 5c6d4e2. The branch was 588 commits behind main. A merge showed two deletions that main had made live again:
Both are restored, and every other deletion was checked again against the merged tree. The Notes block of the description lists what left the diff and how the check was done. On the merged tree The diff has no A green CI run on this push is the check for the macOS-only and Windows-only code. If the PR waits again, it needs a new merge of main and a new check before it merges. |
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. Because it's a 122-file sweep across many independent subsystems (uWS/uSockets C API, JSC bindings, five Rust crates, src/js builtins) and touches a CODEOWNER'd path (src/js/builtins.d.ts), a human look is still worthwhile.
What was reviewed:
- Grepped for remaining callers of every deleted
extern "C"symbol (us_socket_pair,us_socket_open,us_listen_socket_get_fd,us_quic_socket_close,uws_app_listen,uws_app_run) and the removedlink_interface!hooks (win32_name,file_polls,put_file_poll,stdout,stderr) — none remain. - Verified the removed
bun_windows_sysexterns (NtClose,IsProcessInJob,SYSTEM_INFO/GetSystemInfo,JOBOBJECT_ASSOCIATE_COMPLETION_PORT) are not the declarations the remaining call sites use (those declare their own locally). - Confirmed the relaxed
SecretsLinux::loadFunctions()predicate now checks exactly the five pointers the file dereferences; the dropped checks were for pointers no code path calls. - Confirmed
internalConnectinnet.tshas no caller passing the removed_flagsarg, and the removedheaders-handwritten.hinclude inZigGlobalObject.hwas a duplicate (line 55 remains).
Extended reasoning...
Overview
This PR is a repo-wide dead-code sweep: +37/−906 across 122 files in a single commit. It removes unused C entry points from bun-usockets/bun-uws and their prototypes, prunes unused bun_dispatch::link_interface! hooks and their link_impl arms, drops the TransformOutstream enum and its parameter threading from bundler/transpiler.rs, strips unused Win32 externs/structs from windows_sys, removes 15 never-called dlsym pointers and associated types from SecretsLinux.cpp (relaxing the load-success predicate to only the functions actually used), deletes the fully-commented-out ENABLE(BINDING_INTEGRITY) scaffolding from seven webcore wrappers, and removes assorted unused includes, forward declarations, enum values, member fields, and commented-out code across dozens of C++ bindings and src/js builtins.
Security risks
Low. The only non-deletion edit is the SecretsLinux::loadFunctions() predicate, which now returns success when fewer dlsym lookups succeed. I verified the five remaining checks (g_error_free, secret_password_store_sync, secret_password_lookup_sync, secret_password_clear_sync, secret_password_free) are exactly the pointers the rest of the file dereferences, so this cannot introduce a null-deref and only widens the set of libsecret installs Bun accepts — a strictly safer direction. Crypto/TLS header changes remove only unused const overloads, enum values with no switch consumers, and commented-out declarations; no live cipher/key/verification path is touched. The removed preadv2/pwritev2 ENOSYS stubs on non-Linux are unreachable (Rust only calls the sys_-prefixed variants under cfg(linux|android)).
Level of scrutiny
Moderate-to-high. REVIEW.md explicitly calls out that public items and extern "C" symbols escape dead-code lints and require manual grep verification, which I performed for the highest-risk deletions (uSockets C API, link-interface hooks, Windows externs, sqlite lazy-load entries). All spot-checks confirmed zero remaining callers in src/, packages/, and generated code. The PR description's methodology (--gc-sections --print-gc-sections relink, rust:check-all across 12 targets) is the right proof for this class of change. The deleted win32_errno_names unit test is acceptable per REVIEW.md — it tested only the function being deleted, and the deletion is stated in the PR description.
Other factors
The .github/CODEOWNERS file assigns *.d.ts to a code owner, and this PR touches src/js/builtins.d.ts — per the approval guidelines, CODEOWNER-covered paths should not be auto-approved. Beyond that, 122 files across uSockets C, uWS C++, JSC bindings, webcrypto, v8 shim, five Rust crates, and CI provisioning scripts is broad enough that a human skim of the areas they own is prudent even though the automated hunt ran to dry_streak with no findings. The removed #include lines and forward declarations in widely-included headers (ZigGlobalObject.h, root.h) compiled per the PR's stated bun bd verification, but that's the kind of thing where a maintainer glance at their subsystem is cheap insurance.
|
Updated 12:33 PM PT - Oct 23rd, 2026
✅ @robobun, your commit 314f81441baa23a897211e8772de68067840aae1 passed in 🧪 To try this PR locally: bunx bun-pr 42431That installs a local version of the PR into your bun-42431 --bun |
- src/js/internal/http.ts: dropping the two unused enum variants renumbers NodeHTTPResponse from 2 to 0, and that value is visible on IncomingMessage through util.inspect. - src/js/node/_http_server.ts, src/js/node/http2.ts: #41738 turns the commented captureRejection lines into live code. - scripts/tart.mjs: #29315 already removes the rdp closure.
Its removal leaves BundleOptions::output_dir_handle write-only while the field still owns the output directory fd, and rustfmt re-indents an unrelated match. Both belong in a separate change.
… and the CI pipeline script (#43976) Behaviour change: none ### Problem - Eleven files hold items that nothing reads or calls: write-only fields, an uncalled method, four unused types, and CI options that are parsed and dropped. - No tool reports them. C and C++ have no dead-code lint. TypeScript counts `x += n` as a read. The Rust types come from a macro. ### Fix - TypeScript: remove `DataViewReader.u16()`, `DataViewWriter.capacity`, the `totalCount` local in `updateBuildErrorOverlay`, and a commented-out block from 2024 in `src/js/node/dgram.ts`. - C and C++: remove `us_udp_socket_t.connected`, `us_quic_stream_s.headers_delivered` and `Http2ResponseData::totalSize` (each is only written), and `#undef FD_BITS` (nothing defines it). - Rust and CI: remove the opaque types `us_loop_t`, `us_socket_context_t`, `us_udp_socket_t`, `us_udp_packet_buffer_t` from `src/uws_sys/lib.rs`. In `.buildkite/ci.ts`, remove `dryRun`, `Platform.features`, four emoji entries, and the union members `"amazonlinux"` and `"eol"`. - Verified: `rg -w` for each symbol over `src`, `packages`, `scripts`, `test` and `build/debug/codegen` finds no other use. `bun bd`, `bun run rust:check-all` (12 targets) and `tsc` pass. Self-reviewed: 1 concern raised, 1 addressed. ### Background - `DataViewReader` and `DataViewWriter` decode and encode the binary messages between the dev server and its browser client. - `us_udp_socket_t` and `us_quic_stream_s` are private C structs of uSockets. Rust holds them as opaque pointers, so no Rust struct mirrors their layout. - `bun_core::opaque_extern!` declares a zero-sized Rust type for a C struct. Rust code names `Loop`, `udp::Socket` and `udp::PacketBuffer`, not the four removed types. ### Downsides - None found. Checked each removed symbol for users in Rust, C, C++, TypeScript, generated code, tests, and open pull requests. <details><summary>Notes</summary> **Evidence per removal** | Item | Evidence | | --- | --- | | `DataViewReader.u16()` | `rg '\.u16\('` over `src/runtime/bake`, `test/bake`, `test/cli/inspect`: no hit. | | `DataViewWriter.capacity` | The only hit of `.capacity` in the bake TypeScript is the assignment in the constructor. `initCapacity` is the only caller of the constructor. | | `totalCount` | Two hits: the declaration and one `+=`. | | `dgram.ts` block | `git blame`: 589f941, 2024-04-26. `replaceHandle` and `startListening` are not defined in the file. | | `us_udp_socket_t.connected` | Two hits, both `udp->connected = 0;`. | | `us_quic_stream_s.headers_delivered` | Two hits in `quic.c`: the field and one `= 1`. The struct is private to `quic.c`. | | `Http2ResponseData::totalSize` | One member access: `data.totalSize = totalSize;`. The other hits of `totalSize` are the function parameter. | | `#undef FD_BITS` | The only hit of `FD_BITS` in `src` and `packages`. | | Four opaque types | Each name has one non-comment hit in all Rust sources and generated Rust: the macro call. | | `dryRun` | Four hits in `ci.ts`: the field, two assignments, one destructure. Nothing reads the binding. | | `Platform.features` | One hit. | | Emoji, `Distro`, `Tier` entries | No platform in `ci.ts` or image in `scripts/build/ci-images/spec.ts` carries them. `Emoji` is `keyof typeof emojiMap`, so a remaining caller would fail `tsc -p scripts/tsconfig.json`. It passes. | **Taken out because an open pull request uses or removes the item** - `DataViewWriter.u8()`: dead on main, but #42075 adds its first caller (`check.u8(IncomingMessageId.check_errors)` in `hmr-runtime-error.ts`). Git merges the two without a conflict, so the method stays. The tree that results from a merge of this branch with #42075 has no type error for `u8`. - `declare module "bun:wrap"` in `bake.private.d.ts`: no importer, but #39488 already has the same hunk. **Tests run with the debug build, all pass** `test/js/bun/udp/udp_socket.test.ts` (218), `test/js/bun/udp/dgram.test.ts` (62), `test/js/bun/http/serve-http2.test.ts` (93), `test/js/bun/http/serve-http3.test.ts` (73), `test/bake/dev/bundle.test.ts` (23), `test/bake/dev/esm.test.ts` (17), `test/bake/hmr-socket-protocol.test.ts` (4), `test/cli/inspect/BunFrontendDevServer.test.ts` (7). `test/js/node/dgram/node-dgram.test.js` passes 3 of 4: the IPv6 multicast test fails with `ENODEV` in the test container, with and without this change. `prettier` and `cargo fmt --check` report no change. **Overlap with open pull requests** Each removed line was compared with the diffs of the 35 open dead-code pull requests. None removes the same lines. Five files are also touched by an open pull request, in hunks more than 6 lines away: `internal.h` and `quic.c` (#40294, #42431), `dgram.ts` (#42431), `overlay.ts` (#43378, #42075, #39488), `src/uws_sys/lib.rs` (#43010). The added lines of the 122 open pull requests that were updated since 2026-09-18 and touch the bake, uSockets, uWS, uws_sys, server, socket or CI sources name none of the removed symbols. **What was scanned** - C and C++: the debug binary was linked a second time with `--gc-sections`, and the two symbol tables were compared. 414 functions in bun's own C and C++ are unreachable on Linux. Open pull requests remove 263 of them. The remainder is in the list below, has a caller on Windows or macOS, or comes from a macro. - Rust: 37 `#[no_mangle]` exports are unreachable in the Linux link. Each has a caller on another platform, or #40824, #40232 or #40557 removes it. A count of references for all 58,055 Rust definitions found no other item without a user. Of the 144 `allow` attributes for the unused and unreachable lints, each covers code that depends on `cfg` or is macro output. - Cargo: five dependency edges are unused on all 12 targets. #40294 removes three. `bun_resolver -> bun_zstd` is used under `cfg(bun_codegen_embed)`. `bun_wyhash -> bstr` is used by unit tests. - Preprocessor: `USE(BIGINT32)` and `ENABLE(MALLOC_BREAKDOWN)` are never true. #43644 and #40557 remove those branches. - Also scanned and clean: `src/js`, `src/node-fallbacks`, `src/codegen`, `scripts/`, `misctools/`, `patches/` (every patch file has a user), `packages/` except `bun-types`. **Probably dead, left alone on purpose** - The `PerformanceResourceTiming` cluster under `src/jsc/bindings/webcore` (about 2,000 lines: `PerformanceResourceTiming`, `PerformanceServerTiming`, `ResourceTiming`, `NetworkLoadMetrics`, `ResourceLoadTiming`, `ServerTiming` and the two JS wrappers). The linker drops every constructor, so no instance can exist. The two globals are public and `test/js/web/web-globals.test.js` checks them. This needs a decision: keep it for a future resource-timing implementation, or reduce it to the two constructors. - `WEBCORE_GENERATED_CONSTRUCTOR_GETTER` (`ZigGlobalObject.cpp`) emits an `X_getter` function for 50 classes. 45 have no user. A removal needs a second macro and saves no source lines. - The WebIDL converters for `byte`, `short` and `long long`, and most `Clamp` and `EnforceRange` specializations in `JSDOMConvertNumbers.cpp`. No binding uses them, but `src/codegen/bindgen.ts` maps `t.i8`, `t.i16` and `t.i64` to them. - `src/js/bun/sql.ts`: the export properties `sql`, `Query`, `postgres` and the four error classes. Native code reads only `default` and `SQL`. It is not certain that no loader path exposes the module object. - `us_nq_settings_set_scid_len` and `us_nq_settings_set_delay_onclose` (`node_quic_shim.c`, declared in `src/lsquic_sys/lib.rs`): no caller. `node:quic` is under active work. - `Event::currentTargetIsInShadowTree()` and its bit: no reader. The lines sit next to a hunk of #39929. - Bake client: `WebSocketWrapper.close()` and `[Symbol.dispose]()`, `streamingStarted`, the `line` and `column` bookkeeping and seven enum members in `JavaScriptSyntaxHighlighter.ts`, and `externals` in `src/node-fallbacks/build-fallbacks.ts`. Each sits next to a hunk of #43378, #40492, #40122 or #41385. - The `internal: true` property option of the class generator. A guard throws on it, so the branches behind it cannot run. Five open pull requests touch `generate-classes.ts`. - `H2App::getNativeHandle` (next to a hunk of #41195) and `uws_app_listen_config_t` (its last user goes with #42431). - `UWS_ALLOW_SHARED_AND_DEDICATED_COMPRESSOR_MIX`, `UWS_ALLOW_8_WINDOW_BITS` and `LIBUS_NO_SSL`: never defined, but they are documented opt-in switches of the upstream libraries. - `scripts/debug-coredump.ts`, `scripts/gamble.ts`, `scripts/github-metrics.ts`, `scripts/lldb-inline.sh` with `scripts/lldb-inline-tool.cpp`, and `packages/h3blast`: nothing references them. They read as tools that a person runs by hand. - #40232 removes `napi_internal_get_version`. #42556 renamed that function to `Bun__napi_get_version` on main, and it still has no caller. </details>
…ent.cpp (#45764) ### Problem - 29 lines in 6 files have no user. - `source_file`, `compare_types` and `symbol_to_string` in the `queries!` list of `src/lint/types/mod.rs` have no caller. The list generates the only call of the `Services` functions of the same names in `bun_sema`. The trait is `pub`, so rustc does not check it. - `BunProcess.cpp` declares five `using X = JSC::X;` aliases that it never names. `DirEntType` in `NodeDirent.cpp` has three enumerators that nothing names. ### Fix - Delete the three list lines with their `Services` functions (21 lines), the five aliases and the three enumerators. - Correct because a word search over the sources, the tests and the generated code finds no user, and the workspace compiles for 12 targets. - Verified: `bun bd`, `bun run rust:check-all`, `cargo check --workspace --all-targets`, 8 test files (Notes). - Self-reviewed: 41 concerns raised, 33 addressed. Rejected: a `pub(crate)` narrowing of `Queries` (`resolve_name` needs a caller first), and a hold until earlier sweeps merge. ### Background - `queries!` lists each question that a lint handle (`Type`, `TsSymbol`) can ask the type checker. One line generates a `Queries` method and a forwarding call to `Services` in `bun_sema`. - `BunProcess.cpp` compiles as its own unit with `using namespace JSC;`, so the aliases change no name lookup. - A deletion of unreferenced code has one possible place, so no other design was weighed. ### Downsides - A later lint handle that needs one of the three queries must restore it. - None found for users. Checked: the heads of all 5,559 open pull requests, 12 targets, the tests in Notes. Behaviour change: none <details><summary>Notes</summary> **Removed** - `src/lint/types/mod.rs`: the `queries!` lines `source_file`, `compare_types` and `symbol_to_string`. No call of these names has a `Queries` receiver. The calls that exist go to other functions: `Checker::compare_types` and `Checker::symbol_to_string` in `bun_sema`, a private `compare_types` in `prefer_optional_chain.rs`, and the parser's `source_file`. With `Queries` made crate-private in a scratch edit, rustc reports `resolve_name` as the only query left that is never used. - `src/sema/check/services.rs`, `services/types.rs`, `services/symbols.rs`: `Services::source_file`, `Services::compare_types`, `Services::symbol_to_string`. The generated forwarding call was the only user. What they call (`Files::by_path`, `Checker::compare_types`, `Checker::symbol_to_string`, `Checker::prop_to_string`) keeps other callers. - `src/jsc/bindings/BunProcess.cpp`: the aliases `Exception`, `JSModuleLoader`, `JSModuleRecord`, `SourceOrigin`, `JSNonFinalObject`. None of the names appears in the rest of the file. The same block in `Path.cpp` and `ZigGlobalObject.cpp` is left to #43378 and #42431. - `src/jsc/bindings/NodeDirent.cpp`: the enumerators `Whiteout`, `Door` and `EventPort` of `DirEntType`, all equal to `Unknown`. No C or C++ file names them. **Open pull requests** - Compared at 2026-10-17 16:40 UTC on main 017b243 with the heads of all 5,559 open pull requests, drafts and every author included. - 156 of them touch a file of this diff (151 touch `BunProcess.cpp`). A trial merge of each with main and with this branch (`git merge-tree`) shows that the branch adds a conflict to none. - None deletes one of these lines. None adds a use of a removed name: the added lines were searched for the three query names, the five alias names in `BunProcess.cpp`, and the three enumerators. **Found dead in this run, and left alone** - Already gone on main: three lines in `JSSQLStatement.cpp` and `NodeSqlite.cpp` (#45304). - Another open pull request deletes or rewrites them: 13 commented-out lines in uSockets, uWS, `JSEventTargetCustom.cpp` and `src/node-fallbacks/url.js` (#45709, and #43730 for `url.js`), two typedefs in `InspectorHTTPServerAgent.cpp` (#45725), the `BUN_WEBKIT_VERSION` fallback in `BunProcess.cpp` (#41729), a commented-out line in `src/js/internal/html.ts` (#45682). - An open pull request uses them: `Event::currentTargetIsInShadowTree()` and the `MediaTime` overload of `JSConverter<IDLUnrestrictedDouble>` (#45415). - Held by an earlier sweep for a reason that still holds: the QUIC setters `scid_len` and `delay_onclose` (#43976, and #40220 changes the line above them). - `resolve_name`, the fourth query with no caller. tsgolint's `prefer-readonly` calls `ResolveName` and Bun's port does not, which gives a wrong autofix for a global enum. The fix is handed off and needs the query. After it, `Queries` can become `pub(crate)`, and rustc then guards the list. - Mirrors of typescript-eslint and tsgolint: the write-only fields `ThenCall::on_fulfilled`, `FinallyCall::on_finally`, `BaseTypeOfClassMember::base_type` and `heritage_token`, `TargetElement::is_shorthand`, with `TsNode::token` (as #45402 held them). Also 33 functions from macro lists in `src/lint/types/` that nothing calls, and `File::expr_tags_in_tree`. - Debugging aids: 25 hand-written `Debug` impls in `bun_lint`, 5 in `bun_format`, and `Display` for `Difference`, `FilePoll` and `Part`. - Handed off: the plugin `target` value that nothing reads (`BundlerPlugin::target`, three more members, a parameter of `JSBundlerPlugin__create`, and the Rust enum). Its removal changes an FFI signature. - Needs a decision: `PerformanceResourceTiming` cannot be constructed, so `ResourceTiming.cpp`, `NetworkLoadMetrics.cpp` and `ServerTiming.h` are reachable only from its getters. **How the candidates were found** - Ten text searches, one for each area: `src/js`, the C++ bindings (three parts), uSockets and uWS, the build scripts, the side packages, the three new crates, and commented-out code. - A relink of the debug build with `-Wl,--gc-sections`, with each dropped function mapped to its source line by `llvm-nm -l`: 517 C++ functions and 607 Rust function lines. Almost all are Windows or macOS code, release-only code, or are deleted by an open pull request. - For `bun_sema`: `pub` narrowed to `pub(crate)` on each item that no other crate names, in a scratch tree. rustc reported nothing new. - For 39 trait impls that the linker drops: delete all, compile for linux, windows and darwin and with `--all-targets`, put back each impl that an error names. What stayed deleted is a debugging aid. **Tests, debug build of this branch** (with `--timeout 600000`, because the lint and check tests need more than the default with a debug build) - `test/cli/lint/conformance.test.ts`: 3 pass. - `test/cli/lint/rules.test.ts`: 16 pass. - `test/cli/lint/native-rules.test.ts`: 166 pass. - `test/cli/lint/bun-rules.test.ts`: 100 pass. - `test/cli/check/check.test.ts`: 599 pass, 42 skip. - `test/js/node/process/process.test.js`: 188 pass, 5 skip. - `test/js/node/fs/dir.test.ts`: 23 pass. - `test/regression/issue/24129.test.ts`: 2 pass. </details> <!-- robobun:evidence:begin --> --- **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 <!-- robobun:evidence:end -->
The branch was 588 commits behind main. Every deletion was checked again against the merged tree. Dropped, because main uses the code again: - us_quic_socket_close (quic.c, quic.h): src/uws_sys/quic/Socket.rs imports it since #42692. - The sqlite3_errcode entry of lazy_sqlite3.h: JSSQLStatement.cpp calls it since #45304. The header is only compiled on macOS, so the other three entries stay too. A Linux build cannot check them. Dropped, because main changed or removed the code: - scripts/azure.mjs, scripts/machine.mjs, scripts/runner.node.mjs, CommonJS.ts, ProcessObjectInternals.ts, sql.ts, BunPlugin.cpp, BakeAdditionsToGlobalObject.h, JSBakeResponse.cpp, uws_app_listen, the lazyLoadSQLite stubs, and the _flags parameter in net.ts. Dropped, to keep the change free of any behavior difference: - SecretsLinux.cpp keeps the six pointers that load_functions() tests. Only the nine pointers that nothing reads are removed. - child_process.ts keeps the debug-only globalThis.__getId.
The comment named w::ntdll::NtClose. bun_windows_sys::ntdll no longer declares it.
There was a problem hiding this comment.
I re-reviewed this after the merge of main and did not find any bugs, but with 106 files touched (including crypto, secrets, and Windows-only code that only CI can type-check) and a CODEOWNER-covered .d.ts in the diff, a human look is still worthwhile.
What was reviewed:
- Windows-gated removals (
NtClose,IsProcessInJob,GetSystemInfo/SYSTEM_INFO,JOBOBJECT_ASSOCIATE_COMPLETION_PORT): every remaining caller uses a localsafe fnextern block insrc/sys/windows/mod.rs,src/bun_alloc/lib.rs, and the windows-shim, not the deleted crate-root exports. - Link-interface hooks (
ErrnoNames::win32_name,JsEventLoop::{file_polls,put_file_poll,stdout,stderr}) and FFI symbols (us_socket_pair,us_socket_open,us_listen_socket_get_fd,uws_app_run, non-Linuxpreadv2/pwritev2stubs): no dispatcher callers orexterndeclarations remain insrc/orpackages/. - C++ shape changes:
JSNodeHTTPServerSocketPrototype::createStructureis bypassed by a directStructure::createinJSNodeHTTPServerSocket.cpp;CryptoAlgorithmRsaKeyGenParamsis only a base class with the base'sClass::Nonedefault and nothing downcasts to it; allByteSourceconsumers call.span()/.data()/.size()explicitly, so the removed implicitBufferconversion had no users. - Removed includes and
extern "C"lines each leave a duplicate in the same file; the#ifndef __cplusplusbranches inheaders-handwritten.hsit below C++ includes and anamespace, so were never reachable.
Extended reasoning...
The PR is a 106-file, +5/-736 dead-code sweep across the C++ JSC/WebCore bindings, uWS/uSockets, the JS builtins, and several Rust crates, re-based on a 588-commit merge of main that dropped the deletions main had made stale. It touches crypto and secrets headers (ncrypto.h, KeyObject.h, CryptoUtil.h, webcrypto, SecretsLinux.cpp) only by removing unused enum variants, accessors, and dlsym loads, and does not change any TLS or crypto behavior. Each removal category was grep-verified against the merged tree, including the Windows-only and link-interface items that rustc cannot lint, and nothing was found still referencing a deleted symbol. Deferring rather than approving because the diff is large, cfg-gated macOS/Windows code cannot be type-checked on this host, src/js/builtins.d.ts falls under the *.d.ts CODEOWNERS entry, and the PR changed substantively since the prior review.
Behaviour change: none
Problem
_ZTVN7WebCore15AbortControllerEvtable declarations behindENABLE(BINDING_INTEGRITY)(used only inside a comment),uws_app_run(its Rust importer left in Remove 77 pub items that nothing uses on any platform #42078), and 9dlsymresults inSecretsLinux.cppthat nothing reads.publink-interface methods,extern "C"definitions, inline members, write-only fields, commented-out code.Fix
src/, generated code,packages/,scripts/, andtest/on every platform.us_quic_socket_closeand thesqlite3_errcodeentry oflazy_sqlite3.h(Notes).bun bd,bun run rust:check-all(12 of 12 targets),test/internal/source-lints, and the suites in Notes.Background
ENABLE(BINDING_INTEGRITY)is a WebKit bindings-generator check of a wrapped object's vtable pointer. Its body is commented out here, so theexternvtable declarations have no user.bun_dispatch::link_interface!lets a low-tier crate call a high-tier crate. Each method becomes a#[no_mangle]export plus apub fndispatcher, which rustc'sdead_codelint cannot see.Downsides
src/symbols.*), read from JS, or named by codegen.Notes
WebCore bindings (206 lines)
JSAbortController.cpp,JSCloseEvent.cpp,JSPerformanceObserver.cpp,JSPerformanceTiming.cpp,JSWebSocket.cpp,JSWorker.cpp: the#if ENABLE(BINDING_INTEGRITY)vtableexternblock, and theif constexpr (std::is_polymorphic_v<T>)block intoJSNewlyCreatedwhose body is comments only.JSCustomEvent.cpp,JSPerformanceServerTiming.cpp: the vtableexternblock.uWS and uSockets
uws_app_run(src/uws_sys/libuwsockets.cpp) and the members only it called:TemplatedApp::run(),Loop::run(), freeuWS::run().TemplatedApp::listen(int, handler)(packages/bun-uws/src/App.h). Its only caller,uws_app_listen, is already gone on main.us_socket_pair,us_socket_open(socket.c),us_listen_socket_get_fd(context.c), and their prototypes. The Rust declarations left in Remove 77 pub items that nothing uses on any platform #42078.struct uws_header_iterator_s;(_libusockets.h). A redundantextern "C"declaration inDevServerSourceProvider.cpp(the header declares it).Top-level
src/jsc/bindingsSecretsLinux.cpp: the pointersg_list_free_full,g_str_hash,g_str_equal,secret_service_search_sync,secret_item_get_secret,secret_value_get_text,secret_value_unref,secret_item_get_attributes,secret_item_load_secret_sync, theirdlsymlines, and the types only they used (_GListbody,SecretService,SecretValue,SecretItem,SecretSearchFlags).load_functions()keeps its check as it is.wtf-bindings.cpp: the__sun/__MVS__cfmakerawfallback. No Bun target defines these macros.c-bindings.cpp: the non-Linuxpreadv2/pwritev2ENOSYS stubs. Rust callssys_preadv2/sys_pwritev2only undercfg(linux | android).ZigGlobalObject.h,ZigGlobalObject.cpp,BakeGlobalObject.cpp: write-onlyisThreadLocalDefaultGlobalObject, the constguardedObjects()overload, the commented memberm_JSBunDebuggerValue, duplicate forward declarations,using JSNonFinalObject,#undef JSC_TYPED_ARRAY_CHECK, commented-out lines.headers-handwritten.h: the#ifndef __cplusplusbranches (the header includes C++ headers before them, no.cfile includes it) and the constantsZigStackFrameCodeNone,JSErrorCodeOutOfMemoryError,JSErrorCodeStackOverflow,JSErrorCodeUserErrorCode,BunLoaderTypeCSS,BunLoaderTypeFILE,BunLoaderTypeJSONC,BunLoaderTypeWASM.bindings.cpp:FLAG_PROMISE_RESOLVES,FLAG_PROMISE_REJECTSand the-Wunused-variablepragma that existed for them,#undef IMPL_DEEP_EQUALS_WRAPPER, one commented-out line.napi.h: theBoundFinalizer(const NapiFinalizer&, void*)constructor.napi_finalizer.h:hint().InspectorLifecycleAgent: write-onlym_preventingExit.ModuleLoader.h: write-onlyOnLoadResult::wasMock.workaround-missing-symbols.cpp: the#define UNLIKELYblock.root.h: theENABLE_3D_TRANSFORMS#errorguard (no WebKit header defines the flag, checked in the headers of the current WebKit version).ncrypto.h:CryptoErrorList::rbegin/rend,Cipher::MAX_KEY_LENGTH/MAX_IV_LENGTH.uv-posix-polyfills.c: the unreachable__CYGWIN__branch.NodeVM.h:BaseVMOptions::failed.NodeVMScript.h: thecachedDataProduced(bool)setter.CallSite.h:Flags::IsWasm.DOMFormData.h: forward declarations ofHTMLElement,HTMLFormElement.identifier(BunObject.cpp),wrapperStart,wrapperEnd,exception(JSCommonJSModule.cpp),argList(InternalModuleRegistry.cpp).#includelines. For each, one copy stays in the same preprocessor scope.extern "C"declarations:Bun__readOriginTimerStart(2),Bun__getTLSRejectUnauthorizedValue,Bun__Node__ProcessPendingDeprecation.JSDOMExceptionHandling.cpp,JSX509CertificatePrototype.cpp,BunClientData.h,JSWrappingFunction.cpp,JSDOMGlobalObject.h.node, webcrypto, sqlite, v8
CryptoUtil.h:ByteSource::operator ncrypto::Buffer<const T>(),ByteSource::empty(),DSASigEnc::Invalid.JSNodeHTTPServerSocketPrototype::createStructure. UnuseduWSforward declarations, an orphaned doc comment, and two unusedextern "C"prototypes inJSNodeHTTPServerSocket.{h,cpp}.RsaKeyVariant::RSA_OAEP,KeyObject::KeyEncodingContext::Export, the const overloadsJSDiffieHellman::getImpl,JSDiffieHellmanGroup::getImpl,JSKeyObject::handle,HTTP_BOTH, and commented-out declarations inJSSign.h,KeyObject.h,CryptoUtil.h,NodeHTTPParser.h.CryptoAlgorithmParameters::Class::RsaKeyGenParamswith itsparametersClass()override and type-trait specialization (the class is only a base class), forward declarationsCryptoKeyAKPandJSC::CallFrame, three commented-out lines.JSC_DECLARE_CUSTOM_GETTERlines inJSSQLStatement.cpp, a deadvmlocal inNodeSqlite.cpp.shim::Handle::Handle(const ObjectLayout*), the private constFunctionTemplate::localToObjectPointer(),kInternalFieldsInWeakCallback,Oddball::Kind::kInvalid, four unusedusingdeclarations.Rust
JsEventLoop::{file_polls, put_file_poll, stdout, stderr}: declarations insrc/event_loop/lib.rs, impl arms insrc/jsc/event_loop.rs.ErrnoNames::win32_name,win32_errno_name, and its unit test (src/bun_core/lib.rs,src/errno/lib.rs). The callers left in Replace bun_core::Error intern machinery with per-crate thiserror enums #33909.bun_windows_sys::externs:NtClose,IsProcessInJob,GetSystemInfowithSYSTEM_INFO,JobObjectAssociateCompletionPortInformationwithJOBOBJECT_ASSOCIATE_COMPLETION_PORT, the emptyuser32andadvapi32modules, and their re-exports insrc/sys/windows/mod.rs. Every caller uses a localsafe fndeclaration.libcdependency ofbun_paths.Built-in JS
$definePropertiesandArrayBufferConstructorinsrc/js/builtins.d.ts.ConsoleObject.ts,Ipc.ts,undici.js,fifo.ts,tls.ts,stream.promises.ts,native-readable.ts,net.ts,dgram.ts,assert.ts,child_process.ts,cluster.ts.Edits that are not whole-line deletions
packages/bun-uws/src/Loop.h: the file comment no longer names the removedrun().pub uselists inbun_windows_sysandsrc/sys/windows/mod.rslose the removed names.src/install/windows-shim/main.rs: a comment namedw::ntdll::NtClose, whichbun_windows_sys::ntdllno longer declares. It now namesNtCreateFile.Dropped in the merge with main (main at 5c6d4e2)
us_quic_socket_close(src/uws_sys/quic/Socket.rsimports it since fetch: proxy, TLS identity and error fixes; add Bun.FetchSession #42692), and thesqlite3_errcodeentry oflazy_sqlite3.h(JSSQLStatement.cppcalls it since sql: consolidate the open Bun.sql, bun:sqlite and node:sqlite pull requests #45304). git reported no conflict for either one.lazy_sqlite3.hentries (sqlite3_bind_blob,sqlite3_bind_text,sqlite3_bind_text16) are also out. They still have no caller, but the header compiles only on macOS and the sqlite bindings change often.scripts/azure.mjs,scripts/machine.mjs,scripts/runner.node.mjs,CommonJS.ts,ProcessObjectInternals.ts,sql.ts,BunPlugin.cpp,BakeAdditionsToGlobalObject.h,JSBakeResponse.cpp,uws_app_listen, thelazyLoadSQLite()stubs, the_flagsparameter innet.ts.SecretsLinux.cppload_functions()tests and never calls (their removal changes whenBun.secretsreports that libsecret is not available), and the debug-onlyglobalThis.__getIdinchild_process.ts.Found but not in this diff
NodeHTTPIncomingRequestType.FetchRequest/.FetchResponseinsrc/js/internal/http.ts: unused, but their removal renumbersNodeHTTPResponsefrom 2 to 0, andutil.inspect(req)shows that value._http_server.tsandhttp2.ts: node:http: emit 'error' for a captured rejection on a non-'request' Server event #41738 turns them into live code.TransformOutstreaminsrc/bundler/transpiler.rs: the value is threaded through two private functions and never read. Its removal leavesBundleOptions::output_dir_handlewrite-only while that field still owns the output directory fd, so both belong in one separate change.call: trueon the 7noConstructormatcher classes injest.classes.ts: Remove dead code from bun_jsc, bun_core, the bindgenv2 codegen, 15 error types, and the C++ bindings #40915 already changes it.NullableInnerParameterTypealiases inIDLTypes.h: dead after Remove dead code from the web streams bindings, the test runner formatter, and the bindgen codegen #41445 lands.lsquic_sysSettings::scid_len/delay_oncloseand their C shims: no caller, left because node:quic is in active work.#[no_mangle] static Bun__Node__CAStoreinArguments.rs: no reader in C++.ErrnoNames::max_dense: no caller, but its removal leavesSystemErrno::MAXtest-only on Windows.AsyncContextFrame.exchangeinsrc/js/internal/async_context_frame.ts: no caller, mirrors Node's internal API.Zig::*_getterfunctions fromWEBCORE_GENERATED_CONSTRUCTOR_GETTERthat lld discards. The macro needs a split.How the deletions were checked after the merge
src/,packages/,scripts/,test/, generated code). This search found theus_quic_socket_closeimport. Thesqlite3_errcodecall came from a report, because the call uses the macro name and not thelazy_name. After that, each removed#definename was searched too.#includeor declaration, one copy is still present in the same preprocessor scope.bun bdlinks.bun run rust:check-allpasses on 12 of 12 targets.tsc --noEmit -p src/js/tsconfig.jsonpasses. clang-format, rustfmt, and prettier report nothing on the changed files.Tests run with the debug build on the merged tree
test/internal/source-lints(181 pass, the 2 failures are 5 s timeouts ofsema-parser-recursion.test.tsunder the ASAN debug build, that file passes with a release binary),test/js/bun/sqlite/sqlite.test.js,test/js/node/sqlite/node-sqlite.test.ts,test/js/web/abort/abort.test.ts,test/js/web/workers/worker.test.ts,test/js/web/workers/message-event.test.ts,test/js/web/websocket/websocket-client.test.ts,test/js/node/crypto/node-crypto.test.js,test/js/node/crypto/ecdh.test.ts,test/js/bun/http/serve-listen.test.ts,test/js/node/http/node-http.test.ts,test/js/node/net/node-net-server.test.ts,test/js/node/net/node-net.test.ts,test/js/node/child_process/child_process.test.ts,test/js/node/dgram/node-dgram.test.js,test/js/node/vm/vm.test.ts,test/js/bun/plugin/plugins.test.ts,test/js/first_party/undici/undici.test.ts,test/js/bun/test/mock-fn.test.js,test/js/web/console/console-log.test.ts,test/js/node/process/process-nexttick.test.js. The failures seen are 5 s timeouts that pass with--timeout 60000, tests that need the public internet (www.example.com), andBun.secrets(no libsecret in the container).