Rust: Get the current compiler version

May 29, 2022  ‐ 1 min read

The version of the Rust compiler can be found by making use of the rustc command in your terminal. You need to pass either the --version long option or the -V short option (capital "v").

$ rustc --version
rustc 1.61.0 (fe5b13d68 2022-05-18)

To find the current version number in your Rust code you can make use of the version_check crate, which calls the rustc command behind the scenes and parses the output.

The command above shows the default compiler version, meaning the compiler you will default to when running the rustc command. You may have different versions installed though, the default one can be set using the rustup default <version> command.

To list other available Rust version you may run the rustup show command to show the installed compiler toolchains or profiles.