Skip to content

Commit 4c99219

Browse files
committed
std: only test dlsym! on platforms where it is actually used
`dlsym` doesn't work for finding libc symbols on platforms like linux-musl, so the test will fail.
1 parent 82f5cdf commit 4c99219

File tree

1 file changed

+10
-0
lines changed
  • library/std/src/sys/pal/unix

1 file changed

+10
-0
lines changed

library/std/src/sys/pal/unix/weak.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ use crate::marker::{FnPtr, PhantomData};
2727
use crate::sync::atomic::{Atomic, AtomicPtr, Ordering};
2828
use crate::{mem, ptr};
2929

30+
// We currently only test `dlsym!`, but that doesn't work on all platforms, so
31+
// we gate the tests to only the platforms where it is actually used.
32+
//
33+
// FIXME(joboet): add more tests, reorganise the whole module and get rid of
34+
// `#[allow(dead_code, unused_macros)]`.
35+
#[cfg(any(
36+
target_vendor = "apple",
37+
all(target_os = "linux", target_env = "gnu"),
38+
target_os = "freebsd",
39+
))]
3040
#[cfg(test)]
3141
mod tests;
3242

0 commit comments

Comments
 (0)