Remove dead code from react_compiler and the node:http2 frame parser
Closed
RO
3mo ago+230+230+012345678901234567890123456789-3438-3438-0123456789012345678901234567890123456789
Net -3,128 lines. Every deletion is a zero-reference symbol confirmed by a rustc --force-warn dead_code fixpoint on the touched crates (not just grep), plus a repo-wide reference search covering generated codegen output.
react_compiler (-1,139)
- The experimental variant of the derived-computations-in-effects validation (
validate_no_derived_computations_in_effects_exp+ its 22 exclusive helpers/types, ~1.1k lines in one file). The pipeline only ever calls the non-exp version; the_expenv-config flag is parsed from fixture pragmas but read by nothing, so this was unreachable under every cfg combination. The fixture suite (3,329 tests, including theeffect-derived-computationsfixtures that set the_exppragma) passes unchanged. SymbolHost: a back-compat alias for a previous parser-hook API, zero users (DESIGN.md updated to nameHost).HirBox: arena-box alias with zero uses.
h2_frame_parser.rs (-2,171)
The pre-engine inbound frame-handling path. Since rewrite_read() routed all inbound bytes through the h2 Connection engine, these were transitively unreachable (private items, so the compiler verdict is exact):
- 19 handler methods:
handle_incomming_payload,handle_window_update_frame,handle_unknown_frame,handle_push_promise_frame,decode_header_block,handle_data_frame,handle_go_away_frame,handle_origin_frame,handle_altsvc_frame,handle_rst_stream_frame,handle_ping_frame,handle_priority_frame,handle_continuation_frame,finish_headers_end_stream,handle_headers_frame,handle_settings_frame,lookup_inbound_stream,read_bytes,dispatch_frame - Decode-direction wire helpers only they used:
u32_from_bytes,SettingsFlags,UInt31WithReserved::{from, from_bytes},StreamPriority::from,SettingsPayloadUnit::from,FullSettingsPayload::{update_with, write},get_http2_common_string+ its extern declaration,type HeaderValue,struct Payload - Helpers with no remaining callers:
dispatch_with_3_extra,send_settings_ack,adjust_window_size,increment_window_size_if_needed - Write-only parser/stream state those handlers maintained:
current_frame,remaining_length,expecting_continuation,preface_received_len,pending_header_block,pending_header_flags,is_waiting_more_headers,header_block_size,header_block_count,Stream.padding
exe_format (-2)
pe::Error::InsufficientSpace: never constructed.
Verification
rustc --force-warn dead_codereaches a warning-free fixpoint onbun_react_compiler,bun_runtime,bun_exe_formatcargo checkon all 10 CI target triples: 10 ok- Full debug build
test/js/node/http2/node-http2.test.js: 347 pass / 0 fail;h2-conformance+continuation+invalid-padding: 77 passreact-compiler.test.ts+react-compiler-fixtures.test.ts: 3,329 pass / 0 failtest/internal/source-lints/: 78 pass, including the new guard test that keeps these symbols from reappearing
Noted but deliberately not removed
compile_result.rslogger-serialization types and the always-emptyevents/ordered_logfields: zero-referenced, but annotated (unreachable_pubreason) as staged for logger wiring.ReactCompilerOptionsplaceholder fields (gating,ignore_use_no_forget, ...): write-only, but commented as placeholders for a future flag.- The C++ definition of
JSC__JSGlobalObject__getHTTP2CommonStringin ZigGlobalObject.cpp is now unreferenced from Rust; left for a follow-up since that file has pending changes in other open PRs. ThreadSafeRefCount::releaseand the h2 outbound-encoder API: no production callers, but covered by unit tests and deliberately staged.
[review] gate passed · iteration 1 · 11 files touched
fails on main (without fix)
ASAN without fix: 3 failed, 320 skipped
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/bundler/transpiler/react-compiler-fixtures.test.ts "test/internal/source-lints/dead-symbols-react-compiler-h2.test.ts"
bun test v1.4.0 (0dad17989)
test/internal/source-lints/dead-symbols-react-compiler-h2.test.ts:
46 | // Arena box alias with zero uses (HirVec is the one HIR actually uses).
47 | ["src/react_compiler/hir/mod.rs", /\bHirBox\b/],
48 | // Type predicate whose only callers were in the removed _exp validation.
49 | ["src/react_compiler/hir/mod.rs", /\bis_use_state_type\b/],
50 | ];
51 | expect(resurrected(checks)).toEqual([]);
^
error: expect(received).toEqual(expected)
- []
+ [
+ "src/react_compiler/validation/validate_no_derived_computations_in_effects.rs: /validate_no_derived_computations_in_effects_exp/",
+ "src/react_compiler/hir/environment_config.rs: /validate_no_derived_computations_in_effects_exp/",
+ "src/react_compiler/program.rs: /validate_no_derived_computations_in_effects_exp/",
+ "src/react_compiler/program.rs: /\bSymbolHost\b/",
+ "src/re
... (truncated)
release without fix: 3 failed, 1146 skipped
bun test v1.4.0-canary.1 (3a845b7a5)
test/internal/source-lints/dead-symbols-react-compiler-h2.test.ts:
46 | // Arena box alias with zero uses (HirVec is the one HIR actually uses).
47 | ["src/react_compiler/hir/mod.rs", /\bHirBox\b/],
48 | // Type predicate whose only callers were in the removed _exp validation.
49 | ["src/react_compiler/hir/mod.rs", /\bis_use_state_type\b/],
50 | ];
51 | expect(resurrected(checks)).toEqual([]);
^
error: expect(received).toEqual(expected)
- []
+ [
+ "src/react_compiler/validation/validate_no_derived_computations_in_effects.rs: /validate_no_derived_computations_in_effects_exp/",
+ "src/react_compiler/hir/environment_config.rs: /validate_no_derived_computations_in_effects_exp/",
+ "src/react_compiler/program.rs: /validate_no_derived_computations_in_effects_exp/",
+ "src/react_compiler/program.rs: /\bSymbolHost\b/",
+ "src/react_compiler/lib.rs: /\bSymbolHost\b/",
+ "src/react_compiler/hir/mod.rs: /\bHirBox\b/",
+ "src/react_compiler/hir/mod.rs: /\bis_use_state_type\b/",
+ ]
- Expected - 1
+ Received + 9
at <anonymous> (/workspace/bun/test/internal/source
... (truncated)
passes on PR (with fix)
ASAN with fix: 320 skipped
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/bundler/transpiler/react-compiler-fixtures.test.ts "test/internal/source-lints/dead-symbols-react-compiler-h2.test.ts"
bun test v1.4.0 (0dad17989)
test/internal/source-lints/dead-symbols-react-compiler-h2.test.ts:
(pass) dead react_compiler symbols do not reappear [20.51ms]
(pass) dead h2_frame_parser inbound-path symbols do not reappear [149.68ms]
(pass) dead exe_format symbols do not reappear [3.03ms]
test/bundler/transpiler/react-compiler-fixtures.test.ts:
(pass) react-compiler upstream fixtures > fixture corpus is present [2.25ms]
(pass) react-compiler upstream fixtures > alias-capture-in-method-receiver > minify.syntax [8.78ms]
(pass) react-compiler upstream fixtures > alias-capture-in-method-receiver-and-mutate > minify.syntax [0.73ms]
(pass) react-compiler upstream fixtures > alias-computed-load > minify.syntax [0.47ms]
(pass) react-compiler upstream fixtures > alias-nested-member-path > minify.syntax [0.49ms]
(pass) react-compiler upstream fixtures > alias-capture-in-method-receiver > compile [39.10ms]
(pass) react-compi
... (truncated)
release with fix: 1146 skipped
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 683ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/6] gen generated_host_exports.rs
generated_host_exports.rs: 93 exports (host=3, lazy=10, generic=80, rust=0); 239 extern-C blocks audited
[1/6] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)
nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)
[1m[92m Compiling[0m bun_core v0.0.0 (/workspace/bun/src/bun_core)
[1m[92m Compiling[0m bun_errno v0.0.0 (/workspace/bun/src/errno)
[1m[92m Compiling[0m bun_ptr v0.0.0 (/workspace/bun/src/ptr)
[1m[92m Compiling[0m bun_boringssl_sys v0.0.0 (/workspace/bun/src/boringssl_sys)
[1m[92m Compiling[0m bun_safety v0.0.0 (/workspace/bun/src/safety)
[1m[92m Compiling[0m bun_zlib_sys v0.0.0 (/workspace/bun/src/zlib_sys)
[1m[92m Compiling[0m bun_cares_sys v0.0.0 (/workspace/bun/src/cares_sys)
[1m[92m Compiling[0m bun_zstd v0.0.0 (/workspace/bun/src/zstd)
[1m[92m Compiling[0m bun_picohttp v0.0.0 (/workspace/bun/src/picohttp)
[1m[92m Compiling[0m bun_brotli v
... (truncated)
diff hotspot
src/exe_format/pe.rs | 2 -
src/react_compiler/DESIGN.md | 4 +-
src/react_compiler/hir/environment_config.rs | 2 -
src/react_compiler/hir/mod.rs | 11 +-
src/react_compiler/lib.rs | 2 +-
src/react_compiler/program.rs | 7 -
.../validate_no_derived_computations_in_effects.rs | 1161 +---------
src/runtime/api/bun/h2_frame_parser.rs | 2350 +-------------------
src/runtime/error.rs | 3 -
.../transpiler/react-compiler-fixtures.test.ts | 6 +-
.../dead-symbols-react-compiler-h2.test.ts | 120 +
11 files changed, 230 insertions(+), 3438 deletions(-)
gate history · 7 passed · 0 rejected · iteration 1
evidence per changed file
file reads edits tests
src/exe_format/pe.rs 0 0 0
src/react_compiler/DESIGN.md 0 0 0
src/react_compiler/hir/environment_config.rs 1 1 0
src/react_compiler/hir/mod.rs 2 5 0
src/react_compiler/lib.rs 1 2 0
src/react_compiler/program.rs 1 1 0
…lidation/validate_no_derived_computations_in_effects.rs 3 3 0
src/runtime/api/bun/h2_frame_parser.rs 4 17 0
src/runtime/error.rs 1 1 0
test/bundler/transpiler/react-compiler-fixtures.test.ts 2 2 0
…nal/source-lints/dead-symbols-react-compiler-h2.test.ts 2 5 0