Skip to content

Commit fa62a0e

Browse files
committed
Auto merge of #12963 - RalfJung:commit-hash, r=weihanglo
make some debug assertion failures more informative In rust-lang/miri#3160, we got a report of a user running into an assertion failure in cargo. Unfortunately the failure message is not very informative. This PR hopefully makes that failure easier to debug.
2 parents 3eb246c + 1b3a53c commit fa62a0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cargo/util/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ impl Rustc {
8585
let commit_hash = extract("commit-hash: ").ok().map(|hash| {
8686
debug_assert!(
8787
hash.chars().all(|ch| ch.is_ascii_hexdigit()),
88-
"commit hash must be a hex string"
88+
"commit hash must be a hex string, got: {hash:?}"
8989
);
9090
debug_assert!(
9191
hash.len() == 40 || hash.len() == 64,
92-
"hex string must be generated from sha1 or sha256"
92+
"hex string must be generated from sha1 or sha256 (i.e., it must be 40 or 64 characters long)\ngot: {hash:?}"
9393
);
9494
hash.to_string()
9595
});

0 commit comments

Comments
 (0)