Skip to content

Remove dead code from the code generators, the build scripts, and ten crate roots - #45709

Closed
robobun wants to merge 2 commits into
mainfrom
robobun/12476aa9/dead-code-sweep
Closed

robobun wants to merge 2 commits into
mainfrom
robobun/12476aa9/dead-code-sweep

Conversation

@robobun

@robobun robobun commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

  • About 270 lines have no user: generator features that no input sets, build-script options that no dependency sets, crate-root re-exports that nothing names, trait impls that nothing calls, and commented-out code from 2022 to 2025.
  • Example: src/codegen/generate-classes.ts emits void detach() { m_ctx = nullptr; } into 93 generated classes. Nothing calls it.

Fix

  • Delete them: 39 files, 271 lines removed, 81 added. The Notes list each item.
  • Nothing can reach the code. Each generator feature has zero inputs, each build option has zero setters, and the workspace compiles without each re-export and trait impl on all 12 targets.
  • Verified: bun bd, bun run rust:check-all (12 targets), cargo check --workspace --all-targets, cargo check --workspace --release. The generated code changes only where intended. build.ninja and .buildkite/ci.json are byte-identical. Tests: see Notes.

Background

  • generate-classes.ts turns *.classes.ts files into C++ wrapper classes. generate-host-exports.ts turns // HOST_EXPORT(...) markers into extern "C" thunks. replacements.ts and bundle-functions.ts compile the JavaScript in src/js/builtins.
  • A crate-root re-export is a pub use module::Name line in lib.rs. It lets other crates write bun_core::Name. The items stay. Only the unused short names go.
  • NestedCmakeBuild describes a dependency that its own CMake project builds. Only a local WebKit build uses it.

Downsides

  • None found. Checked: no removed name has a user in src/, packages/, scripts/, test/, bench/, docs/ or the generated code, and no line of this diff is in the 61 open dead-code pull requests.

Behaviour change: none

Notes

Removed, by group

Code generators (src/codegen):

  • generate-classes.ts, class-definitions.ts: the builtin: property kind. Its last user, Glob.classes.ts, went away in One bindgen: replace bindgen v1 and v2, add classes, generate the Rust side #45104.
  • generate-classes.ts, class-definitions.ts: the class-level enumerable option. No .classes.ts file sets it. The property-level enumerable (sockets) stays.
  • generate-classes.ts: the detach() member of every generated class (93 copies in ZigGeneratedClasses.h). Nothing calls it.
  • generate-host-exports.ts: the reaction shape. No HOST_EXPORT marker has that signature since the cron reactions became plain host functions.
  • replacements.ts, builtins.d.ts: the $isPromiseFulfilled and $isPromiseRejected macros. No builtin uses them. $isPromisePending expands to the same text as before.
  • bundle-functions.ts, builtins.d.ts: the $alwaysInline directive, and the #define WEBCORE_BUILTIN_<FILE>_<FN> 1 line (49 defines that nothing tests).
  • cppbind.ts: PositionedError.notes. Nothing fills it, so the loop that prints notes never runs.
  • generate-jssink.ts: a second #include "BunClientData.h" in the same emitted file.

Build scripts:

  • scripts/build/source.ts: NestedCmakeBuild.extraCFlags, extraCxxFlags, libSubdir, sourceSubdir and pic, with their readers. The only nested-cmake dependency (WebKit) sets none of them. DirectBuild.pic stays.
  • scripts/build/source.ts: the function form of Dependency.patches. All 14 dependencies pass an array.
  • scripts/build/compile.ts: CompileOpts.pool. scripts/build/ninja.ts: NinjaOptions.ninjaVersion. No caller passes them.
  • scripts/build/deps/lsqpack.ts: an unused cfg parameter.
  • .buildkite/ci.ts: the unused options parameter of getTraceOrderStep, getTestBunStep and getWindowsSignStep.

Rust, crate-root re-exports that no code names (81 names):

  • bun_core: 44 of the 63 names flattened from string::immutable (every user writes strings::X), BoundedArrayAligned, is_slice_in_buffer_t, WTFStringImplPtr.
  • bun_jsc: CoerceTo, ForEachCallback, ExceptionValidationScopeGuard, TopExceptionScopeGuard, call_check_slow_at, call_false_is_throw_at, call_null_is_throw_at, call_zero_is_throw_at, host_construct_result, HostFnEntry, AbortHandleOwner, ExternColumnIdentifierValue, ConcurrentCppTask.
  • bun_css: ToCssResult, PseudoClasses, LABColor, PredefinedColor, BasicParseError, MinifyErrorKind, and the css_printer alias.
  • bun_resolver: DirEntryResolveQueueItem, FlushMode, MatchStatus, ResultFlags. bun_bundler: cross_chunk_import, JSMeta, DefineExt.
  • bun_collections: HiveBox. bun_sys: stat_birthtime, stat_ctime. bun_js_parser_jsc: data_to_js, string_to_js. bun_install: AuthType. bun_spawn: sync::spawn_with_argv.

