File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ pub struct Rustc {
28
28
pub version : semver:: Version ,
29
29
/// The host triple (arch-platform-OS), this comes from verbose_version.
30
30
pub host : InternedString ,
31
+ /// The rustc full commit hash, this comes from version_version`.
32
+ pub commit_hash : String ,
31
33
cache : Mutex < Cache > ,
32
34
}
33
35
@@ -81,6 +83,18 @@ impl Rustc {
81
83
verbose_version
82
84
)
83
85
} ) ?;
86
+ let commit_hash = {
87
+ let hash = extract ( "commit-hash: " ) ?;
88
+ assert ! (
89
+ hash. chars( ) . all( |ch| ch. is_ascii_hexdigit( ) ) ,
90
+ "commit hash must be a hex string"
91
+ ) ;
92
+ assert ! (
93
+ hash. len( ) == 40 || hash. len( ) == 64 ,
94
+ "hex string must be generated from sha1 or sha256"
95
+ ) ;
96
+ hash. to_string ( )
97
+ } ;
84
98
85
99
Ok ( Rustc {
86
100
path,
@@ -89,6 +103,7 @@ impl Rustc {
89
103
verbose_version,
90
104
version,
91
105
host,
106
+ commit_hash,
92
107
cache : Mutex :: new ( cache) ,
93
108
} )
94
109
}
You can’t perform that action at this time.
0 commit comments