about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2025-09-09 13:17:45 +0200
committerjoboet <jonasboettiger@icloud.com>2025-09-10 15:34:38 +0200
commit4c992199598b4fddc25d52f40fa3642c9e065e60 (patch)
tree195b9cf4a65249f96abe504899001ca48798daf2 /library/std
parent82f5cdf33e15bf08548ec8b9f13bb4cad8ac5ae4 (diff)
downloadrust-4c992199598b4fddc25d52f40fa3642c9e065e60.tar.gz
rust-4c992199598b4fddc25d52f40fa3642c9e065e60.zip
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.
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/sys/pal/unix/weak.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/library/std/src/sys/pal/unix/weak.rs b/library/std/src/sys/pal/unix/weak.rs
index ad649fdbab6..a3b980a3f3d 100644
--- a/library/std/src/sys/pal/unix/weak.rs
+++ b/library/std/src/sys/pal/unix/weak.rs
@@ -27,6 +27,16 @@ use crate::marker::{FnPtr, PhantomData};
 use crate::sync::atomic::{Atomic, AtomicPtr, Ordering};
 use crate::{mem, ptr};
 
+// We currently only test `dlsym!`, but that doesn't work on all platforms, so
+// we gate the tests to only the platforms where it is actually used.
+//
+// FIXME(joboet): add more tests, reorganise the whole module and get rid of
+//                `#[allow(dead_code, unused_macros)]`.
+#[cfg(any(
+    target_vendor = "apple",
+    all(target_os = "linux", target_env = "gnu"),
+    target_os = "freebsd",
+))]
 #[cfg(test)]
 mod tests;