Rust, trait impls that nothing calls:

  • src/runtime/api/bun/h2/flow_control.rs: Default for SendWindow, Default for RecvWindow. Callers use new().

Commented-out code, last touched between 2022-03 and 2025-09:

  • packages/bun-usockets: a disabled assert in bsd.c, a disabled stub in epoll_kqueue.c, two superseded us_create_udp_socket prototypes in libusockets.h.
  • packages/bun-uws/src/ChunkedEncoding.h: a debug printf.
  • src/jsc/bindings/webcore/JSEventTargetCustom.cpp: // #include "DOMWindow.h".
  • src/js/builtins/ConsoleObject.ts, src/css/build-prefixes.js, src/node-fallbacks/url.js (four export entries for names the file no longer has), src/runtime/bake/bun-framework-react/server.tsx.

Method

  • C and C++: a relink of the debug objects with --gc-sections --print-gc-sections lists 272 hand-written functions that the linker drops. The open pull requests already remove about 210 of them. Every other one has a caller on Windows or macOS, so none is in this diff.
  • C++: a -fsyntax-only pass over 606 files with -Wunused-function -Wunused-macros -Wunused-member-function -Wunused-template -Wunreachable-code. The build passes -Wno-unused-function. It finds eight unused static functions and macros. Open pull requests remove all of them.
  • Rust trait impls: the same relink gives 19 candidates. An impl stays in this diff only if the workspace compiles without it on every target, with tests and in release. The compiler kept 17: for example Display for FilePoll has a user only in the kqueue path (macOS, FreeBSD), and Default for Bytes only on Windows.
  • Generators and build scripts: a read of each option, then a search for an input that sets it.
  • TypeScript: tsc --noUnusedLocals on the five lint projects finds no unused local.
  • Every candidate: a search for the name in src/, packages/, scripts/, test/, bench/, docs/ and the generated code.
  • Open pull requests: the 61,583 lines that the 61 open dead-code pull requests remove were indexed. No line of this diff is in that index, also when the file has moved.

Verification

All of these ran with the branch on 017b243, unless a line says otherwise:

  • bun bd (debug, ASAN).
  • bun run rust:check-all: 12 of 12 targets. An earlier run failed on macOS, FreeBSD and Windows for two trait impls. They are not in this diff.
  • cargo check --workspace --all-targets.
  • cargo check --workspace --release, with the code of a release configure. This one ran on 0ffddcd, four commits of main earlier.
  • Generated code: build/debug/codegen differs from the same directory before the change in three files only. ZigGeneratedClasses.h loses the 93 detach() blocks, WebCoreJSBuiltins.h loses the 49 WEBCORE_BUILTIN_* defines, JSSink.cpp loses the second include. The generated Rust, the .d.ts files and the module registry are byte-identical. generate-host-exports.ts writes the same file with and without the reaction shape.
  • Build graph: build.ninja and the other 405 generated files are byte-identical before and after in five configurations (debug, release, debug-local, release-local, debug --archive-deps=on). The two local ones reach the nested CMake code.
  • .buildkite/ci.json is byte-identical for a pull request build, a main build and a release build.
  • tsc --noEmit for scripts/build and src. prettier --check, clang-format --dry-run and cargo fmt --check on the files of the diff.
  • test/internal/source-lints/: 182 pass with the release binary.
  • Build script tests (test/internal/build-*.test.ts, macos-cross-config.test.ts, rust-check-all.test.ts): 102 pass with the release binary. With the debug binary, six tests of build-cli-config-flags.test.ts reach the 5 s default timeout.
  • Test files on the debug build, no failure: test/internal/bindgen.test.ts (112), test/js/web/fetch/fetch-http2-client.test.ts (88), test/js/bun/udp/udp_socket.test.ts, test/bake/dev/bundle.test.ts (29), test/js/bun/spawn/spawn-maxbuf.test.ts (16).
  • test/js/bun/sqlite/sqlite.test.js: one failure, #13082, which does 198 full collections and takes 9 s to 13 s on the debug build against the 5 s default. It times out the same way with a binary linked from the objects of main.
  • test/js/bun/console/console-table.test.ts: one GC test (cell values survive a full GC) takes between 3.5 s and 6.5 s on the debug build, against the 5 s default. It takes 4.4 s with a binary linked from the objects of main. All other tests pass.
  • The C and C++ changes were compiled on linux only. They remove comments and a member that no file names.

