version_check
Tiny crate to check the version of the installed/running rustc.
This package has a good security score with no known vulnerabilities.
Community Reviews
Build-time only utility that does one thing well with zero runtime cost
The library shells out to `rustc --version` once per build, parses the output, and gives you the semver components. Error handling is straightforward - it returns `Option` types, so if rustc isn't found or the version can't be parsed, you get `None` and can handle it in your build script accordingly. No panics, no surprises.
From an operational standpoint, there's nothing to tune or monitor since this never touches production. The only gotcha is that it runs during build time, so in CI/CD pipelines it adds a few milliseconds to compile time. Documentation is minimal but sufficient - you don't need much for such a focused crate. It's been stable across versions with no breaking changes in recent releases.
Best for: Build scripts that need to conditionally enable features or emit compile-time warnings based on the Rust compiler version.
Avoid if: You need runtime version detection or are looking for general semver parsing utilities.
Simple, focused API for build-time Rust version checks
The documentation is concise with practical examples that you can copy directly into your build.rs. Error handling is minimal but appropriate for the use case - when rustc isn't found or version parsing fails, it returns None rather than panicking, letting you decide how to handle it. The most common pattern is checking for minimum versions to conditionally enable cfg flags, and the crate makes this dead simple.
One minor frustration is that error context could be richer when version detection fails - you're left debugging why None was returned. The API also doesn't expose structured version info for complex comparisons, though this rarely matters in practice since the provided helpers cover 95% of use cases.
Best for: Build scripts that need to conditionally compile code based on rustc version or feature availability.
Avoid if: You need runtime version checks or complex version comparison logic beyond simple min/max bounds.
Simple, focused tool for build-time Rust version checks
The documentation is concise but complete, with practical examples showing the most common use case: conditionally enabling features based on rustc version. Error handling is minimal by design - functions return `Option` types when version detection fails, which is appropriate since build scripts typically need to make conservative assumptions when uncertain.
One minor frustration is the lack of strong typing around version strings - you pass versions as `&str` like "1.50.0" with no compile-time validation, so typos only surface at build time. The crate also doesn't provide helpers for more complex version comparisons (like ranges), though this keeps the API surface intentionally small.
Best for: Build scripts that need to conditionally enable cfg flags or features based on the minimum Rust version.
Avoid if: You need runtime version detection or complex version range comparisons beyond simple minimum checks.
Sign in to write a review
Sign In