about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-02-07 18:00:20 +0000
committerMichael Goulet <michael@errs.io>2025-02-09 17:10:50 +0000
commit9c486a74dac6f11276df4bbd2abc526a82cd000f (patch)
treeb5c3138554369955362136bd7b885779e5812388 /library/std/src
parenta26e97be8826d408309fffbd8168362365719f50 (diff)
downloadrust-9c486a74dac6f11276df4bbd2abc526a82cd000f.tar.gz
rust-9c486a74dac6f11276df4bbd2abc526a82cd000f.zip
Mark link_section attr with unsafe
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sys/pal/unix/args.rs2
-rw-r--r--library/std/src/sys/pal/windows/compat.rs2
-rw-r--r--library/std/src/sys/thread_local/guard/windows.rs2
3 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/sys/pal/unix/args.rs b/library/std/src/sys/pal/unix/args.rs
index 8438a61e90f..608173b6376 100644
--- a/library/std/src/sys/pal/unix/args.rs
+++ b/library/std/src/sys/pal/unix/args.rs
@@ -147,7 +147,7 @@ mod imp {
     /// This allows `std::env::args` to work even in a `cdylib`, as it does on macOS and Windows.
     #[cfg(all(target_os = "linux", target_env = "gnu"))]
     #[used]
-    #[link_section = ".init_array.00099"]
+    #[unsafe(link_section = ".init_array.00099")]
     static ARGV_INIT_ARRAY: extern "C" fn(
         crate::os::raw::c_int,
         *const *const u8,
diff --git a/library/std/src/sys/pal/windows/compat.rs b/library/std/src/sys/pal/windows/compat.rs
index 42999da1664..2b9838437e9 100644
--- a/library/std/src/sys/pal/windows/compat.rs
+++ b/library/std/src/sys/pal/windows/compat.rs
@@ -39,7 +39,7 @@ use crate::sys::c;
 // See https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-initialization?view=msvc-170
 #[cfg(target_vendor = "win7")]
 #[used]
-#[link_section = ".CRT$XCT"]
+#[unsafe(link_section = ".CRT$XCT")]
 static INIT_TABLE_ENTRY: unsafe extern "C" fn() = init;
 
 /// Preload some imported functions.
diff --git a/library/std/src/sys/thread_local/guard/windows.rs b/library/std/src/sys/thread_local/guard/windows.rs
index 1752b0e1208..b15a0d7c0bd 100644
--- a/library/std/src/sys/thread_local/guard/windows.rs
+++ b/library/std/src/sys/thread_local/guard/windows.rs
@@ -74,7 +74,7 @@ pub fn enable() {
     unsafe { ptr::from_ref(&CALLBACK).read_volatile() };
 }
 
-#[link_section = ".CRT$XLB"]
+#[unsafe(link_section = ".CRT$XLB")]
 #[cfg_attr(miri, used)] // Miri only considers explicitly `#[used]` statics for `lookup_link_section`
 pub static CALLBACK: unsafe extern "system" fn(*mut c_void, u32, *mut c_void) = tls_callback;