Repository navigation
Conversation
…es in BunProcess.cpp, three DirEntType enumerators The queries source_file, compare_types and symbol_to_string of the queries! list in src/lint/types/mod.rs have no caller. The list generated the only call of the Services functions of the same names in bun_sema, so those go too. BunProcess.cpp does not name Exception, JSModuleLoader, JSModuleRecord, SourceOrigin or JSNonFinalObject after the alias lines. NodeDirent.cpp does not name Whiteout, Door or EventPort.
|
Updated 1:53 PM PT - Oct 17th, 2026
✅ @robobun, your commit 61ca6f133e48f3a4ace622fab42d411adc7c939a passed in 🧪 To try this PR locally: bunx bun-pr 45764That installs a local version of the PR into your bun-45764 --bun |
|
Status: ready for review.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe changes remove unused C++ aliases and enum members, along with three query methods from the Rust ChangesC++ declaration cleanup
Rust query API cleanup
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
LGTM, a pure deletion of unreferenced items with no behavior change.
What was reviewed:
- Expanded
queries!in src/lint/types/mod.rs: each entry generates only a defaultedQueriestrait method plus a forwarding impl toServices; the sole other implementor (NoTypes) overrides nothing, and noQueriesreceiver callssource_file,compare_typesorsymbol_to_stringanywhere in src/lint (the remaining hits areCheckermethods in bun_sema, a privateTypeNodecomparator in prefer_optional_chain.rs, and the parser'ssource_file). - Confirmed what the deleted
Servicesbodies called (Files::by_path,Checker::compare_types,Checker::symbol_to_string,prop_to_string) still has other callers, so nothing else becomes dead. - NodeDirent.cpp:
DirEntTypeis file-local, no switch over it, andWhiteout/Door/EventPortare named nowhere in C++ or in tests beyond a comment in test/regression/issue/24129.test.ts describing the old bug; the remaining enumerators and theuv_dirent_type_tmapping are unchanged. - BunProcess.cpp: the five removed aliases are not named in the file, and
using namespace JSC;on line 166 would resolve them anyway, including under a unity build.
Extended reasoning...
The change is a single commit of 29 deleted lines across six files: three entries dropped from the lint-side queries! macro list and their matching Services forwarding targets in bun_sema, five unused using aliases in BunProcess.cpp, and three zero-valued enumerators in a file-local C++ enum in NodeDirent.cpp. It touches no security-sensitive surface (no auth, crypto, parsing of untrusted input, or FFI signatures). Approval rests on direct verification that each removed item has no remaining consumer, including macro-expanded code and the second Queries implementor, and that nothing downstream becomes newly dead; the changed paths have no CODEOWNERS entry and there are no outstanding reviewer objections.
Problem
source_file,compare_typesandsymbol_to_stringin thequeries!list ofsrc/lint/types/mod.rshave no caller. The list generates the only call of theServicesfunctions of the same names inbun_sema. The trait ispub, so rustc does not check it.BunProcess.cppdeclares fiveusing X = JSC::X;aliases that it never names.DirEntTypeinNodeDirent.cpphas three enumerators that nothing names.Fix
Servicesfunctions (21 lines), the five aliases and the three enumerators.bun bd,bun run rust:check-all,cargo check --workspace --all-targets, 8 test files (Notes).pub(crate)narrowing ofQueries(resolve_nameneeds 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 aQueriesmethod and a forwarding call toServicesinbun_sema.BunProcess.cppcompiles as its own unit withusing namespace JSC;, so the aliases change no name lookup.Downsides
Behaviour change: none
Notes
Removed
src/lint/types/mod.rs: thequeries!linessource_file,compare_typesandsymbol_to_string. No call of these names has aQueriesreceiver. The calls that exist go to other functions:Checker::compare_typesandChecker::symbol_to_stringinbun_sema, a privatecompare_typesinprefer_optional_chain.rs, and the parser'ssource_file. WithQueriesmade crate-private in a scratch edit, rustc reportsresolve_nameas 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 aliasesException,JSModuleLoader,JSModuleRecord,SourceOrigin,JSNonFinalObject. None of the names appears in the rest of the file. The same block inPath.cppandZigGlobalObject.cppis left to Remove dead code from the class and sink generators, JSBuffer, the bake client, bun-error, and the build scripts #43378 and Remove dead code from the WebCore, node, and sqlite bindings, uWS/uSockets, SecretsLinux, and five Rust crates #42431.src/jsc/bindings/NodeDirent.cpp: the enumeratorsWhiteout,DoorandEventPortofDirEntType, all equal toUnknown. No C or C++ file names them.Open pull requests
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.BunProcess.cpp, and the three enumerators.Found dead in this run, and left alone
JSSQLStatement.cppandNodeSqlite.cpp(sql: consolidate the open Bun.sql, bun:sqlite and node:sqlite pull requests #45304).JSEventTargetCustom.cppandsrc/node-fallbacks/url.js(Remove dead code from the code generators, the build scripts, and ten crate roots #45709, and node-fallbacks: add fileURLToPath, pathToFileURL and the domain functions to the url polyfill #43730 forurl.js), two typedefs inInspectorHTTPServerAgent.cpp(Remove dead code from Exception.h, ExceptionOr.h, ErrorCode.h, InspectorHTTPServerAgent.cpp, and JSBuffer.cpp #45725), theBUN_WEBKIT_VERSIONfallback inBunProcess.cpp(build: dependency version bumps rebuild only what changed #41729), a commented-out line insrc/js/internal/html.ts(add bun bake: serve app/pages and app/server.ts #45682).Event::currentTargetIsInShadowTree()and theMediaTimeoverload ofJSConverter<IDLUnrestrictedDouble>(bun:dom and the Vitest work in one tree (not for merging) #45415).scid_lenanddelay_onclose(Remove dead code from the bake client, uSockets, uWS HTTP/2, uws_sys, and the CI pipeline script #43976, and node:quic: remove unsafe from the endpoint, session, stream and TLS code #40220 changes the line above them).resolve_name, the fourth query with no caller. tsgolint'sprefer-readonlycallsResolveNameand 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,Queriescan becomepub(crate), and rustc then guards the list.ThenCall::on_fulfilled,FinallyCall::on_finally,BaseTypeOfClassMember::base_typeandheritage_token,TargetElement::is_shorthand, withTsNode::token(as Remove dead code from bun_format, bun_sema, bun_install, and bun_core #45402 held them). Also 33 functions from macro lists insrc/lint/types/that nothing calls, andFile::expr_tags_in_tree.Debugimpls inbun_lint, 5 inbun_format, andDisplayforDifference,FilePollandPart.targetvalue that nothing reads (BundlerPlugin::target, three more members, a parameter ofJSBundlerPlugin__create, and the Rust enum). Its removal changes an FFI signature.PerformanceResourceTimingcannot be constructed, soResourceTiming.cpp,NetworkLoadMetrics.cppandServerTiming.hare reachable only from its getters.How the candidates were found
src/js, the C++ bindings (three parts), uSockets and uWS, the build scripts, the side packages, the three new crates, and commented-out code.-Wl,--gc-sections, with each dropped function mapped to its source line byllvm-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.bun_sema:pubnarrowed topub(crate)on each item that no other crate names, in a scratch tree. rustc reported nothing new.--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.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