Skip to content

Commit dd50648

Browse files
committed
Fix stdlib building
1 parent 5e86595 commit dd50648

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Diff for: compiler/rustc_metadata/src/locator.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,6 @@ impl<'a> CrateLocator<'a> {
575575
) {
576576
Ok(blob) => {
577577
if let Some(h) = self.crate_matches(&blob, &lib) {
578-
if blob.get_header().is_reference {
579-
if slot.is_none() {
580-
todo!("return error");
581-
}
582-
}
583578
(h, blob)
584579
} else {
585580
info!("metadata mismatch");
@@ -654,7 +649,12 @@ impl<'a> CrateLocator<'a> {
654649
continue;
655650
}
656651
}
657-
*slot = Some((hash, metadata, lib.clone()));
652+
653+
if !metadata.get_header().is_reference {
654+
// FIXME nicer error when only an rlib or dylib with is_reference is found
655+
// and no .rmeta?
656+
*slot = Some((hash, metadata, lib.clone()));
657+
}
658658
ret = Some((lib, kind));
659659
}
660660

@@ -744,10 +744,12 @@ impl<'a> CrateLocator<'a> {
744744
let loc_canon = loc.canonicalized().clone();
745745
let loc = loc.original();
746746
if loc.file_name().unwrap().to_str().unwrap().ends_with(".rlib") {
747+
rmetas.insert(loc_canon.with_extension("rmeta"), PathKind::ExternFlag);
747748
rlibs.insert(loc_canon, PathKind::ExternFlag);
748749
} else if loc.file_name().unwrap().to_str().unwrap().ends_with(".rmeta") {
749750
rmetas.insert(loc_canon, PathKind::ExternFlag);
750751
} else {
752+
rmetas.insert(loc_canon.with_extension("rmeta"), PathKind::ExternFlag);
751753
dylibs.insert(loc_canon, PathKind::ExternFlag);
752754
}
753755
} else {

0 commit comments

Comments
 (0)