Follow-up candidates, not in this diff

These need a maintainer decision, or are not certain:

  • src/js/internal/assert/myers_diff.ts: the myersDiff export and the Rust myers_diff host function behind it (src/runtime/node/node_assert_binding.rs, Output::List in node_assert.rs). No JavaScript reads them. Node's own internal module has the export.
  • src/js/internal/async_context_frame.ts: AsyncContextFrame.exchange. src/js/internal/quic/quic.ts: the getQuicStreamState and getQuicSessionState exports. No reader, but they mirror Node's internal surface for tests that run with exposed internals.
  • src/codegen/generate-host-exports.ts: the rust ABI of HOST_EXPORT (about 31 lines). No marker uses it. test/internal/source-lints/host-export-callers.test.ts mirrors the grammar and must change with it.
  • src/codegen/cppbind.ts: the false_is_throw mode of ZIG_EXPORT. No C++ function has the tag. Three Rust doc comments name it.
  • src/codegen/internal-module-registry-scanner.ts: the startsWith("bun:") arm never matches, because the module list holds paths such as bun/ffi.ts. It can be a typo for "bun/" and not dead code.
  • The class-level configurable: false in 26 .classes.ts files is the default of the generator. To remove the option and the 60 lines that set it does not change the generated code.
  • src/sys/lib.rs: 38 macOS names in pub mod c's pub use libc::{...} and 11 Windows type re-exports in src/sys/windows/mod.rs have no c:: or root user.
  • src/bun_core/util.rs: the read-only accessor @ field arm of extern_union_accessors! has no invocation. src/css/values/color.rs: the @gamut none arm of define_colorspace!.
  • src/event_loop/AnyEventLoop.rs: Clone for JsPoster has no caller. The clone slot of its vtable must go with it.
  • src/spawn/error.rs: From<bun_sys::Error> for Error has no user on any target. Eleven other crates keep the same impl in their error enum, so this diff leaves it.
  • The list of the previous run still stands: packages/h3blast/, six unreferenced scripts in scripts/, scripts/buildkite.ts getLastSuccessfulBuild, the fixtures feature of bun_react_compiler, the visualizer topics of the bake dev server.

@robobun

robobun commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 8:15 AM PT - Oct 17th, 2026

✅ @robobun, your commit cb5d1aa1f346e809be1fcdaeea5f786cc9e812f3 passed in Build #127421! 🎉


🧪   To try this PR locally:

bunx bun-pr 45709

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

bun-45709 --bun

@robobun

robobun commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator Author

Status: ready for review. The diff is green.

How each deletion was verified:

  • A search for the name in src/, packages/, scripts/, test/, bench/, docs/ and the generated code finds no user.
  • bun bd, bun run rust:check-all (12 targets) and cargo check --workspace --all-targets pass on the final base (017b243).
  • The generated code differs in three files only: the detach() member, the WEBCORE_BUILTIN_* defines, one duplicate include.
  • build.ninja (five configurations) and .buildkite/ci.json are byte-identical before and after.

CI on cb5d1aa: 179 of 181 jobs passed. The other two are macOS x64 test jobs that wait for an agent. Five test files failed once and passed on a retry or alone: 29181.test.ts, module-graph-workers.test.ts, ws-server-compat-close.test.ts, websocket-server.test.ts, fetch-http3-client.test.ts. This diff does not touch the code they test.

The pull request body lists every removed item.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: oven-sh/bun/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1a2b68e4-74c9-4ef0-a1dc-1c76eeb63b5f
📥 Commits

Reviewing files that changed from the base of the PR and between d4bf10b and cb5d1aa.

📒 Files selected for processing: 1
  • src/js/private.d.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Walkthrough

The pull request narrows build configuration options, changes nested CMake path and platform flag handling, and updates code generation behavior. It also removes selected Rust re-exports, HTTP/2 window defaults, and commented-out code.

Changes

Build configuration

Layer / File(s) Summary
Build entry points and options
.buildkite/ci.ts, scripts/build/compile.ts, scripts/build/ninja.ts
CI helper calls no longer pass unused options. CompileOpts no longer supports a pool override, and Ninja now requires version 1.11.
Nested CMake dependency builds
scripts/build/source.ts, scripts/build/deps/README.md, scripts/build/deps/lsqpack.ts, scripts/build/deps/webkit.ts
Nested CMake builds use the dependency source root and build root. The configuration removes source and library subdirectory options, per-dependency C/C++ flags, and the pic setting. Patch selection is static, and Unix PIC flags vary by platform.

