We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fdbc432 commit be3452aCopy full SHA for be3452a
tests/ui/auxiliary/tls-export.rs
@@ -0,0 +1,13 @@
1
+#![crate_type = "dylib"]
2
+#![feature(thread_local)]
3
+#![feature(cfg_target_thread_local)]
4
+
5
+#[cfg(target_thread_local)]
6
+#[thread_local]
7
+pub static FOO: bool = true;
8
9
10
+#[inline(never)]
11
+pub fn foo_addr() -> usize {
12
+ &FOO as *const bool as usize
13
+}
tests/ui/tls-dylib-access.rs
+// aux-build: tls-export.rs
+// run-pass
+extern crate tls_export;
+fn main() {
+ // Check that we get the real address of the TLS in the dylib
+ #[cfg(target_thread_local)]
+ assert_eq!(&tls_export::FOO as *const bool as usize, tls_export::foo_addr());
0 commit comments