Skip to content

Remove the Rust build system - #9238

Merged
cknitt merged 8 commits into
masterfrom
remove-rust-rewatch
Nov 6, 2026
Merged

cknitt merged 8 commits into
masterfrom
remove-rust-rewatch

Conversation

@cknitt

@cknitt cknitt commented Nov 5, 2026

Copy link
Copy Markdown
Member

Removes the Rust build system. rescript has run the OCaml build system since 13.0.0-alpha.7, and rescript-rust only shipped for comparison.

Commits

  1. Check rewatch output against snapshots instead of Rust rewatch. The rewatch-ocaml/tests/check_*.sh scripts used to run Rust and OCaml side by side. Now they run rescript alone:

    • Config acceptance: each case keeps its expected accept/reject. The argument comparison became one snapshot (snapshots/config_acceptance/arguments.txt).
    • Command validation: the Rust-vs-OCaml output comparisons became 24 snapshots.
    • Verbose output: three event snapshots.
    • Interactive output: it already had exact expectations for every phase, so the Rust comparisons were simply dropped.
    • Snapshot helper: check_snapshot (in test_helpers.sh, with check_snapshot.js) replaces root paths with placeholders and normalizes CRLF and backslashes, so one snapshot serves Unix and Windows. UPDATE_SNAPSHOTS=1 rewrites the snapshots.
    • Checked against Rust: before Rust was removed, the converted scripts were also run against the Rust executable, and every snapshot matched its output.
    • Dropped cases: only the three missing-RESCRIPT_BSC_EXE cases, which tested a Rust-only variable.
  2. Remove the Rust build system:

    • rewatch/src, Cargo files, rustfmt.toml, and Rust agent docs.
    • The rescript-rust bin and launcher (package.json, platform packages, artifacts.json).
    • The Cargo rules in the Makefile (rewatch, test-rewatch-rust, clean-rewatch).
    • The build-rewatch CI action, copyExes.js, and the Rust reference suite run.
    • Rust formatting, the Cargo version constraint, and the Rust base image and extension in the dev container.
    • The Rust/OCaml performance gates in rewatch-ocaml/bench.

    rewatch/ keeps the integration suite and the behavior docs. rewatch-ocaml/ is not renamed in this PR; the directory name is still open. Comments, test names, and READMEs no longer refer to Rust. The README's "Differences from Rust rewatch" section became behavior notes.

Review guide

  • Windows snapshots: command validation now compares against snapshots on Windows too. Normalization covers native long and short paths, CRLF, and separators, but only Windows CI shows whether that is enough.
  • Bench removal: the bench scripts were acceptance gates against Rust ("OCaml ≤ 125% of Rust"). They could come back later as a baseline-vs-candidate comparison of two rescript builds.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gHBNSg9dHsEnBuQaPf

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Changelog

💥 Breaking Change

  • Remove the Rust build system rescript-rust; use rescript. Building the compiler no longer needs a Rust toolchain.

💅 Polish

  • rescript --filter accepts any Perl-style regular expression the build system can match, instead of only the subset that also meant the same in the Rust build system.

Semantic Diff

8 commits · Full page

Check rewatch output against snapshots instead of Rust rewatch

06d6bb5 · cknitt + Claude · Nov 05, 2026, 17:08 UTC

The check_*.sh scripts compared the OCaml build system with the Rust one, which is about to be removed. They now run rescript alone: each case keeps its expected outcome, and output the scripts used to compare with Rust's is compared with snapshots under rewatch-ocaml/tests/snapshots, written with UPDATE_SNAPSHOTS=1. Paths are replaced by placeholders, line endings and separators normalized, so one snapshot serves Unix and Windows.

Review

  • Do the snapshots still describe Rust's output? Yes: before removing Rust, every snapshot was checked against the Rust executable too; the verbose, interactive and command-validation snapshots match it. Remaining differences are the documented ones, whose cases already expected OCaml's outcome.
  • Which checks were dropped? Only Rust-only ones: the three missing-RESCRIPT_BSC_EXE cases (OCaml ignores the variable), Rust's exit codes and error wording. Config cases named for Rust's last-key-wins behavior (duplicate-last) were renamed, since duplicates are rejected.
Remove the Rust build system

8789a23 · cknitt + Claude · Nov 05, 2026, 17:08 UTC

rescript has run the OCaml build system since 13.0.0-alpha.7; the Rust implementation only shipped as rescript-rust for comparison. This removes its sources, the rescript-rust executable and launcher, the Cargo build in the Makefile and CI, the Rust/OCaml performance gates, Rust formatting and version constraints, and the Rust toolchain from the dev container. rewatch/ keeps the integration suite and the behavior documents; the implementation stays in rewatch-ocaml/.

⚠️ Breaking: rescript-rust and its RESCRIPT_BSC_EXE override are gone; use rescript, which has the compiler built in.

Make the command-validation snapshots hold in CI

70a6242 · cknitt + Claude · Nov 05, 2026, 18:23 UTC

CI sets CLICOLOR_FORCE=1, which colored the redirected-output cases, so the script now unsets it. On Windows the runner's TEMP is an 8.3 short path, so check_snapshot also replaces the explicit long spelling that bsc prints.

Sort verbose events in the C locale

0c1b07d · cknitt + Claude · Nov 05, 2026, 18:34 UTC

macOS CI sorts with a locale that puts compile dirty: before DEBUG:, so the sorted events did not match the snapshot written in the C locale.

Normalize escaped Windows paths in snapshots

e93d828 · cknitt + Claude · Nov 05, 2026, 18:39 UTC

Some diagnostics print a path as a quoted string, so on Windows its backslashes are doubled (C:\\Users\\...). check_snapshot now replaces that spelling of each root and turns escaped separators into slashes as well.

