Add repro-check tool for verifying reproducible Rust builds by windsunil · Pull Request #149888 · rust-lang/rust (original) (raw)
This patch introduces a new host tool called repro-check that helps verify whether Rust compiler builds are reproducible.
Summary:
-> Builds the stage-2 Rust toolchain (or a full distribution) twice in separate workspaces.
-> Compares the resulting sysroots byte-for-byte using SHA-256.
-> Generates a detailed HTML report highlighting mismatches and ignored files.
-> Writes a deterministic bootstrap.toml for each build to ensure consistent settings.
-> Supports parallel hashing via Rayon.
-> Accepts standard options such as:
--jobs – Number of parallel jobs
--exclude-pattern – Ignore files matching a pattern
--path-delta – Adds extra directory levels to second build for path-sensitivity testing
--full-dist – Build full distribution instead of stage 2
--clean – Start from a clean workspace
--skip-copy – Reuse existing workspace without copying source
--verbose – Print detailed logging
Included components:
-> src/tools/repro-check/ – Tool source code (main.rs, build.rs, compare.rs, fs_utils.rs, config.rs)
-> Integration tests for hash computation, mismatch detection, ignored patterns, and case-insensitive handling.
-> Updates to Cargo.toml and Cargo.lock to include repro-check dependencies.
-> Bootstrap and builder updates to register the new tool.
References:
Tracking issues: #139793, #134589, #144669
Usage:
Build the tool
./x.py build src/tools/repro-check
Run (stage2 only, host target)
./build/x86_64-unknown-linux-gnu/stage1-tools-bin/repro-check
Full distribution with custom options
./build/x86_64-unknown-linux-gnu/stage1-tools-bin/repro-check
--jobs 16
--exclude-pattern .so
--path-delta 10
--html-output my-report.html