panicked at 'unexpected -vV format' with compiling
Description
On WSL ubuntu 18.04, compile fail and output info:
thread 'main' panicked at 'unexpected -vV format', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc_version-0.1.7/src/lib.rs:126:5
Environment info
- Operating system: WSL Ubuntu 18.04
- uname -a: Linux DESKTOP-GSOK8JJ 4.4.0-17763-Microsoft #864 (closed)-Microsoft Thu Nov 07 15:22:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
-
rustc -V
: rustc 1.47.0-nightly (6c8927b0c 2020-07-26) - git rev-parse HEAD: d7e52b52
Steps to reproduce
cd path/to/your/projects/folder/
curl -sf https://gitlab.redox-os.org/redox-os/redox/raw/master/bootstrap.sh -o bootstrap.sh && bash -e bootstrap.sh
cd redox
make all
Behavior
-
Expected behavior: Successful build.
-
Actual behavior: Build fail and output panicked.
Self Analysis
compile panicked with info unexpected -vV format
, related to source code .cargo/registry/src/github.com-1ecc6299db9ec823/rustc_version-0.1.7/src/lib.rs:126
.
// lib.rs
/// Parses a "rustc -vV" output string and returns
/// the SemVer version and additional metadata
/// like the git short hash and build date.
pub fn version_meta_for(verbose_version_string: &str) -> VersionMeta {
let out: Vec<_> = verbose_version_string.lines().collect();
const ERR_MSG: &'static str = "unexpected -vV format";
assert!(out.len() == 6 || out.len() == 7, ERR_MSG);
...
This function is used to parse rustc -vV
,and I execute this command manually.
% rustc -vV
rustc 1.47.0-nightly (6c8927b0c 2020-07-26)
binary: rustc
commit-hash: 6c8927b0cf80ceee19386026cf9d7fd4fd9d486f
commit-date: 2020-07-26
host: x86_64-unknown-linux-gnu
release: 1.47.0-nightly
LLVM version: 10.0
According to the rustc -vV
message, I write a testcase.
24 #[test]
23 fn parse_nightly_cy() {
22 let version = version_meta_for(
21 "rustc 1.47.0-nightly (6c8927b0c 2020-07-26)
20 binary: rustc
19 commit-hash: 6c8927b0cf80ceee19386026cf9d7fd4fd9d486f
18 commit-date: 2020-07-26
17 host: x86_64-unknown-linux-gnu
16 release: 1.47.0-nightly
15 LLVM version: 10.0",
14 );
13
12 assert_eq!(version.semver, Version::parse("1.47.0-nightly").unwrap());
11 assert_eq!(
10 version.commit_hash,
9 Some("6c8927b0cf80ceee19386026cf9d7fd4fd9d486f".into())
8 );
7 assert_eq!(version.commit_date, Some("2020-07-26".into()));
6 assert_eq!(version.channel, Channel::Nightly);
5 assert_eq!(version.host, "x86_64-unknown-linux-gnu");
4 assert_eq!(
3 version.short_version_string,
2 "rustc 1.47.0-nightly (6c8927b0c 2020-07-26)"
1 );
313 }
and everything is fine,when I ran cargo test
.this means version_meta_for
is correct.so why compile fail?