Code generation

Layer / File(s) Summary
Class property generation
src/codegen/class-definitions.ts, src/codegen/generate-classes.ts
Class generation no longer handles builtin-only properties or object-level enumerable defaults. Generated class headers no longer include detach().
Host export and builtin generation
src/codegen/generate-host-exports.ts, src/codegen/bundle-functions.ts, src/codegen/generate-jssink.ts
The reaction export shape and thunk path are removed; affected exports use generic classification. Generated builtin headers no longer emit per-function macros or select the Always inline attribute. A duplicate include is removed.
Codegen errors and promise intrinsics
src/codegen/cppbind.ts, src/codegen/replacements.ts, src/js/builtins.d.ts, src/js/private.d.ts
Positioned errors no longer store or render notes. Promise replacement and declarations no longer include fulfilled and rejected intrinsics. The private declaration comment is updated.

Rust public exports

Layer / File(s) Summary
Core and collection exports
src/bun_core/lib.rs, src/bun_core/string/wtf.rs, src/collections/lib.rs
Selected core, string, and hive-array types and helpers are no longer re-exported.
Bundler, CSS, and resolver exports
src/bundler/lib.rs, src/css/css_parser.rs, src/css/lib.rs, src/resolver/lib.rs
Selected bundler, CSS, and resolver symbols are removed from public re-export lists.
JavaScript and JSC exports
src/js_parser_jsc/lib.rs, src/jsc/event_loop.rs, src/jsc/lib.rs
Selected conversion helpers, JSC types, guards, call-check helpers, and task types are no longer re-exported.
Install, spawn, and system exports
src/install/lib.rs, src/spawn/lib.rs, src/sys/lib.rs
Selected install, spawn, and system symbols are removed from public re-export lists.

HTTP/2 window initialization

Layer / File(s) Summary
Window initialization
src/runtime/api/bun/h2/flow_control.rs
SendWindow and RecvWindow no longer implement Default using DEFAULT_WINDOW_SIZE.

Commented code cleanup

