Skip to content

Commit b56fdcb

Browse files
authored
Rollup merge of rust-lang#127857 - tbu-:pr_deprecated_safe_todo, r=petrochenkov
Allow to customize `// TODO:` comment for deprecated safe autofix Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970. Tracking: - rust-lang#124866
2 parents 77f462d + f81c96a commit b56fdcb

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Diff for: std/src/env.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,13 @@ impl Error for VarError {
355355
/// }
356356
/// assert_eq!(env::var(key), Ok("VALUE".to_string()));
357357
/// ```
358-
#[rustc_deprecated_safe_2024]
358+
#[cfg_attr(bootstrap, rustc_deprecated_safe_2024)]
359+
#[cfg_attr(
360+
not(bootstrap),
361+
rustc_deprecated_safe_2024(
362+
audit_that = "the environment access only happens in single-threaded code"
363+
)
364+
)]
359365
#[stable(feature = "env", since = "1.0.0")]
360366
pub unsafe fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
361367
let (key, value) = (key.as_ref(), value.as_ref());
@@ -419,7 +425,13 @@ pub unsafe fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
419425
/// }
420426
/// assert!(env::var(key).is_err());
421427
/// ```
422-
#[rustc_deprecated_safe_2024]
428+
#[cfg_attr(bootstrap, rustc_deprecated_safe_2024)]
429+
#[cfg_attr(
430+
not(bootstrap),
431+
rustc_deprecated_safe_2024(
432+
audit_that = "the environment access only happens in single-threaded code"
433+
)
434+
)]
423435
#[stable(feature = "env", since = "1.0.0")]
424436
pub unsafe fn remove_var<K: AsRef<OsStr>>(key: K) {
425437
let key = key.as_ref();

0 commit comments

Comments
 (0)