@@ -580,11 +580,6 @@ impl<'a> CrateLocator<'a> {
580
580
) {
581
581
Ok ( blob) => {
582
582
if let Some ( h) = self . crate_matches ( & blob, & lib) {
583
- if blob. get_header ( ) . is_reference {
584
- if slot. is_none ( ) {
585
- todo ! ( "return error" ) ;
586
- }
587
- }
588
583
( h, blob)
589
584
} else {
590
585
info ! ( "metadata mismatch" ) ;
@@ -659,7 +654,12 @@ impl<'a> CrateLocator<'a> {
659
654
continue ;
660
655
}
661
656
}
662
- * slot = Some ( ( hash, metadata, lib. clone ( ) ) ) ;
657
+
658
+ if !metadata. get_header ( ) . is_reference {
659
+ // FIXME nicer error when only an rlib or dylib with is_reference is found
660
+ // and no .rmeta?
661
+ * slot = Some ( ( hash, metadata, lib. clone ( ) ) ) ;
662
+ }
663
663
ret = Some ( ( lib, kind) ) ;
664
664
}
665
665
@@ -735,6 +735,14 @@ impl<'a> CrateLocator<'a> {
735
735
} ;
736
736
if file. starts_with ( "lib" ) {
737
737
if file. ends_with ( ".rlib" ) {
738
+ if let Ok ( rmeta_path) = try_canonicalize (
739
+ loc_orig
740
+ . parent ( )
741
+ . unwrap ( )
742
+ . join ( file. strip_suffix ( ".rlib" ) . unwrap ( ) . to_owned ( ) + ".rmeta" ) ,
743
+ ) {
744
+ rmetas. insert ( rmeta_path, PathKind :: ExternFlag ) ;
745
+ }
738
746
rlibs. insert ( loc_canon. clone ( ) , PathKind :: ExternFlag ) ;
739
747
continue ;
740
748
}
@@ -746,6 +754,13 @@ impl<'a> CrateLocator<'a> {
746
754
let dll_prefix = self . target . dll_prefix . as_ref ( ) ;
747
755
let dll_suffix = self . target . dll_suffix . as_ref ( ) ;
748
756
if file. starts_with ( dll_prefix) && file. ends_with ( dll_suffix) {
757
+ if let Ok ( rmeta_path) = try_canonicalize ( loc_orig. parent ( ) . unwrap ( ) . join (
758
+ "lib" . to_owned ( )
759
+ + file. strip_prefix ( dll_prefix) . unwrap ( ) . strip_suffix ( dll_suffix) . unwrap ( )
760
+ + ".rmeta" ,
761
+ ) ) {
762
+ rmetas. insert ( rmeta_path, PathKind :: ExternFlag ) ;
763
+ }
749
764
dylibs. insert ( loc_canon. clone ( ) , PathKind :: ExternFlag ) ;
750
765
continue ;
751
766
}
0 commit comments