Repository navigation
Conversation
…tats bindings 18 trait impls that nothing uses: - bun_lint: `PartialEq<str> for Name`, `Hash` for `CodePath`, `Segment`, `EsNode`, `Reference`, `Signature` and `TsSymbol`, `Emit for f64`, `From<f64> for Value`, `From<DeclarationKind> for DeclarationKinds`, `DoubleEndedIterator for TypeIter`, `From<&Token> for TokenOrText`, `From<Pat> for Target`, `From<Expr> for Target`, `From<Target> for Node` - bun_react_compiler: `Extend` and `FromIterator` for `IdMap`, `Clone for IdBitSet` `Bun__JSBigIntStatsObjectConstructor`: only `StatType::<true>::get_constructor` reached it, and nothing calls that instantiation. `get_constructor` moves to `impl StatsSmall`, so a call on the BigInt type no longer compiles.
|
Status: ready for review.
|
|
Updated 9:23 PM PT - Oct 24th, 2026
✅ @robobun, your commit f29c5a16f4f2278a20436afacbc6ae15d595f644 passed in 🧪 To try this PR locally: bunx bun-pr 46832That installs a local version of the PR into your bun-46832 --bun |
There was a problem hiding this comment.
LGTM — pure deletion of unused trait impls and one dead FFI pair; every removal checks out against the remaining callers.
What was reviewed:
- Stats FFI:
Bun__JSBigIntStatsObjectConstructorhas no remaining declaration, definition or symbol-list entry anywhere in the repo; the onlyget_constructorcaller isnode_fs_binding.rs:165onStatsSmall, and the BigIntStats structure is still reached viacallJSStatsFunction<true>/Bun__createJSBigIntStatsObject, so no user-visible path changes. - Removed
Hashimpls: noHashMap/HashSet/derive(Hash)container keyed byCodePath,Segment,EsNode,Reference,SignatureorTsSymbol(the semanticSymbolkeeps its ownHash;Referenceappears only as a map value). TypeIter: no.rev()/next_back()/nth_back()on it (the one.rev()over union types is on the ASTList, not the lint-types iterator);IdBitSethas noderive(Clone)owner and the save/restore site usesmem::take, notclone();IdBitSetkeeps its ownExtend/FromIterator.can_tokens_be_adjacentcall sites all passTokenby value, so droppingFrom<&Token>has no caller; only one#[cfg]-gated file exists insrc/lintand none of the react-compilerfixtures/cfg(test)blocks name a removed impl.
Extended reasoning...
The commit deletes 15 unused trait impls in bun_lint, three in bun_react_compiler, and the dead BigIntStats constructor getter plus its C++/Rust extern pair, with no logic added beyond relocating get_constructor onto StatsSmall. It touches no security-sensitive surface; the only runtime-visible path is the node:fs Stats constructor getter, whose single caller and symbol are unchanged. A missing impl or extern is a compile or link error rather than a silent behavior change, and grep-level verification across the repo (including cfg-gated code and CODEOWNERS, which does not cover these files) found no remaining user of anything removed. The bug hunt ran dry with no findings, so a human look is not needed.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Stats constructor selection src/runtime/node/Stat.rs, src/jsc/bindings/NodeFSStatBinding.cpp |
The generic constructor selection and BigInt Stats binding are removed. StatsSmall returns the Stats constructor. |
Lint Trait and Conversion Implementations
| Layer / File(s) | Summary |
|---|---|
AST and ESTree conversions src/lint/ast/name.rs, src/lint/estree/value.rs, src/lint/utils/ast_utils.rs, src/lint/utils/estree_compat.rs, src/lint/semantic/mod.rs |
Selected name comparison, numeric emission, and AST and ESTree conversion implementations are removed. |
Hashing and iterator traits src/lint/code_path/mod.rs, src/lint/selector/mod.rs, src/lint/semantic/mod.rs, src/lint/types/signature.rs, src/lint/types/symbol.rs, src/lint/types/ty.rs |
Hash implementations are removed from code paths, nodes, references, signatures, and symbols. TypeIter no longer implements DoubleEndedIterator. |
React Compiler Collection Traits
| Layer / File(s) | Summary |
|---|---|
IdMap and IdBitSet traits src/react_compiler/hir/id_map.rs |
IdMap loses its Extend and FromIterator implementations. IdBitSet loses its Clone implementation. |
Suggested reviewers: jarred-sumner
Priority:
Merge Risk: 
Minimal · up to f29c5
-
Merge Risk: ⚪ Minimal · up to
f29c5The cleanup preserves supported runtime behavior and workspace consumers.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The description follows the repository template, with both required sections present: "What does this PR do?" (Problem, Fix, Background, Downsides, and a detailed Notes block) and "How did you verify your code works?" (a Verification section listing commands, test counts, and results). It states the change has no behaviour change and lists the removed impls, the deleted BigInt Stats constructor, and the moved getter. The description is thorough and matches the raw summary and PR objectives. It is long, but it covers 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.
Comment @coderabbitai help to get the list of available commands.
Problem
bun_linthandles and 3 onIdMapandIdBitSet(bun_react_compiler) have no user. rustc'sdead_codelint does not report trait impls.Bun__JSBigIntStatsObjectConstructor(NodeFSStatBinding.cpp) is reachable only throughStatType::<true>::get_constructor, which nothing calls.Fix
get_constructormoves toimpl StatsSmall, its one instantiation. 13 files, 138 lines removed, 6 added.bun run rust:check-all,cargo check --workspace --all-targets, clippy,bun bd, and the lint, react-compiler andnode:fsStats tests.Behaviour change: none
Background
--gc-sections --print-gc-sections.IdSetandIdMapsincebun lint: the rules that need types, compared with tsgolint function by function #45133, which removed the lastFxHashMapkeyed byTsSymbolorSignature.Downsides
bun lintandbun format#44805 (2026-10-11), so the lint port can still reach some.cargo clippyjob.Notes
Removed
bun_lint, 15 impls:HashforCodePathandSegment(code_path/mod.rs),EsNode(selector/mod.rs),Reference(semantic/mod.rs),Signature(types/signature.rs) andTsSymbol(types/symbol.rs)From<Pat> for Target,From<Expr> for TargetandFrom<Target> for Node(utils/estree_compat.rs)From<&Token> for TokenOrText(utils/ast_utils.rs). The by-valueFrom<Token>stays.From<f64> for ValueandEmit for f64(estree/value.rs)From<DeclarationKind> for DeclarationKinds(semantic/mod.rs)DoubleEndedIterator for TypeIter(types/ty.rs)PartialEq<str> for Name(ast/name.rs). The&str,[u8]and&[u8]impls stay.bun_react_compiler, 3 impls:ExtendandFromIteratorforIdMap,Clone for IdBitSet(hir/id_map.rs)Bun__JSBigIntStatsObjectConstructor(NodeFSStatBinding.cpp), its declaration insrc/runtime/node/Stat.rs, and theBIGarm ofget_constructor.get_constructoris now onimpl StatsSmall, so a call on the BigInt type does not compile.What earlier sweeps said about these items
Hashimpls andFromforTarget,TokenOrText,ValueandDeclarationKindswith "They stay for the owners of the lint crates to decide". It listsExtendandFromIteratorforIdMapandClone for IdBitSetas "a design call as in Remove dead code: 49 trait impls nothing uses, across 12 crates #43664".Emit for f64andDoubleEndedIterator for TypeIter. It names one follow-up: a pull request that asks if the unusedHashandFromimpls of thebun_linthandles stay. This is that pull request for thebun_lintgroup.PartialEq<str> for Nameis in neither list.Cargo.toml:218says every crate is an internal implementation detail of one binary.REVIEW.md:56says "Delete dead code in the same PR that makes it dead".History of the 18 impls
git blameputs all 18 headers in c39c718 (Addbun lintandbun format#44805, 2026-10-11).Hash for TsSymbolandHash for Signaturehad users at that commit.bun lint: the rules that need types, compared with tsgolint function by function #45133 (177da66) replacedFxHashMap<TsSymbol, _>andFxHashMap<Signature, _>withIdMap.Found dead, not taken
scid_lenanddelay_onclose(node_quic_shim.c,src/lsquic_sys/lib.rs): open http: consolidate the open fetch, Bun.serve, node:http, node:http2 and HTTP/3 pull requests #46528 deletes the same six lines.From<Vec<Doc>> for Doc(src/format/css/doc.rs): thedocs!macro documents any value that converts to aDocas its input.ErrName for bun_sql_jsc::Error: open socket, timer, sql, redis: replaceunsafewith typed ownership #40139 and cli: remove unsafe from bun run / bun test / --filter and the other CLI commands #40242 callthrow_error(crate::Error::from(err), ..), which needs it.Default for ZStream: added by zlib: reach the z_stream only through a raw pointer while zlib-ng holds its back-pointer #46607 on 2026-10-23.StaticallyNamedforIdent,PatandNode: the doc ofvalue_matches_specifiernamesPatandIdentas inputs.Spanned for Target, andLocatedandLocatefor some handles: Remove dead code from bun_sema and bun_format: 6 trait impls nothing uses #45430 left them because the trait docs describeLocateandLocatedas a table of handles.handle!(src/lint/ast/mod.rs) also stampsHashon the handle types it defines. This PR does not change the macro.Bun__JSBigIntStatFSObjectConstructorandBun__JSStatFSObjectConstructor(NodeFSStatFSBinding.cpp) have no Rust declaration. Open Remove dead code from the JSC bindings, headers.h, the console builtin, and bun_jsc #40232 removes them.bun_css14,bun_collections11,bun_core10,bun_sema8,bun_ast6,bun_ptr4, and 8 in five other crates. Most are std impls on shared types (Deref,IntoIterator,Extend,Default,From,AsRef). Open Compile TypeScript to machine code ahead of time:bun build --compile --aot#45631 touches 352 files ofbun_sema. Per Remove dead code: 8 trait impls nothing uses, in bun_bundler, bun_core and bun_css #45988, a unit test in open RacyCell: replace the unconditional Sync impl with an owner-thread runtime check #31178 callsRacyCell::default()and css: compare custom property names inPropertyIdequality and importance in duplicate-rule detection #33684 hashes aPropertyId.Checked against the open pull requests
cargo check --workspace --all-targetson each merge. All pass.bun check: TypeScript 7.1 #46383 and Compile TypeScript to machine code ahead of time:bun build --compile --aot#45631 moved after that. Their new commits add no line insrc/lintorsrc/react_compilerthat names one of these types..into(),.collect()or==, so the merge instruction in Downsides still applies.Method
-Wl,--gc-sections -Wl,--print-gc-sections. The export list and the version script stay, so the NAPI, V8 and uv surface is still a root.Debug,DisplayorDrop).Verification on this commit
cargo check --workspace --all-targets --keep-going: passbun run rust:check-all: 12 ok, 0 failed, 0 skippedcargo clippy --no-depsforbun_lint,bun_react_compilerandbun_runtime: passbun bd: passfs-stats-constructor7 pass,fs-stats-truncate3 pass, lintnative-rules193 pass, lintreact-compiler26 pass, transpilerreact-compiler121 passtest/cli/lint/lint.test.ts712 pass,test/cli/format/format.test.ts1627 pass,quic-endpointandquic-stream22 pass.--timeoutabove the default 5 s with a debug build on this machine. With it they pass.cargo check --releasecannot checkbun_jscagainst a debug codegen directory (bindgen_testis debug-only), so the release profile was checked only for the crates belowbun_jsc.bun_lintandbun_react_compilerpass.no test proof · iteration 1 · the description declares no behaviour change, so there is no failing test to prove; the existing suite in CI is the check