Skip to content

build: generate bun_core::build_options from Config instead of option…

5b0e92c
Select commit
Loading
Failed to load commit list.
Merged

build: generate bun_core::build_options from Config #30749

build: generate bun_core::build_options from Config instead of option…
5b0e92c
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed May 15, 2026 in 12m 48s

Code review found 1 important issue

Found 8 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important scripts/build/buildOptionsRs.ts:31-32 rbstr() generates invalid Rust for non-ASCII paths
🟡 Nit src/bun_core/lib.rs:660-662 const_parse_u32 is now dead code

Annotations

Check failure on line 32 in scripts/build/buildOptionsRs.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

rbstr() generates invalid Rust for non-ASCII paths

`rbstr()` emits Rust byte-string literals via `b${JSON.stringify(s)}`, but Rust `b"..."` literals are ASCII-only and `JSON.stringify` passes non-ASCII characters through literally — so if `cfg.cwd` or `cfg.codegenDir` contain non-ASCII characters (e.g. a Windows checkout under `C:\Users\Müller\` or a CJK home dir), the generated `build_options.rs` fails to compile with `non-ASCII character in byte string literal`. This is a regression: the old `option_env!("BUN_BASE_PATH") → v.as_bytes()` path h

Check warning on line 662 in src/bun_core/lib.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

const_parse_u32 is now dead code

Nit: `const_parse_u32` (src/bun_core/util.rs:2244) is now dead code — its only callers were the three `crate::const_parse_u32(build_opt!("BUN_VERSION_*", ...).as_bytes())` lines this PR removed. The generated file emits integer literals directly, so the helper is orphaned; since it's `pub` (re-exported via `pub use util::*`) the `dead_code` lint won't catch it. Worth deleting alongside the env-var handshake it served.