Skip to content

Commit cc8ea94

Browse files
committed
fix cfg for windows
1 parent 7af8f2e commit cc8ea94

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/rustc_metadata/src/creader.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,8 +1166,8 @@ fn format_dlopen_err(e: &(dyn std::error::Error + 'static)) -> String {
11661166
}
11671167

11681168
fn attempt_load_dylib(path: &Path) -> Result<libloading::Library, libloading::Error> {
1169+
#[cfg(target_os = "aix")]
11691170
if let Some(ext) = path.extension()
1170-
&& cfg!(target_os = "aix")
11711171
&& ext.eq("a")
11721172
{
11731173
// On AIX, we ship all libraries as .a big_af archive
@@ -1183,10 +1183,11 @@ fn attempt_load_dylib(path: &Path) -> Result<libloading::Library, libloading::Er
11831183
// flags = RTLD_LAZY | RTLD_LOCAL | RTLD_MEMBER
11841184
// these are not yet in libc https://github.com/rust-lang/libc/pull/4044
11851185
let flags = 0x4 | 0x80000 | 0x40000;
1186-
unsafe { libloading::os::unix::Library::open(Some(&new_path), flags) }.map(|lib| lib.into())
1187-
} else {
1188-
unsafe { libloading::Library::new(&path) }
1186+
return unsafe { libloading::os::unix::Library::open(Some(&new_path), flags) }
1187+
.map(|lib| lib.into());
11891188
}
1189+
1190+
unsafe { libloading::Library::new(&path) }
11901191
}
11911192

11921193
// On Windows the compiler would sometimes intermittently fail to open the

0 commit comments

Comments
 (0)