Build with a pinned nightly; a fast profile cuts a rebuild from minutes to half a minute #124
Loading…
Reference in a new issue
No description provided.
Delete branch "nightly-toolchain"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Based on
main, independent of the open stack; it touches no checker code.Two things made work on this repository slow, and one request goes with them.
Every optimised build used the shipped profile.
[profile.release]is thin LTO with one codegen unit: right for the binaries on npm, wrong for an edit loop. Measured on a 32-core machine, after a one-line change to the core crate:cargo build --release -p safe_ts_clicargo build --release -p safe_ts_napifastprofilecargo nextest run(dev profile)Anyone who runs the checker on real code after a change, a person or an agent, paid those minutes several times per change, and
npm run buildpays them twice (the CLI and the addon). CI's test and benchmark jobs paid them on every push.The toolchain was "whatever stable is current". The request: build with nightly, and rely on the next-generation trait solver, the Polonius alpha borrow checker, the parallel frontend, and what Rust 1.100 stabilised.
What changes
rust-toolchain.tomlpinsnightly-2026-11-18for local builds, CI and the released binaries. The four workflows read the date from that file, so it is raised in one place..cargo/config.tomlruns the parallel frontend on 8 threads (the nightly's default is 2) and names the next solver and Polonius, so that a toolchain bump which changes a default is a decision and not a surprise. It also sets Cargo 1.100's dependency cooldown:cargo updateskips versions published less than three days ago.crates/safe_ts_core/tests/toolchain.rshas one small item per feature that compiles only with it. I checked each the other way round: with-Zpolonius=offthe test fails with E0499, with-Znext-solver=coherencewith E0277.[profile.fast]: the release profile without LTO, with 16 codegen units. One variable selects it everywhere: withSAFE_TS_PROFILE=fast,npm run build,npm run check,npm run typecheckand the soundness corpus build and usetarget/fast/. The binary runs about 7% slower. CI's test, benchmark and docs jobs set it (the benchmarks time the JavaScript the transform emits, not the Rust binary); the release does not.Two things that are easy to get wrong here
build.rustflagsonly when notarget.*.rustflagsentry applies. A machine whose own~/.cargo/config.tomlsets flags for its target (a linker, say) would silently drop a[build]entry. The flags are under[target.'cfg(all())'], which Cargo joins with the machine's;cargo build -vshows both on every rustc call.--jobs-frontend=8. cargo-xwin, which builds the Windows binaries in the release, copies the configured flags into the target's environment variable; Cargo then joins that with the config entry, and rustc refuses--jobs-frontendgiven twice.-Zthreads=8is still accepted and may repeat, so that is what the config uses.Verified
cargo test --workspace --locked(329 pass), the std tests (378), the soundness corpus,typecheck, the Vite check, the docs build, andbench:check(50 ratios within tolerance).cargo xwin checkforx86_64-pc-windows-msvcpasses for the CLI and the addon.workflow_dispatch) covers them; run it once before the next tag.Not in this change
Using the new library APIs in existing code. The candidates are few (25
strip_prefix(..).unwrap_or(..)that becometrim_prefix/trim_suffix, 10 hand-written scope guards that could beDropGuard), and a sweep through the checker now would conflict with every open pull request. New code can use them from here on; the sweep can follow once the stack has landed.Created with Claude Fable 5.2 in Claude Code.