Skip to content

Commit

Permalink
Allow to customize // TODO: comment for deprecated safe autofix
Browse files Browse the repository at this point in the history
Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.
  • Loading branch information
tbu- committed Aug 13, 2024
1 parent c5e8189 commit 23a1968
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,13 @@ impl Error for VarError {
/// }
/// assert_eq!(env::var(key), Ok("VALUE".to_string()));
/// ```
#[rustc_deprecated_safe_2024]
#[cfg_attr(bootstrap, rustc_deprecated_safe_2024)]
#[cfg_attr(
not(bootstrap),
rustc_deprecated_safe_2024(
todo = "Audit that the environment access only happens in single-threaded code."
)
)]
#[stable(feature = "env", since = "1.0.0")]
pub unsafe fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
let (key, value) = (key.as_ref(), value.as_ref());
Expand Down Expand Up @@ -419,7 +425,13 @@ pub unsafe fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
/// }
/// assert!(env::var(key).is_err());
/// ```
#[rustc_deprecated_safe_2024]
#[cfg_attr(bootstrap, rustc_deprecated_safe_2024)]
#[cfg_attr(
not(bootstrap),
rustc_deprecated_safe_2024(
todo = "Audit that the environment access only happens in single-threaded code."
)
)]
#[stable(feature = "env", since = "1.0.0")]
pub unsafe fn remove_var<K: AsRef<OsStr>>(key: K) {
let key = key.as_ref();
Expand Down

0 comments on commit 23a1968

Please sign in to comment.