Get the `rustc` version *in the system*.
()
| 1 | /// Get the `rustc` version *in the system*. |
| 2 | pub fn rustc_version() -> String { |
| 3 | let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".to_string()); |
| 4 | let output = std::process::Command::new(rustc) |
| 5 | .arg("--version") |
| 6 | .output() |
| 7 | .unwrap(); |
| 8 | let stdout = std::str::from_utf8(&output.stdout).unwrap(); |
| 9 | parse_rustc_version(stdout) |
| 10 | } |
| 11 | |
| 12 | fn parse_rustc_version(line: &str) -> String { |
| 13 | let full_version = line.split_whitespace().nth(1).expect("full version"); |
no test coverage detected