Layer / File(s) Summary
Commented code and unused declarations
packages/bun-usockets/src/*, packages/bun-uws/src/ChunkedEncoding.h, src/css/build-prefixes.js, src/js/builtins/ConsoleObject.ts, src/jsc/bindings/webcore/JSEventTargetCustom.cpp, src/node-fallbacks/url.js, src/runtime/bake/bun-framework-react/server.tsx
Commented-out assertions, declarations, calls, and includes are removed. The active behavior described for these edits is unchanged.

Suggested reviewers: jarred-sumner, dylan-conway

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to cb5d1

The selected change corrects an internal comment without changing runtime behavior; no merge-blocking risk is evident from the supplied change context.

Pre-merge checks: Passed 4
Check name Status Explanation
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.
Title check Passed The title clearly summarizes the primary change: removing dead code across code generators, build scripts, and ten crate roots.
Description check Passed The description explains the problem, fix, scope, behavior impact, verification steps, test results, and follow-up candidates. It uses different headings from the template but provides the required in…
Full details: Description check

Explanation

The description explains the problem, fix, scope, behavior impact, verification steps, test results, and follow-up candidates. It uses different headings from the template but provides the required information.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

… crate roots

- generate-classes: the `builtin:` property kind, the class-level
  `enumerable` option, and the `detach()` member emitted into every
  generated class. No .classes.ts file uses the options and nothing
  calls detach().
- generate-host-exports: the `reaction` shape. No HOST_EXPORT marker
  has that signature.
- builtins: `$isPromiseFulfilled`, `$isPromiseRejected`, `$alwaysInline`
  and the `WEBCORE_BUILTIN_*` defines. No builtin uses them.
- cppbind: `PositionedError.notes`, which nothing fills.
- scripts/build: NestedCmakeBuild.extraCFlags, extraCxxFlags, libSubdir,
  sourceSubdir and pic, CompileOpts.pool, NinjaOptions.ninjaVersion and
  the function form of Dependency.patches. Nothing sets them.
- .buildkite/ci.ts: three unused `options` parameters.
- Crate-root re-exports that no code names, in bun_core, bun_jsc,
  bun_css, bun_collections, bun_sys, bun_js_parser_jsc, bun_resolver,
  bun_bundler, bun_install and bun_spawn.
- Commented-out code last touched between 2022 and 2025, and one
  unreachable statement in NodeSqlite.cpp.

@claude claude 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.

I reviewed this PR and didn't find any bugs; because it removes public surface across ten Rust crate roots plus codegen and build-script options in one 42-file sweep, a human look is still worthwhile — mainly to confirm the non-Linux cargo checks the description cites ran on the final base.

What was reviewed:

  • Every removed crate-root re-export (bun_core, bun_jsc, bun_css, bun_resolver, bun_bundler, bun_collections, bun_sys, bun_js_parser_jsc, bun_install, bun_spawn): grepped for path-qualified, grouped-use, $crate::, and glob-import (crate::jsc::* in bun_runtime) spellings including cfg-gated code — no users outside the defining modules; #[bun_jsc::host_fn] expands through __macro_support, not the removed root names.
  • Codegen: no .classes.ts sets builtin: or class-level enumerable; the only detach() callers are on the hand-written JSNodeHTTPServerSocket, which declares its own; no HOST_EXPORT fn has the (ThisPtr, JSGlobalObject, CallFrame) signature the removed reaction shape matched; $alwaysInline is still parsed generically but now silently ignored (only the .d.ts guards against new uses).
  • bun_spawn From<bun_sys::Error> for Error: no ? site in src/spawn relies on it (the std::io::Error and Error::Sys(SystemErrno) paths are unaffected), but note this impl is present in 11 other crates' error.rs as part of the shared error-enum template, so dropping it only here is a convention divergence a maintainer may want to weigh.
  • h2 Default impls: all SendWindow/RecvWindow construction goes through new(); no containing struct derives Default.
Extended reasoning...

The change deletes unused re-exports from ten Rust crate roots, unused generator features in src/codegen (builtin property kind, class-level enumerable, generated detach(), reaction host-export shape, two promise-status macros, $alwaysInline, WEBCORE_BUILTIN defines), unused NestedCmakeBuild/CompileOpts/NinjaOptions fields in scripts/build, two unused trait impls, and assorted commented-out lines in C/C++/JS; it touches no security-sensitive surface. My greps found no remaining user of any removed name, including cfg-gated and macro-expanded paths, and the bug hunt ran dry. I deferred rather than approved because the sweep spans 42 files and its correctness on macOS/Windows/FreeBSD rests on the author's cross-target cargo checks, which cannot be reproduced in this environment, and because removing the From<bun_sys::Error> impl from bun_spawn alone diverges from the error-enum pattern the other crates keep.

bun_runtime: Default for the HTTP/2 SendWindow and RecvWindow.
Callers use new().

Keep the two perf command lines in scripts/trace.sh.
@robobun
robobun force-pushed the robobun/12476aa9/dead-code-sweep branch from d4bf10b to cb5d1aa Compare October 17, 2026 08:34
@robobun

robobun commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator Author

Two changes since the review above:

  • The From<bun_sys::Error> impl of bun_spawn::Error is back. Eleven other crates keep the same impl in their error enum, so this pull request does not remove it from one crate only. It is now a follow-up note in the description.
  • The cross-target check ran again on the final base (017b243). bun run rust:check-all passes on 12 of 12 targets. bun bd and cargo check --workspace --all-targets pass on that base too.

The rebase onto 017b243 also dropped the three sqlite deletions, because #45304 rewrote those lines. The diff is now 39 files, 271 lines removed, 81 added.

@claude claude 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.

Code review found no issues

No high-confidence issues detected in this change.

@robobun

robobun commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator Author

This PR and #41344 merge without a git conflict, and the result does not compile.

  • node:http2: withhold connection window credit after setLocalWindowSize() decreases it #41344 adds impl Default for LocalWindow to src/runtime/api/bun/h2/flow_control.rs. It uses DEFAULT_WINDOW_SIZE, and its tests call RecvWindow::default().
  • This PR removes the DEFAULT_WINDOW_SIZE import and impl Default for RecvWindow from the same file.
  • git merge-tree of the two heads gives a file with use super::wire::{ErrorCode, MAX_WINDOW_SIZE}; at line 11, size: DEFAULT_WINDOW_SIZE as i64 at line 161, and RecvWindow::default() at lines 210 and 228.

If both land as they are, main does not compile. Two ways out:

alii pushed a commit that referenced this pull request Oct 18, 2026
…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 -->
@robobun

robobun commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as stale: this PR conflicts with main, and its last commit is from 2026-10-17.

The branch stays, so the work is not lost. To pick it up again, rebase the branch on main and reopen this PR.

@robobun robobun closed this Nov 17, 2026
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