Keep backslashes in Unix snapshots and share path normalization

ab6306d · cknitt + Claude · Nov 05, 2026, 19:23 UTC

Review of #9238: check_snapshot turned every backslash into a slash, so a snapshot could not hold an escape such as \n, and a path printed with backslashes on Unix went unnoticed. It now rewrites separators on Windows only. The command-validation checks that grep for paths (normalize_project_path, require_error_contains) use the same normalization through the new normalize_paths helper, instead of deriving short paths from USERPROFILE.

Drop the remaining Rust settings from rewatch tests

09736cb · cknitt + Claude · Nov 05, 2026, 19:23 UTC

Review of #9238: the integration tests still set RUST_BACKTRACE and RAYON_NUM_THREADS, which rescript ignores. The two tests that ran Rust on one thread now set REWATCH_COMPILER_DOMAINS=1, so they again check scheduling with a single compiler worker. Comments shortened when the Rust mentions were removed are rewrapped.

✨ Accept every regular expression Re can match in --filter

290323e · cknitt + Claude · Nov 05, 2026, 19:45 UTC · new

--filter rejected valid Perl constructs, such as \Q...\E, \Z and [z-a], because Rust's regex crate read them differently. With the Rust build system gone, that parity check only refuses valid filters, so the filter now accepts what Re's Perl syntax parses and still rejects what Re cannot match, such as backreferences.

cknitt and others added 3 commits November 5, 2026 18:25
The check_*.sh scripts compared the OCaml build system with the Rust one,
which is about to be removed. They now run `rescript` alone: each case keeps
its expected outcome, and output the scripts used to compare with Rust's is
compared with snapshots under rewatch-ocaml/tests/snapshots, written with
UPDATE_SNAPSHOTS=1. Paths are replaced by placeholders, line endings and
separators normalized, so one snapshot serves Unix and Windows.

Review: Do the snapshots still describe Rust's output? Yes: before removing
Rust, every snapshot was checked against the Rust executable too; the
verbose, interactive and command-validation snapshots match it. Remaining
differences are the documented ones, whose cases already expected OCaml's
outcome.
Review: Which checks were dropped? Only Rust-only ones: the three
missing-`RESCRIPT_BSC_EXE` cases (OCaml ignores the variable), Rust's exit
codes and error wording. Config cases named for Rust's last-key-wins
behavior (`duplicate-last`) were renamed, since duplicates are rejected.

Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHBNSg9dHsEnBuQaPf
`rescript` has run the OCaml build system since 13.0.0-alpha.7; the Rust
implementation only shipped as `rescript-rust` for comparison. This removes
its sources, the `rescript-rust` executable and launcher, the Cargo build in
the Makefile and CI, the Rust/OCaml performance gates, Rust formatting and
version constraints, and the Rust toolchain from the dev container.
rewatch/ keeps the integration suite and the behavior documents;
the implementation stays in rewatch-ocaml/.

Breaking: `rescript-rust` and its `RESCRIPT_BSC_EXE` override are gone; use
`rescript`, which has the compiler built in.

Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHBNSg9dHsEnBuQaPf
CI sets CLICOLOR_FORCE=1, which colored the redirected-output cases, so the
script now unsets it. On Windows the runner's TEMP is an 8.3 short path, so
check_snapshot also replaces the explicit long spelling that bsc prints.

Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHBNSg9dHsEnBuQaPf
@cknitt
cknitt force-pushed the remove-rust-rewatch branch from b00a717 to 70a6242 Compare November 5, 2026 18:27
@cknitt

cknitt commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T18:37:36.285045Z 70a6242 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

macOS CI sorts with a locale that puts `compile dirty:` before `DEBUG:`, so
the sorted events did not match the snapshot written in the C locale.

Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHBNSg9dHsEnBuQaPf
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 70a624238c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Some diagnostics print a path as a quoted string, so on Windows its
backslashes are doubled (`C:\\Users\\...`). check_snapshot now replaces that
spelling of each root and turns escaped separators into slashes as well.

Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHBNSg9dHsEnBuQaPf
@pkg-pr-new

pkg-pr-new Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@9238

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@9238

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@9238

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@9238

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@9238

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@9238

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@9238

commit: 290323e

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

cknitt and others added 3 commits November 5, 2026 19:23
Review of #9238: check_snapshot turned every backslash into a slash, so a
snapshot could not hold an escape such as \n, and a path printed with
backslashes on Unix went unnoticed. It now rewrites separators on Windows
only. The command-validation checks that grep for paths
(normalize_project_path, require_error_contains) use the same normalization
through the new normalize_paths helper, instead of deriving short paths from
USERPROFILE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGBR9g3DD93vrWbYzU
Signed-off-by: Christoph Knittel <ck@cca.io>
Review of #9238: the integration tests still set RUST_BACKTRACE and
RAYON_NUM_THREADS, which rescript ignores. The two tests that ran Rust on
one thread now set REWATCH_COMPILER_DOMAINS=1, so they again check
scheduling with a single compiler worker. Comments shortened when the Rust
mentions were removed are rewrapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGBR9g3DD93vrWbYzU
Signed-off-by: Christoph Knittel <ck@cca.io>
--filter rejected valid Perl constructs, such as \Q...\E, \Z and [z-a],
because Rust's regex crate read them differently. With the Rust build
system gone, that parity check only refuses valid filters, so the filter
now accepts what Re's Perl syntax parses and still rejects what Re cannot
match, such as backreferences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGBR9g3DD93vrWbYzU
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt merged commit cb4406e into master Nov 6, 2026
26 checks passed
@cknitt
cknitt deleted the remove-rust-rewatch branch November 6, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants