Skip to content

Commit 1e1e0ee

Browse files
committed
native libs: Explicitly limit foo.lib -> libfoo.a fallback to MSVC
In practice this doesn't change anything for current built-in targets
1 parent e1ab664 commit 1e1e0ee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/rustc_metadata/src/native_libs.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,14 @@ pub fn try_find_native_static_library(
9696
verbatim: bool,
9797
) -> Option<PathBuf> {
9898
let default = sess.staticlib_components(verbatim);
99+
let unix = ("lib", ".a");
99100
let formats = if verbatim {
100101
vec![default]
102+
} else if default != unix && sess.target.is_like_msvc {
103+
// On Windows MSVC naming scheme `libfoo.a` is used as a fallback from default `foo.lib`.
104+
vec![default, unix]
101105
} else {
102-
// On Windows, static libraries sometimes show up as libfoo.a and other
103-
// times show up as foo.lib
104-
let unix = ("lib", ".a");
105-
if default == unix { vec![default] } else { vec![default, unix] }
106+
vec![default]
106107
};
107108

108109
walk_native_lib_search_dirs(sess, None, |dir, is_framework| {

0 commit comments

Comments
 (0)