SergioBenitez / version_check

Rust library for checking the installed/running rustc's version.
https://docs.rs/version_check
Apache License 2.0
50 stars 14 forks source link

Parse the version and date from verbose info #16

Closed cuviper closed 3 years ago

cuviper commented 3 years ago

The plain rustc --version string is not well structured, and in particular the git commit info is not necessarily present when rustc was built out of tree, like distro builds. Furthermore, rust-lang/rust#79115 made it possible to have completely custom information in that version's parenthesized block, which may not look like git info at all.

Adding --verbose outputs each field on its own line, in particular "release: ..." for the version number and "commit-date: ..." for the git info, although the latter is just "unknown" for out-of-tree builds. This still works all the way back to Rust 1.0.0.

SergioBenitez commented 3 years ago

Merged in cb8592005c573e9946aad85fd475d66103cb77d0. Thank you! :)