Expand description
Pre-flight environment check for the thin-rebuild pipeline.
Catches the “fat build was for one toolchain, the dev loop is now
using another” class of breakage before subsecond::apply_patch
runs and segfaults the device. The check is deliberately small —
we only assert what’s necessary to keep the same captured rustc
invocation viable:
- The current rustc still supports the target triple the fat
build was for. If a
rustup toolchainchange between the fat build and the first edit dropped the Android target, we want a clear error here, not a cryptic linker failure later.
Things we deliberately do NOT validate:
-
Exact rustc version match. Patch dylibs survive across patch-level rustc bumps in practice (subsecond is pretty tolerant); demanding strict equality would break workflows where
rustup updateis a frequent occurrence. Major version regressions WILL be surfaced by the thin rebuild itself (rustc returns non-zero), so we let that path do the talking. -
Sysroot stability. Same reasoning — rustc verifies its own sysroot at compile time. We don’t add a redundant probe.
Functions§
- ensure_
target_ supported - Spawn
rustc --print=target-listand verifytripleshows up. Synchronous on purpose — runs once per dev-server boot, not per patch. - extract_
target_ triple - Pull the value passed to
--target(or--target=...) out of a rustc argv. Pure helper — same shape asextract_crate_namein the shim. - validate_
environment - Run the pre-flight checks. Returns Ok(()) if it’s safe to call
thin_rebuild; otherwise Err with a message a human can act on.