Skip to content

Commit a6cf4f6

Browse files
committed
Only query staticlibs if they don't collide with other lib types on prefix/suffix
1 parent 4fa463f commit a6cf4f6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/rustc_metadata/src/locator.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,15 @@ impl<'a> CrateLocator<'a> {
413413
debug!("searching {}", search_path.dir.display());
414414
let spf = &search_path.files;
415415

416+
let mut should_check_staticlibs = true;
416417
for (prefix, suffix, kind) in [
417418
(rlib_prefix.as_str(), rlib_suffix, CrateFlavor::Rlib),
418419
(rmeta_prefix.as_str(), rmeta_suffix, CrateFlavor::Rmeta),
419420
(dylib_prefix, dylib_suffix, CrateFlavor::Dylib),
420421
] {
422+
if prefix == staticlib_prefix && suffix == staticlib_suffix {
423+
should_check_staticlibs = false;
424+
}
421425
if let Some(matches) = spf.query(prefix, suffix) {
422426
for (hash, spf) in matches {
423427
info!("lib candidate: {}", spf.path.display());
@@ -438,7 +442,10 @@ impl<'a> CrateLocator<'a> {
438442
}
439443
}
440444
}
441-
if let Some(static_matches) = spf.query(staticlib_prefix, staticlib_suffix) {
445+
if let Some(static_matches) = should_check_staticlibs
446+
.then(|| spf.query(staticlib_prefix, staticlib_suffix))
447+
.flatten()
448+
{
442449
for (_, spf) in static_matches {
443450
self.crate_rejections.via_kind.push(CrateMismatch {
444451
path: spf.path.to_path_buf(),

0 commit comments

Comments
 (0)