@@ -102,15 +102,9 @@ export class CacheConfig {
102102 // resulting environment hash.
103103
104104 let hasher = crypto . createHash ( "sha1" ) ;
105- const rustVersions = Array . from ( await getRustVersions ( cmdFormat ) ) ;
106- // Doesn't matter how they're sorted, just as long as it's deterministic.
107- rustVersions . sort ( ) ;
108-
105+ const rustVersions = ( self . keyRust = await getRustVersions ( cmdFormat ) ) ;
109106 for ( const rustVersion of rustVersions ) {
110- const { release, host, "commit-hash" : commitHash } = rustVersion ;
111- const keyRust = `${ release } ${ host } ${ commitHash } ` ;
112- hasher . update ( keyRust ) ;
113- self . keyRust . push ( keyRust ) ;
107+ hasher . update ( rustVersion ) ;
114108 }
115109
116110 // these prefixes should cover most of the compiler / rust / cargo keys
@@ -392,14 +386,9 @@ export async function getCargoBins(): Promise<Set<string>> {
392386
393387 return bins ;
394388}
395- interface RustVersion {
396- host : string ;
397- release : string ;
398- "commit-hash" : string ;
399- }
400389
401- async function getRustVersions ( cmdFormat : string ) : Promise < Set < RustVersion > > {
402- const versions = new Set < RustVersion > ( ) ;
390+ async function getRustVersions ( cmdFormat : string ) : Promise < Array < string > > {
391+ const versions = new Set < string > ( ) ;
403392
404393 versions . add ( parseRustVersion ( await getCmdOutput ( cmdFormat , "rustc -vV" ) ) ) ;
405394
@@ -420,16 +409,25 @@ async function getRustVersions(cmdFormat: string): Promise<Set<RustVersion>> {
420409 versions . add ( parseRustVersion ( await getCmdOutput ( cmdFormat , `rustup run ${ toolchain } rustc -vV` ) ) ) ;
421410 }
422411 }
423- return versions ;
412+ const rustVersions = Array . from ( versions ) ;
413+ // Doesn't matter how they're sorted, just as long as it's deterministic.
414+ rustVersions . sort ( ) ;
415+ return rustVersions ;
424416}
425417
426- function parseRustVersion ( stdout : string ) : RustVersion {
418+ interface RustVersion {
419+ host : string ;
420+ release : string ;
421+ "commit-hash" : string ;
422+ }
423+ function parseRustVersion ( stdout : string ) : string {
427424 const splits = stdout
428425 . split ( / [ \n \r ] + / )
429426 . filter ( Boolean )
430427 . map ( ( s ) => s . split ( ":" ) . map ( ( s ) => s . trim ( ) ) )
431428 . filter ( ( s ) => s . length === 2 ) ;
432- return Object . fromEntries ( splits ) ;
429+ const { release, host, "commit-hash" : commitHash } = Object . fromEntries ( splits ) as RustVersion ;
430+ return `${ release } ${ host } ${ commitHash } ` ;
433431}
434432
435433async function globFiles ( pattern : string ) : Promise < string [ ] > {
0 commit comments