Skip to content

Commit b22c4c1

Browse files
committed
fix cfg for windows
1 parent da9a847 commit b22c4c1

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
@@ -1165,8 +1165,8 @@ fn format_dlopen_err(e: &(dyn std::error::Error + 'static)) -> String {
11651165
}
11661166

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

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

0 commit comments

Comments
 (0)