build: bump Rust toolchain to nightly-2026-07-20
Closed
RO
4mo ago+117+117+012345678901234567890123456789-106-106-012345678901234567890123456789
Bumps the pinned Rust nightly from nightly-2026-05-06 to nightly-2026-07-20.
| old | new | |
|---|---|---|
| rustc | 1.97.0-nightly (e95e73209 2026-05-05) | 1.99.0-nightly (9f36de775 2026-07-19) |
| bundled LLVM | 22.1.4 | 22.1.8 |
Notable upstream changes in this range
- v0 symbol mangling is now the default (rust#151994, 1.97). Rust symbols are now emitted with the
_Rprefix instead of legacy_ZN. std's own backtrace printer demangles both, but bun.report's server-side remapper and any external profiler/debugger tooling that reads Bun's Rust frames needs a v0-aware demangler. We do not pin-Csymbol-mangling-version, so this takes effect. linker_messageslint on by default (rust#153968, 1.97). Already handled:scripts/build/rust.tsandscripts/build/cargo-config.tspass-Alinker_messages.- Bundled LLVM 22.1.4 → 22.1.8 (same major). Cross-language LTO against our clang-21 is unaffected; the
rust-lto-fixstep still reads rustc-emitted bitcode with rustc's ownllvm-tools. - Windows
WSAESHUTDOWNnow maps toio::ErrorKind::BrokenPipe(rust#156063, 1.97). N/A for us: Bun's socket layer maps Win32 errors throughbun_errno(which already mapsWSAESHUTDOWN→EPIPE), not std'sErrorKind. - Enum layout encoding changed for some
repr(Rust)enums (rust#155473, 1.97). N/A: every enum we pass across FFI isrepr(C)/repr(u*). {integer}::isolate_lowest_one/isolate_highest_onestabilised (1.97). Used in two of the clippy fixes below.core::mem::type_infonightly feature reshaped:core::intrinsics::type_idis now#[rustc_comptime](compile-time only), andtype_info::Typelost itssizefield in favour ofTypeId::size().bun_collections::MultiArrayListis the only user; fixed below.- Of the nightly features we enable (
adt_const_params,allocator_api,arbitrary_self_types_pointers,generic_const_exprs,hasher_prefixfree_extras,inherent_associated_types,macro_metavar_expr,sync_unsafe_cell,thread_local,type_info,core_intrinsics), onlytype_info/core_intrinsicschanged shape. - New rustc lint
suspicious_runtime_symbol_definitions(1.99 nightly). Flagsextern "C"declarations of runtime symbols (exit, etc.) whose Rust signature differs from std's own. Ourbun_core::Globaldeclareslibc_exitassafe fnon purpose (no memory-safety preconditions); the ABI is identical, so#[allow]on the block.
Toolchain pin
rust-toolchain.toml.github/workflows/{format,clippy,miri}.yml(RUSTUP_TOOLCHAIN)
Nightly API changes (core::mem::type_info)
bun_collections::MultiArrayList uses the experimental reflection API, which changed shape:
core::intrinsics::type_idis now#[rustc_comptime](callable only at compile time). Wrapped the call in aconst { }block.type_info::Typeno longer has asizefield; the size now comes fromTypeId::size().
New clippy lints
The new nightly promotes several lints that trip under the workspace's -D warnings. All fixes are mechanical and preserve behaviour:
clippy::needless_late_init: convert latelet x; if ... { x = ... } else { x = ... }tolet x = if ... { ... } else { ... };(bun_alloc, bun_collections, js_parser, js_printer, install, runtime/node/path, runtime/socket/udp, valkey_jsc, sql_jsc/mysql)clippy::chunks_exact_to_as_chunks: replace.chunks_exact(N)/.chunks_exact_mut(N)on constNwith.as_chunks::<N>()(bun_core, boringssl, ast/char_freq, http_jsc websocket, runtime/cli/upgrade, runtime/image, runtime/webcore/encoding)clippy::manual_isolate_lowest_one:x & x.wrapping_neg()→x.isolate_lowest_one()(collections, css)clippy::manual_clear:truncate(0)→clear()(router)clippy::drain_collect:vec.drain(..).collect()→mem::take(&mut vec)(react_compiler)
Quiet rustup output
The build runs rustup toolchain install --force before cargo to self-heal partial toolchain installs. On a no-op this printed:
info: syncing channel updates for 'nightly-...-aarch64-apple-darwin'
info: latest update on ...
info: component 'rust-src' is up to date
info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager
Added -q (sets rustup log level to WARN) and --no-self-update to the three call sites (scripts/build/{rust.ts,source.ts,tools.ts}) so the info lines are suppressed while download/error output still surfaces.
Verification
bun bdbuilds andbun-debug --revisionrunscargo fmt --all --checkis clean on the new nightly (no formatting drift)cargo clippy --workspace --no-deps --keep-goingpasses on the new nightlycargo test -p bun_collections multi_arraypasses (7/7)
Fixes #31414