about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorThe Miri Cronjob Bot <miri@cron.bot>2024-08-17 05:02:50 +0000
committerThe Miri Cronjob Bot <miri@cron.bot>2024-08-17 05:02:50 +0000
commitdc0faecfcf6dcedd55efd96f3206d702f2601481 (patch)
treead1aa1ca51d81a6fcd9af2260178f094e2d7fdba /library/std
parent23b57e8994892748039ec22279070b2434ea9687 (diff)
parentf24a6ba06f4190d8ec4f22d1baa800e64b1900cb (diff)
downloadrust-dc0faecfcf6dcedd55efd96f3206d702f2601481.tar.gz
rust-dc0faecfcf6dcedd55efd96f3206d702f2601481.zip
Merge from rustc
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/os/unix/process.rs14
-rw-r--r--library/std/src/thread/mod.rs3
2 files changed, 12 insertions, 5 deletions
diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs
index c53423675bd..46202441d4e 100644
--- a/library/std/src/os/unix/process.rs
+++ b/library/std/src/os/unix/process.rs
@@ -109,13 +109,21 @@ pub trait CommandExt: Sealed {
     /// Schedules a closure to be run just before the `exec` function is
     /// invoked.
     ///
-    /// This method is stable and usable, but it should be unsafe. To fix
-    /// that, it got deprecated in favor of the unsafe [`pre_exec`].
+    /// `before_exec` used to be a safe method, but it needs to be unsafe since the closure may only
+    /// perform operations that are *async-signal-safe*. Hence it got deprecated in favor of the
+    /// unsafe [`pre_exec`]. Meanwhile, Rust gained the ability to make an existing safe method
+    /// fully unsafe in a new edition, which is how `before_exec` became `unsafe`. It still also
+    /// remains deprecated; `pre_exec` should be used instead.
     ///
     /// [`pre_exec`]: CommandExt::pre_exec
     #[stable(feature = "process_exec", since = "1.15.0")]
     #[deprecated(since = "1.37.0", note = "should be unsafe, use `pre_exec` instead")]
-    fn before_exec<F>(&mut self, f: F) -> &mut process::Command
+    #[cfg_attr(bootstrap, rustc_deprecated_safe_2024)]
+    #[cfg_attr(
+        not(bootstrap),
+        rustc_deprecated_safe_2024(audit_that = "the closure is async-signal-safe")
+    )]
+    unsafe fn before_exec<F>(&mut self, f: F) -> &mut process::Command
     where
         F: FnMut() -> io::Result<()> + Send + Sync + 'static,
     {
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs
index 88b31cd78a6..e29c28f3c7e 100644
--- a/library/std/src/thread/mod.rs
+++ b/library/std/src/thread/mod.rs
@@ -412,7 +412,6 @@ impl Builder {
     /// # Examples
     ///
     /// ```
-    /// #![feature(thread_spawn_unchecked)]
     /// use std::thread;
     ///
     /// let builder = thread::Builder::new();
@@ -433,7 +432,7 @@ impl Builder {
     /// ```
     ///
     /// [`io::Result`]: crate::io::Result
-    #[unstable(feature = "thread_spawn_unchecked", issue = "55132")]
+    #[stable(feature = "thread_spawn_unchecked", since = "CURRENT_RUSTC_VERSION")]
     pub unsafe fn spawn_unchecked<F, T>(self, f: F) -> io::Result<JoinHandle<T>>
     where
         F: FnOnce() -> T,