File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -109,13 +109,21 @@ pub trait CommandExt: Sealed {
109
109
/// Schedules a closure to be run just before the `exec` function is
110
110
/// invoked.
111
111
///
112
- /// This method is stable and usable, but it should be unsafe. To fix
113
- /// that, it got deprecated in favor of the unsafe [`pre_exec`].
112
+ /// `before_exec` used to be a safe method, but it needs to be unsafe since the closure may only
113
+ /// perform operations that are *async-signal-safe*. Hence it got deprecated in favor of the
114
+ /// unsafe [`pre_exec`]. Meanwhile, Rust gained the ability to make an existing safe method
115
+ /// fully unsafe in a new edition, which is how `before_exec` became `unsafe`. It still also
116
+ /// remains deprecated; `pre_exec` should be used instead.
114
117
///
115
118
/// [`pre_exec`]: CommandExt::pre_exec
116
119
#[ stable( feature = "process_exec" , since = "1.15.0" ) ]
117
120
#[ deprecated( since = "1.37.0" , note = "should be unsafe, use `pre_exec` instead" ) ]
118
- fn before_exec < F > ( & mut self , f : F ) -> & mut process:: Command
121
+ #[ cfg_attr( bootstrap, rustc_deprecated_safe_2024) ]
122
+ #[ cfg_attr(
123
+ not( bootstrap) ,
124
+ rustc_deprecated_safe_2024( audit_that = "the closure is async-signal-safe" )
125
+ ) ]
126
+ unsafe fn before_exec < F > ( & mut self , f : F ) -> & mut process:: Command
119
127
where
120
128
F : FnMut ( ) -> io:: Result < ( ) > + Send + Sync + ' static ,
121
129
{
You can’t perform that action at this time.
0 commit comments