File tree 1 file changed +14
-8
lines changed
1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -83,14 +83,20 @@ impl Rustc {
83
83
)
84
84
} ) ?;
85
85
let commit_hash = extract ( "commit-hash: " ) . ok ( ) . map ( |hash| {
86
- debug_assert ! (
87
- hash. chars( ) . all( |ch| ch. is_ascii_hexdigit( ) ) ,
88
- "commit hash must be a hex string, got: {hash:?}"
89
- ) ;
90
- debug_assert ! (
91
- hash. len( ) == 40 || hash. len( ) == 64 ,
92
- "hex string must be generated from sha1 or sha256 (i.e., it must be 40 or 64 characters long)\n got: {hash:?}"
93
- ) ;
86
+ // Possible commit-hash values from rustc are SHA hex string and "unknown". See:
87
+ // * https://github.com/rust-lang/rust/blob/531cb83fc/src/bootstrap/src/utils/channel.rs#L73
88
+ // * https://github.com/rust-lang/rust/blob/531cb83fc/compiler/rustc_driver_impl/src/lib.rs#L911-L913
89
+ #[ cfg( debug_assertions) ]
90
+ if hash != "unknown" {
91
+ debug_assert ! (
92
+ hash. chars( ) . all( |ch| ch. is_ascii_hexdigit( ) ) ,
93
+ "commit hash must be a hex string, got: {hash:?}"
94
+ ) ;
95
+ debug_assert ! (
96
+ hash. len( ) == 40 || hash. len( ) == 64 ,
97
+ "hex string must be generated from sha1 or sha256 (i.e., it must be 40 or 64 characters long)\n got: {hash:?}"
98
+ ) ;
99
+ }
94
100
hash. to_string ( )
95
101
} ) ;
96
102
You can’t perform that action at this time.
0 commit comments