Top Level Namespace

Defined Under Namespace

Modules: Microsandbox

Constant Summary collapse

MSRV =

Preflight: the embedded microsandbox core is edition 2024 and pulls smoltcp, which sets a Minimum Supported Rust Version of 1.91. An older rustc (commonly Homebrew's, which shadows a newer rustup on PATH and ignores this gem's rust-toolchain.toml) fails deep in the build with a cryptic "rustc X is not supported by smoltcp" error. Detect it up front and explain the fix instead.

Probe the same rustc the build will invoke. create_rust_makefile drives the build through cargo, and cargo resolves its compiler exactly as: the RUSTC env var if set, otherwise the bare rustc found on PATH. It does NOT use the rustc sitting beside the cargo binary, and the rustup cargo shim neither sets RUSTC nor prepends its toolchain bin to PATH — toolchain selection survives only because the PATH rustc is normally itself a rustup shim that honors rust-toolchain.toml. So a non-rustup rustc earlier on PATH (which reads neither RUSTUP_TOOLCHAIN nor the toolchain file) is what the build actually runs. Mirroring cargo's RUSTC-then-PATH resolution is the only probe that neither false-passes (the trap of checking the cargo sibling, which stays a valid rustup shim while the build silently uses the stale PATH rustc) nor false-aborts (when RUSTC points at a newer compiler than the PATH rustc).

Gem::Version.new("1.91")

Instance Method Summary collapse

Instance Method Details

#build_rustcObject



27
28
29
30
# File 'ext/microsandbox/extconf.rb', line 27

def build_rustc
  rustc = ENV["RUSTC"].to_s.strip
  rustc.empty? ? "rustc" : rustc
end