@@ -511,7 +511,7 @@ impl<'a> CrateLocator<'a> {
511
511
rlib : self . extract_one ( rlibs, CrateFlavor :: Rlib , & mut slot) ?,
512
512
dylib : self . extract_one ( dylibs, CrateFlavor :: Dylib , & mut slot) ?,
513
513
} ;
514
- Ok ( slot. map ( |( _ , svh, metadata) | ( svh, Library { source, metadata } ) ) )
514
+ Ok ( slot. map ( |( svh, metadata, _ ) | ( svh, Library { source, metadata } ) ) )
515
515
}
516
516
517
517
fn needs_crate_flavor ( & self , flavor : CrateFlavor ) -> bool {
@@ -535,11 +535,13 @@ impl<'a> CrateLocator<'a> {
535
535
// read the metadata from it if `*slot` is `None`. If the metadata couldn't
536
536
// be read, it is assumed that the file isn't a valid rust library (no
537
537
// errors are emitted).
538
+ //
539
+ // The `PathBuf` in `slot` will only be used for diagnostic purposes.
538
540
fn extract_one (
539
541
& mut self ,
540
542
m : FxHashMap < PathBuf , PathKind > ,
541
543
flavor : CrateFlavor ,
542
- slot : & mut Option < ( PathBuf , Svh , MetadataBlob ) > ,
544
+ slot : & mut Option < ( Svh , MetadataBlob , PathBuf ) > ,
543
545
) -> Result < Option < ( PathBuf , PathKind ) > , CrateError > {
544
546
// If we are producing an rlib, and we've already loaded metadata, then
545
547
// we should not attempt to discover further crate sources (unless we're
@@ -595,15 +597,15 @@ impl<'a> CrateLocator<'a> {
595
597
}
596
598
} ;
597
599
// If we see multiple hashes, emit an error about duplicate candidates.
598
- if slot. as_ref ( ) . is_some_and ( |s| s. 1 != hash) {
600
+ if slot. as_ref ( ) . is_some_and ( |s| s. 0 != hash) {
599
601
if let Some ( candidates) = err_data {
600
602
return Err ( CrateError :: MultipleCandidates (
601
603
self . crate_name ,
602
604
flavor,
603
605
candidates,
604
606
) ) ;
605
607
}
606
- err_data = Some ( vec ! [ slot. take( ) . unwrap( ) . 0 ] ) ;
608
+ err_data = Some ( vec ! [ slot. take( ) . unwrap( ) . 2 ] ) ;
607
609
}
608
610
if let Some ( candidates) = & mut err_data {
609
611
candidates. push ( lib) ;
@@ -636,7 +638,7 @@ impl<'a> CrateLocator<'a> {
636
638
continue ;
637
639
}
638
640
}
639
- * slot = Some ( ( lib. clone ( ) , hash , metadata ) ) ;
641
+ * slot = Some ( ( hash , metadata , lib. clone ( ) ) ) ;
640
642
ret = Some ( ( lib, kind) ) ;
641
643
}
642
644
0 commit comments