#version #rustc #check #minimum

build version_check

Tiny crate to check the version of the installed/running rustc

9 releases

0.9.2 May 24, 2020
0.9.1 May 24, 2019
0.1.5 Sep 23, 2018
0.1.4 Jul 5, 2018
0.1.0 Jan 15, 2017

#351 in Development tools

Download history 197651/week @ 2020-03-23 197621/week @ 2020-03-30 189471/week @ 2020-04-06 195881/week @ 2020-04-13 209775/week @ 2020-04-20 208920/week @ 2020-04-27 208373/week @ 2020-05-04 222004/week @ 2020-05-11 202970/week @ 2020-05-18 256511/week @ 2020-05-25 275497/week @ 2020-06-01 271243/week @ 2020-06-08 265884/week @ 2020-06-15 260387/week @ 2020-06-22 247446/week @ 2020-06-29 245475/week @ 2020-07-06

873,512 downloads per month
Used in 14,326 crates (54 directly)


417 lines


Build Status Current Crates.io Version rustdocs on docs.rs

This tiny crate checks that the running or installed rustc meets some version requirements. The version is queried by calling the Rust compiler with --version. The path to the compiler is determined first via the RUSTC environment variable. If it is not set, then rustc is used. If that fails, no determination is made, and calls return None.


Add to your Cargo.toml file, typically as a build dependency:

version_check = "0.9"

version_check is compatible and compiles with Rust 1.0.0 and beyond.


Set a cfg flag in build.rs if the running compiler was determined to be at least version 1.13.0:

extern crate version_check as rustc;

if rustc::is_min_version("1.13.0").unwrap_or(false) {

Check that the running compiler was released on or after 2018-12-18:

extern crate version_check as rustc;

match rustc::is_min_date("2018-12-18") {
    Some(true) => "Yep! It's recent!",
    Some(false) => "No, it's older.",
    None => "Couldn't determine the rustc version."

Check that the running compiler supports feature flags:

extern crate version_check as rustc;

match rustc::is_feature_flaggable() {
    Some(true) => "Yes! It's a dev or nightly release!",
    Some(false) => "No, it's stable or beta.",
    None => "Couldn't determine the rustc version."

See the rustdocs for more examples and complete documentation.


This crate is dead simple with no dependencies. If you need something more and don't care about panicking if the version cannot be obtained, or if you don't mind adding dependencies, see rustc_version.


version_check is licensed under either of the following, at your option:

No runtime deps